Skip to content
OAuth / SSO Write-up Intermediate

Account Takeover with OAuth Misconfiguration.

The Facebook OAuth linking flow lacked a state parameter and did not bind the OAuth code to the user's session, so an attacker could send a crafted callback URL containing their own Facebook code to a victim who had started the flow, linking the attacker's Facebook account to the victim's profile and enabling account takeover.

matitanium Follow

Published on matitanium.medium.com

I’m matitanium, a security researcher working across multiple domain from web applications to Android security, and active in red teaming engagements. I love digging into authentication logic, hunting for creative bugs, and exploring overlooked corners of complex systems.

matitanium, on matitanium.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

The OAuth flow lacked a state parameter and did not bind the authorization code to the user's session, allowing an attacker to inject their own code into a victim's session.

Impact

An attacker could take over any account that had started the Facebook linking flow, gaining access to personal data and bypassing normal login protections.

What the attacker needed

Victim has started Facebook linking flow; Victim clicks attacker's link; Attacker has a Facebook account

The fix

The OAuth flow should implement the state parameter, reject callbacks lacking proper session binding, and validate the origin and integrity of each request.

How it was found

  1. Victim clicks Add Facebook Account, which sets a session cookie.
  2. Victim closes the tab without finishing the flow; the cookie remains.
  3. Attacker links their own Facebook account to their own profile and intercepts the callback URL containing the code.
  4. Attacker sends the callback URL to the victim.
  5. Victim clicks the link, and the app completes the flow using the attacker's code.
  6. Attacker's Facebook account becomes linked to the victim's account, allowing login 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.

OAuth is a way to log in using another service, like Facebook. When you link an account, the app should check that the response really belongs to you. Here, it did not, so an attacker could trick the app into linking their own Facebook account to your profile.

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.