nOAuth: How Microsoft OAuth Misconfiguration Can Lead to Full Account Takeover
A misconfiguration in Microsoft Azure AD OAuth allowed attackers to set an arbitrary email address in their Azure AD account without verification. Applications that used the email claim as a unique identifier could then be tricked into merging the attacker's account with a victim's account, leading to full account takeover.
Don't have the time to read the entire post? Our human writers will be sad, but we understand.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application used the mutable and unverified 'email' claim from Azure AD as the unique user identifier instead of the immutable 'sub' claim.
Impact
An attacker could take full control over a victim's account on any vulnerable application that uses the email claim as a unique identifier or merges accounts based on it, even if the victim does not have a Microsoft account.
What the attacker needed
Attacker has an Azure AD tenant; Victim has an account on the vulnerable app; App uses email claim as identifier or merges accounts
The fix
Applications should use the 'sub' claim as the unique identifier and not trust the email claim; if merging accounts, validate the email with a magic link or use Microsoft's new claims to verify email domain ownership.
How it was found
- The attacker accesses their Azure AD account as admin.
- The attacker changes the 'Email' attribute to the victim's email address.
- The attacker uses 'Log in with Microsoft' on a vulnerable app that uses the email address as a unique identifier.
- If the app merges user accounts without validation, the attacker gains full control over the victim's account.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When you click 'Log in with Microsoft', Microsoft tells the app who you are by sending some information, including your email address. The problem was that Microsoft let anyone set any email address on their account without proving they owned it. If an app trusted that email address to identify you, an attacker could set their email to yours and log in as you.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.