OAuth CSRF: Exploiting the Authorization Code Flow for Account Takeover
The OAuth authorization code flow lacked CSRF protection, so an attacker could link their own Facebook account to a victim's account by tricking the victim into visiting a crafted callback URL. This allowed the attacker to log in as the victim via Facebook.
Published on medium.com
Hello everyone! It’s cyberpro151 back with another writeup about an Account Takeover vulnerability that I found using CSRF vulnerability in OAuth functionality on a public program.
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 callback endpoint did not use or validate a state parameter, allowing CSRF.
Impact
An attacker could take over a victim's account by linking their own Facebook account, then logging in as the victim.
What the attacker needed
Victim clicks a link; attacker has a Facebook account; victim is logged in
How it was found
- Log in as attacker in one browser and as victim in another.
- As attacker, start linking a Facebook account and capture the callback request.
- Copy the callback URL and open it in the victim's browser.
- Click 'CONNECT ACCOUNT' to link the attacker's Facebook account to the victim's account.
- Log out and log in with the attacker's Facebook account to 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 to log in using another service, like Facebook. The site did not check that the login request really came from the user, so an attacker could make the victim connect the attacker's Facebook account to the victim's account. Then the attacker could log in as the victim.
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.