Skip to content
OAuth / SSO Write-up Intermediate

OAuth Token Validation Bug in Facebook

A missing validation on the OAuth token in Facebook's Twitter linking endpoint allowed an attacker to reuse a previously generated token to link a victim's page to the attacker's Twitter account, even after the attacker's admin role was removed. The attacker could then send a crafted URL to the victim, who upon opening it would link their page to the attacker's Twitter account.

Meta

Published on whitehatstories.blogspot.in

May 06, 2017

The author, on whitehatstories.blogspot.in

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 token was not invalidated or re-validated against the user's current permissions when the callback URL was used, allowing reuse after the attacker lost admin access.

Impact

An attacker could link a victim's page to the attacker's Twitter account even after losing admin access, potentially allowing the attacker to post as the page or access page data via Twitter.

What the attacker needed

Attacker is admin of victim's page; victim removes attacker's admin role; victim clicks attacker-supplied link

The fix

The OAuth token should be validated against the user's current permissions and invalidated after use or when the user's role changes.

How it was found

  1. Attacker and victim are both admins of a page.
  2. Attacker starts linking the page to Twitter and obtains the authorization URL containing the oauth token, but does not complete the link.
  3. Victim removes the attacker's admin role from the page.
  4. Attacker opens the saved URL and captures the return URL containing oauth_token and oauth_verifier.
  5. Attacker sends the return URL to the victim.
  6. Victim opens the URL, and the page gets linked to the attacker's Twitter 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 for one website to ask another website to confirm who you are, without sharing your password. Here, Facebook let a user link their page to a Twitter account, but the special code (token) used for that link did not expire and was not checked properly. So an attacker could save the code, get removed as admin, and still trick the victim into using that old code to link the page to the attacker's Twitter 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.

More from Meta

View all

The newest disclosed reports for this program.

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.