Skip to content
XSS Write-up Advanced

How a $62,500 Self-XSS Became a Full Facebook and Instagram Account Takeover — A Review of Youssef…

A third-party payment provider embedded in Facebook's payment page had an XSS vulnerability, allowing an attacker to send a trusted postMessage that Facebook injected as unsanitised HTML, achieving XSS on facebook.com. This led to Instagram and Facebook account takeover via OAuth code theft and device-based login.

Vivek ps Follow

Published on medium.com

Note: This article is a review and narrative analysis of a bug bounty write-up published by security researcher Youssef Sammouda (sam0). Full credit goes to the original researcher.

Vivek PS, 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

Facebook's postMessage handler validated the origin but did not sanitise the message content, so a compromised trusted origin could inject arbitrary HTML and script into facebook.com.

Impact

An attacker could take over the victim's Instagram and Facebook accounts, potentially without passwords or 2FA prompts, though the attack required the victim to be logged into the attacker's account first.

What the attacker needed

Victim logged into attacker's Facebook account; Attacker has a valid nonce and user_id; Victim uses Facebook Save Login feature

The fix

The bug was fixed by Facebook within a month of reporting.

How it was found

  1. Force the victim to log into the attacker's Facebook account via Login CSRF.
  2. Load the ACH payment initialization page with a valid attacker nonce and user_id.
  3. Facebook embeds the third-party payment provider inside a trusted iframe.
  4. Exploit XSS in the third-party provider via a malicious config file to compromise the iframe.
  5. The compromised iframe relays a learnMore message to the Facebook parent window.
  6. Facebook injects attacker-supplied HTML into the page DOM without sanitisation, achieving XSS on facebook.com.

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 payment provider website used inside Facebook had a bug that let attackers run their own code there. Because Facebook trusted that website, it accepted messages from it and inserted the content into its own page without checking it, so the attacker's code ran on Facebook. This let the attacker take over the victim's Instagram and Facebook accounts.

What is XSS?

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

More by Vivek ps

View all

5 more disclosed reports, best first.

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.