Skip to content
OAuth / SSO Write-up Intermediate

Day 21: Full Account Takeover via Open Redirection

The OAuth login flow accepted a redirect_uri pointing to a domain outside the whitelist, so the authorisation code and state were sent to an attacker-controlled site. An attacker could then replay the stolen code in their own browser to log in as the victim.

medium.com

Published on medium.com

Today’s write-up by Vishal Barot details a severe OAuth misconfiguration that allowed an account takeover via open redirection.

dani3l, on medium.com

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

Impact

An attacker could take over a victim's account without a password or second factor, needing only that the victim clicks a link and logs in with Google.

What the attacker needed

Victim clicks a phishing link; victim logs in with Google; attacker controls a domain

The fix

The redirect_uri should be restricted to an exact whitelist, authorisation codes should be single-use and short-lived, PKCE should be used, and the state parameter should be validated.

How it was found

  1. Change the redirect_uri in the OAuth login URL to a domain the attacker controls.
  2. Have the victim log in with Google so the state and code are sent to that domain.
  3. Capture the callback URL containing the state and code.
  4. Open the captured callback URL in a different browser to be logged in as the victim.

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 Google', the site sends you to Google and then back to a callback address. That address is meant to be checked against a list of trusted sites. Here the check was missing, so the login code could be sent to any site the attacker chose, and whoever received it could use it to sign in as you.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

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.