Skip to content
Account takeover Write-up Advanced

Account Takeover: Trading OAuth Codes for fun and profit

The OAuth flow lacked a state parameter, allowing an attacker to log a victim into the attacker's account. Combined with a self-XSS in the mobile app (which bypassed the WAF) and a forced OAuth flow with an invalid state, the attacker could steal the victim's OAuth code and achieve account takeover.

medium.com

Published on medium.com

I discovered an intriguing account takeover vulnerability in a private bug bounty program. It involved chaining multiple bugs and misconfigurations to successfully achieve ATO.

Sazouki, 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 implementation omitted the state parameter, and the mobile app allowed self-XSS without the WAF, enabling the attack chain.

Impact

An attacker could take over a victim's account with a single click, but the attack required the victim to interact with a malicious link and the mobile app's lack of WAF was essential.

What the attacker needed

Victim clicks a link; attacker has an account; mobile app used (no WAF)

How it was found

  1. Attacker sends a link to the victim that logs the victim into the attacker's account using the attacker's OAuth code.
  2. The victim is redirected to a page containing a stored XSS payload.
  3. The XSS payload initiates a new OAuth flow to log into the victim's account, using an invalid state parameter to prevent the web app from consuming the code.
  4. The XSS captures the victim's OAuth code and sends it to the attacker's server.

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 'state' parameter is a security code that stops someone from tricking you into logging into their account. Here, that code was missing, and the attacker also found a way to run their own script in the victim's browser, so they could steal the victim's login token.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.