FB OAuth Misconfiguration Leads to Takeover any Account
The Facebook OAuth login flow accepted a missing email as the literal string 'undefined' and mapped it to an existing account, and the email parameter in the login request could be changed to any registered address. An attacker could therefore log into any account on the site without the victim's interaction.
Published on sl4x0.medium.com
Greetings, world! In my recent Pentest Engagement at BugSwagger, I stumbled upon a weird bug while registering to kickstart testing the target with my team.
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 server trusted the client-supplied email parameter from the OAuth callback and used it to identify the account, instead of verifying the identity token and using the email from Facebook's response.
Impact
An attacker could take over any account on the website without any interaction from the victim.
What the attacker needed
Target supports Facebook OAuth login; attacker has a Facebook account; victim has a registered account
How it was found
- Start the Facebook login on the target site.
- In Facebook's permission screen, edit access and uncheck the email address checkbox.
- Continue the login and observe the site redirect to an account tied to the word 'undefined'.
- Capture the login request sent to the site's authentication endpoint.
- Change the email parameter from 'undefined' to another registered user's email address.
- Submit the request and gain access to that user'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.
When you choose 'Log in with Facebook', the site asks Facebook for your details, including your email. This site treated a missing email as the word 'undefined' and looked up an account with that name. Worse, the email sent in the login request could be swapped for someone else's, so the site logged the attacker in as that person.
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.