Mask Off: How I Exploited Broken OAuth to Login as Anyone
The OAuth implementation lacked client_secret validation, state parameter checks, redirect_uri whitelisting, and session binding. An attacker could steal authorization codes and exchange them for access tokens, leading to account takeover.
Free link 🎈
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
Likely the OAuth implementation failed to validate the client secret, state parameter, redirect URI, and session binding, allowing authorization code theft and exchange.
Impact
An attacker could take over any user's account using OAuth login, access sensitive data, and potentially escalate to admin accounts if admins used OAuth.
What the attacker needed
Victim clicks a link; attacker controls a domain; OAuth login enabled
The fix
The OAuth implementation should validate the client_secret, enforce and validate the state parameter, whitelist redirect URIs, and bind authorization codes to the user session.
How it was found
- Set up a phishing page that initiates the OAuth flow with an attacker-controlled redirect_uri.
- When the victim clicks, Google sends the authorization code to the attacker's server.
- The attacker exchanges the stolen code for an access token at the token endpoint.
- The attacker uses the access token to access 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.
OAuth is a way to log in using another service like Google. The app made several mistakes: it didn't check that the login request came from a trusted app, it didn't use a security token to prevent fake login requests, it allowed redirecting to any website, and it didn't tie the login code to the user's session. This let an attacker steal a user's login code and use it to access their account.
What is OAuth / SSO?
Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.