Skip to content
XSS Write-up Advanced

How I Used Reflected XSS + CORS + CSRF to Get 1-Click OAuth Misconfiguration

The account settings page allowed linking a social login account via a JSON request protected only by a CSRF token embedded in the page. A reflected XSS on the same domain let the attacker read that token and submit the linking request, so a victim who opened a crafted link had the attacker's Facebook account attached to their account, enabling login as the victim.

medium.com

Published on medium.com

While I was testing, I registered an account and started discovering and browsing all features on my target to better understand the target. During this process, I found on the Settings page that I can connect my account with social login like Facebook or Google login.

Muhammed Mubarak, on 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

Likely the social-account linking endpoint relied only on a CSRF token that was readable from the same origin, and a reflected XSS on that origin let attacker JavaScript read the token and forge the request.

Impact

A victim who opened the crafted link could have the attacker's Facebook account linked to theirs, letting the attacker log in to the victim's account; the text does not mention any defence that limited the attack.

What the attacker needed

Victim clicks a crafted link; attacker has a Facebook account; reflected XSS on the same domain

How it was found

  1. Register an account and open the settings page that offers connecting a social login.
  2. Start connecting a Facebook account and intercept the final request that links the external account.
  3. Find a reflected XSS on the same domain that can load an external script.
  4. Host a script that fetches the security page, reads the CSRF token from the meta tag, and posts the linking request with the attacker's Facebook account id.
  5. Send the victim the XSS link so the script runs in their browser and links the attacker's Facebook 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.

A website let you attach a Facebook login to your account. The request that does this was protected by a secret token, but the site also had a cross-site scripting (XSS) flaw, which means an attacker could run their own JavaScript in the victim's browser on that site. Because the script ran on the same site, it could read the secret token and send the linking request as the victim, so the attacker's Facebook account became a way into the victim's account.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.