Pwning Facebook Authorization through Chrome extension
Facebook's OAuth authorisation endpoint accepted redirect URIs pointing to arbitrary Facebook pages, including ones with fragment-based paths, and did not validate the redirect URI when exchanging an authorisation code for a token. An attacker could craft a link that, when clicked by a victim, caused a signed_request containing a code to be sent to an attacker-controlled URL via the Referer header, allowing the attacker to exchange the code for a token and sign into the victim's account on a third-party site.
Meta
Published on isciurus.blogspot.ca
I'll describe here several flaws in Facebook's authentication with OAuth and how I was able to exploit them for getting access to victim's account on a site, which uses Facebook authentication. Facebook security team quickly responded and rolled out a fix for this issue shortly after I had reported it.
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 authorisation server failed to strictly validate the redirect_uri against registered callbacks and did not bind the authorisation code to the client or user session when exchanging it for a token.
Impact
An attacker could sign into a victim's account on a third-party site that uses Facebook authentication, provided the victim clicked the crafted link and authorised the attacker's app.
What the attacker needed
Victim clicks a crafted link; victim authorises attacker's Facebook app; third-party site uses Facebook login with signed_request
The fix
Facebook rolled out a fix for this issue shortly after it was reported.
How it was found
- Attacker crafts a Facebook authorisation URL with a redirect_uri pointing to a Facebook page that includes a fragment-based path to an attacker-controlled OAuth dialog.
- Victim clicks the link and authorises the attacker's Facebook app.
- Facebook issues a signed_request containing a code and redirects the victim to a Facebook URL that includes the signed_request in the fragment.
- The victim is then redirected to an attacker-controlled URL (evil_referref_dumper) with the signed_request in the Referer header.
- Attacker extracts the code from the Referer and submits it to the third-party site (freelancer.com) to obtain a token and access 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 for websites to let you log in using another service, like Facebook, without sharing your password. The report found that Facebook's login system could be tricked into sending a special security code to a page the attacker controlled, because it did not properly check where it was allowed to send that code. The attacker could then use that code to log in as the victim on a third-party site that used Facebook login.
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.