Redirect Roulette: How Poor OAuth Redirect Handling Gave Me Acco
The OAuth authorisation server did not properly validate the redirect_uri parameter, allowing an attacker to supply a malicious domain. An attacker could steal the authorisation code and exchange it for access tokens, taking over the victim's account.
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
The OAuth server did not strictly validate the redirect_uri, allowing domains like app.target.com.evil.com to be accepted.
Impact
An attacker could take over the victim's account, gaining access to their inbox and admin panels.
What the attacker needed
Victim clicks a link; attacker controls a domain
The fix
The OAuth server should use exact match redirect URI whitelisting and avoid wildcards or subdomain matching.
How it was found
- Host a malicious endpoint at a domain that looks like the legitimate one.
- Send the victim a link to the OAuth authorisation endpoint with the malicious redirect_uri.
- The victim logs in and the authorisation code is sent to the attacker's endpoint.
- Capture the code and exchange it for access tokens.
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 for apps to let you log in using another service, like 'Log in with Google'. The app sends you to the service, which then sends you back with a special code. If the service doesn't check carefully where it sends you back, an attacker can trick it into sending the code to their own site, and then use that code to access your 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.