How I Discovered an SSO Impersonation Bug: Lessons Learned
The web app trusted client-supplied email and objectId from a JSON object during Microsoft SSO login instead of validating the ID token. An attacker could remove the objectId field and replace the email with another user's email to log in as that user without their password.
medium.com
Published on medium.com
SSO (Single Sign-On) is a convenient way to authenticate users, and many apps rely on it for security. But even well-known systems like Microsoft’s Azure AD can have vulnerabilities if not integrated properly.
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 app trusted client-supplied identity data (email and objectId) without validating the ID token issued by Microsoft.
Impact
An attacker could impersonate any user, including potentially administrators, without knowing their password.
What the attacker needed
A valid account on the app; ability to intercept HTTP requests; knowledge of a target user's email
The fix
The app should validate the ID token server-side and never trust client-supplied identity data such as email or objectId.
How it was found
- Start the Microsoft SSO login and enter valid credentials.
- Intercept the authentication request containing a JSON object with email, tenantId, and objectId.
- Remove the objectId field and replace the email with another user's email.
- Forward the modified request to be logged in as that user.
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.
Single Sign-On (SSO) lets you log in to an app using another service, like Microsoft. After you log in, the app should check a special proof (the ID token) from Microsoft to confirm who you are. Here, the app instead trusted information sent by the browser, so changing that information let the attacker pretend to be someone else.
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.