Skip to content
OAuth / SSO Write-up Intermediate

Advanced OAuth Secrets Leads To Account Takeover(ATO)

The write-up describes how OAuth parameters such as state, redirect_uri and response_mode can be abused when misconfigured, allowing an attacker to steal an authorization code and take over a victim's account. It also shows how an open redirect combined with a missing state check can lead to account takeover.

0xMado-1Tap Follow

Published on medium.com

OAuth is a framework for delegated access that lets third-party apps act on a user behalf without sharing passwords OAuth 1.0 used signatures, while OAuth 2.0 simplifies the flow by relying on TLS and bearer tokens

Mado, 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

Root cause

Likely the OAuth client and authorization server failed to properly validate the state parameter and redirect_uri, and allowed response_mode to be changed, so authorization codes could be leaked or reused.

Impact

An attacker could steal an authorization code and exchange it for a token, leading to full account takeover; however, the text notes that modern authorization servers often validate redirect_uri against a whitelist, making the open redirect attack unlikely to succeed without an additional bypass.

What the attacker needed

Victim clicks a crafted OAuth link; OAuth client does not verify state; redirect_uri validation is weak or bypassable; response_mode can be changed to fragment

The fix

The application should enforce and verify the state parameter, strictly validate redirect_uri against a whitelist, and avoid allowing response_mode to be changed to fragment.

How it was found

  1. The attacker sets the state parameter to a value they control or notices the application does not require it.
  2. The attacker changes the redirect_uri to point to their own server or an open redirect on the target.
  3. The attacker changes response_mode to fragment so the authorization code appears in the URL fragment.
  4. The victim is tricked into logging in through the crafted OAuth link.
  5. The authorization code ends up in the URL fragment on the attacker's domain or is leaked via an open redirect.
  6. The attacker exchanges the stolen code for an access token and takes 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.

OAuth is a way to log in to a website using another service, like Google, without giving that website your password. When the login finishes, the service sends a short-lived code back to the website, and the website swaps it for a token that proves who you are. If an attacker can trick that code into going to their own server, or reuse a code from their own account, they can log in as the victim.

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.