The Tenant That Was Not Hers: Reading tid in a Microsoft ID Token

Web & API Security Level 2/4 ~3 min November 13, 2026

The challenge

A stranger signed in to Maya's Brieflane account. Read who issued the token, not who it names. Give the tenant ID that really issued it.

What you'll learn

  • Read the issuer claims (iss, tid) of an Entra ID token
  • Tell aud, oid, sub and tid apart
  • Explain why the email claim is not an identity in a multi-tenant app
  • Name the identifiers and checks that stop nOAuth

Skills tested

JWT analysisOpenID ConnectIdentity and access management

Prerequisites

  • What a JWT is
  • What Sign in with Microsoft (OAuth / OpenID Connect) does

How it works

An OpenID Connect ID token is a signed statement from an issuer saying who just signed in. With Microsoft Entra ID the issuer is a tenant, one organisation's directory: iss is https://login.microsoftonline.com/{tenant}/v2.0 and the same GUID is in tid. Every tenant's tokens are signed with the same Microsoft keys, so a valid signature proves the token came from a tenant, not from the one you expected.

Inside a tenant, a user is identified by oid (the object ID) and sub (unique per user and app). email is different: it is copied from the user's mail attribute, which the tenant's own admins can edit and which nobody has to verify. A multi-tenant app that maps the email in a token to an account lets any tenant admin sign in as anybody. Descope called this nOAuth in 2023.

Common mistakes

  • Answering aud. aud is the client ID of Brieflane's own app registration: who the token is for, not who issued it.
  • Answering oid or sub. They identify the user object inside the issuing tenant, not the tenant.
  • Answering tallis-advisory.example. Right tenant, wrong value: that is the domain in preferred_username. The question asks for the tenant ID, the GUID in tid.
  • Trusting the signature. RS256 with a Microsoft kid only proves Microsoft signed it for some tenant. The signature is genuine; the email is not.

How to defend against it

  • Identify Microsoft users by tid + oid (or sub), stored when the account is first linked. Never look an account up by email, name or preferred_username.
  • Tie each customer organisation to its tenant ID and reject tokens whose tid is not one of that customer's tenants.
  • If an email must be used, request the optional xms_edov claim and trust the email only when it is true, and keep Entra ID's removeUnverifiedEmailClaim behaviour on for the app registration (older registrations can still receive unverified emails).
  • Linking a new sign-in method to an existing account should require the existing method first.

Full solution

Pro and Max members unlock the complete step-by-step walkthrough.

Go Pro

Community stats

214 completions
91% success rate
M2F14M3 First blood

Related Daily Hacks

42,000+ Hackers Real labs Free
Start Hacking Free or solve today's hack, no account needed