Skip to content
XSS Write-up Advanced

When Self-XSS Isn’t Self: A $62,500 Meta Bug Through a Third-Party Payment Iframe

T4nv1 Follow

Published on medium.com

When you add a bank account to pay for ads on Facebook, the setup page doesn’t collect everything itself. It embeds a third-party payment provider’s page in an iframe.

T4nv1, 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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 7 min read.

Context

The target here is Facebook's bank-payment setup page, the flow you go through when you add a bank account (ACH) to pay for ads. The page does not collect the banking details itself. It embeds a third-party payment provider's page in an iframe, and the provider handles the sensitive step. The Facebook page then has to hear back about the result, and the browser mechanism for that conversation is postMessage: the iframe sends a message and a listener on the Facebook page decides what to do with it.

A well-designed listener asks two questions: who sent this, and is the content safe to use. According to the write-up, the page's listener handled the first question reasonably, by only accepting messages from the payment provider's origin. The failure was on the second: for one message type, the content was inserted into the page without sanitisation. That made Facebook's security on this page only as strong as the payment provider's. If an attacker could control what the provider's frame says, Facebook would faithfully put it into its own page.

The finding belongs to Youssef Sammouda, who published his own write-up on 15 January 2026. This article explains the ideas in it. The researcher deliberately left out payloads, exact endpoints, message formats and the account-takeover specifics, and some of those are omitted here too. The goal is to teach the pattern, not to reproduce the attack.

Photo by Austin Kirk on Unsplash From the original on medium.com

Photo by Austin Kirk on Unsplash

Setup

The vulnerable page required a per-user, server-generated token. The token was tied to the logged-in account, so an attacker could only use their own token on their own account. That is what made the bug a textbook self-XSS: a script injection that only fires in your own session. Most programs treat self-XSS as low or no impact, and for good reason, because if the only person you can attack is yourself there is no victim.

The report does not describe the accounts, tools or browser versions used in testing. The dates it gives are:

Event Date
Reported 18 October 2024 (acknowledged the same day)
Fixed 19 November 2024
Bounty awarded 20 November 2024, $62,500
Write-up published 15 January 2026

The amount, dates and technical outline all come from the researcher's own blog post. No Meta statement or independent coverage confirming the figure was found, so treat it as the researcher's own account of his payout. The write-up as accessed did not describe what Meta changed, only that it was fixed on 19 November 2024.

Finding it

According to the write-up, the payment page's postMessage listener checked the sender's origin but did not sanitise the content of one message type before inserting it into the page. On its own that is a self-XSS, because the per-user token means the injected script only runs in the session of the person who supplied the token.

The question that matters for every self-XSS is whether the victim can be made to be the one in the attacker's session. That is where the write-up gets interesting, and it is the pivot of the whole chain.

Exploitation

Step 1: Login CSRF

Logging a victim into the attacker's account is a request-forgery problem rather than a theft problem. If a login endpoint can be triggered cross-site, a victim's browser can be signed into an account the attacker controls. Now the self in self-XSS is the victim's browser. The report describes this ingredient at that level and does not publish the request that performs it.

Step 2: Control of the trusted frame

Having a script run in the victim's browser also required control over what the embedded provider's frame says. The write-up describes an XSS flaw in the third-party provider's own context, which let the attacker control that trusted frame. The frame then relayed HTML up to Facebook's page, giving script execution on facebook.com. The message format and the exact trigger are not described.

Step 3: Stitch the two together

The victim's browser, signed into the attacker's account, loads the vulnerable payment page with the attacker's valid token, and the page runs attacker-controlled script on a real Facebook origin. The structure is what matters: a low-impact bug becomes high-impact when a second bug changes who the victim is.

Step 4: What script on facebook.com can do

Script execution on the main origin is powerful because of what the browser lets same-origin code reach. The write-up describes two consequences.

Instagram. From a script running on facebook.com, the researcher could start an Instagram OAuth flow and read the authorisation code from a facebook.com callback page, which enables account linking or takeover on the Instagram side.

Facebook. The researcher says he found two paths to full Facebook account takeover, involving saved-login (device-switching) features and a Google OAuth fallback, and used a Blob URL to keep the malicious page alive without reloads. He chose not to publish the details of those steps.

He also argued there was a wider risk: a compromise of the third-party provider could affect any Facebook user adding a payment method, because the origin check trusted the provider so completely. He says he stopped further exploitation to avoid causing harm.

Root cause

The mistake is in the listener's second question. An origin check says who sent the message, not that the content is safe. For one message type the content was inserted into the page without sanitisation, so the page trusted the provider's output as if it were its own markup. The origin check did not stop this because the message genuinely came from the trusted origin; the flaw was in what happened to the content afterwards.

The self-XSS limitation was not a real barrier either, because the per-user token only binds the injection to a session, and a login CSRF can change whose session the victim's browser is in. The report does not describe any other defence that was in place.

Impact

Under the conditions described, an attacker could get script execution on facebook.com in a victim's browser, then use it to take over the victim's Instagram account through the OAuth flow, and, by the researcher's account, reach full Facebook account takeover through two paths he did not publish. The wider risk is that a compromise of the third-party provider could affect any Facebook user adding a payment method.

The payout follows the demonstrated impact, not the severity label of the first bug: a self-XSS that many programs reject outright, escalated into script on the main origin of a platform with billions of accounts, with takeover of both Facebook and Instagram accounts and a systemic dependency on a third party's security. Meta acknowledged the report the same day, fixed it in about a month, and awarded the bounty the day after the fix.

Fix

The report says the issue was fixed on 19 November 2024 but does not describe what Meta changed. The following are the defensive measures the write-up recommends, not a description of the actual patch.

  • Sanitise every message field, even from trusted origins. Insert content as text (textContent), never as HTML, unless it has been through a strict sanitiser.
  • Prefer structured, schema-validated messages: accept only known message types with known fields and types, and ignore the rest.
  • Do not trust partners more than your own code. Any third party embedded in your page can be compromised, so assume their output is untrusted input.
  • Use CSP to limit the blast radius. A strict Content Security Policy makes it harder for injected script to run or load further code.
  • Defend login and logout against CSRF. Require unguessable state or tokens, and use SameSite cookie attributes, so a login cannot be forced cross-site.
  • Do not let a page that handles sensitive flows reflect externally influenced HTML. Isolate payment and identity flows on narrowly scoped origins.
  • Take self-XSS seriously in triage. Ask whether a session-swapping bug elsewhere could make the victim the self.

Variants to test

  1. Audit every postMessage listener's two questions. For each listener, check who is allowed to send the message and what happens to the content. A positive result is a message type whose content reaches the DOM as HTML, or reaches a sink such as innerHTML, even when the origin check passes.
  2. Look for login CSRF next to any self-XSS. Check whether a login endpoint can be triggered cross-site. A positive result is a victim's browser being signed into an attacker-controlled account without an unguessable state value.
  3. Map third-party iframes as part of the attack surface. Payment providers, chat widgets, analytics and consent managers all sit inside the target's trust boundary. A positive result is any way to influence what one of those frames says, for example an XSS in the provider's own context.
  4. Check whether the vulnerable page is reachable by URL or only via a state you can set from outside. A positive result is a page that loads with your token from a link a victim can be made to open.
  5. Chain deliberately. Write down each barrier (get script to run, reach a victim, reach a valuable asset) and solve them separately. A positive result is each barrier falling to a distinct, demonstrable step.
  6. Stop at proof, not exploitation. Show enough to demonstrate the path, avoid touching real users' accounts, and say clearly where you stopped.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 14 min read.

What happened, in plain words

Imagine you are paying for advertising on Facebook and you want to pay by bank transfer rather than by card. Facebook gives you a page where you type in your bank details. But Facebook does not collect those details itself. Instead, it puts a small window inside its own page, and inside that window it loads a page belonging to a separate company, a payment provider. That separate company handles the banking part. When it is finished, it has to tell the Facebook page what happened, for example "the bank account was added successfully".

The way one web page talks to another page sitting inside it is a browser feature called postMessage. The inner page sends a message, and the outer page has a piece of code, called a listener, that waits for messages and decides what to do with each one.

A careful listener asks two questions about every message it receives:

  1. Who sent this? Is it really the payment provider, or is it some other website pretending to be one?
  2. Is the content safe to use? Even if the sender is genuine, is the text inside the message harmless, or could it contain something dangerous?

According to the researcher's write-up, the Facebook page answered the first question well: it only accepted messages that came from the payment provider's origin. An origin is the combination of scheme, host and port that identifies a website, for example https://example.com. But the page answered the second question badly. For one particular kind of message, it took the content and pasted it straight into the page without cleaning it first. Cleaning content before using it is called sanitisation.

The result was that Facebook's security on this page depended entirely on the payment provider's security. If an attacker could somehow control what the payment provider's little window said, Facebook would faithfully copy that content into its own page.

This finding belongs to Youssef Sammouda, who published his own write-up on 15 January 2026. This article explains the ideas in it. The researcher deliberately left out the exact payloads, the exact web addresses, the format of the messages and the details of how the accounts were taken over, and some of those are left out here too. The aim is to teach the pattern, not to let anyone repeat the attack.

Photo by Austin Kirk on Unsplash From the original on medium.com

Photo by Austin Kirk on Unsplash

Setup

Before we go further, a few words about the pieces involved.

A token is a short piece of data, usually a long random string, that a server generates and gives to a browser. It acts like a claim ticket: whoever holds the right ticket is allowed to do a particular thing. In this case the vulnerable page required a token that the server generated separately for each user, and that token was tied to the logged-in account. So the token worked like a personalised key: it only opened the door for the account it was made for.

That detail is what made the bug a textbook self-XSS. XSS stands for cross-site scripting, which is when an attacker manages to get their own code (usually JavaScript, the programming language browsers run) to execute inside someone else's web page. "Self-XSS" is the special case where the injected code only ever runs in your own session, meaning your own logged-in browser state. If the only person you can attack is yourself, there is no victim, and most bug bounty programs treat self-XSS as low impact or reject it outright.

A bug bounty program is a scheme where a company pays independent researchers for finding and reporting security problems. The company sets rules about what is in scope and how much each kind of finding is worth.

The report does not describe the accounts, tools or browser versions used in testing. The dates it gives are:

Event Date
Reported 18 October 2024 (acknowledged the same day)
Fixed 19 November 2024
Bounty awarded 20 November 2024, $62,500
Write-up published 15 January 2026

The amount, the dates and the technical outline all come from the researcher's own blog post. No Meta statement or independent coverage confirming the figure was found, so treat it as the researcher's own account of his payout. The write-up as accessed did not describe what Meta changed, only that it was fixed on 19 November 2024.

Finding it

According to the write-up, the payment page's postMessage listener checked the sender's origin but did not sanitise the content of one message type before inserting it into the page. In other words, the page asked "did this come from the right place?" but never asked "is this text safe to put on my page?".

On its own that is a self-XSS, because the per-user token means the injected script only runs in the session of the person who supplied the token. If you hand the page your own token, you can only attack yourself.

The question that matters for every self-XSS is whether the victim can be made to be the one in the attacker's session. That is where the write-up gets interesting, and it is the pivot of the whole chain. A chain, in security language, is a series of small weaknesses joined together, where each one makes the next one possible, and the combined result is far more serious than any single piece.

Exploitation

Step 1: Login CSRF

CSRF stands for cross-site request forgery. It is a trick where an attacker makes your browser send a request to a website you are logged into, without you meaning to. Normally people think of CSRF as a way to steal something, for example to make you transfer money. But there is a mirror-image version called login CSRF: instead of stealing your session, the attacker forces your browser to log in to an account the attacker controls.

Think of it like this. A pickpocket usually wants your wallet. Login CSRF is stranger: someone slips their own wallet into your pocket and then watches what you do with it. Everything you do from then on happens inside the attacker's account, and the attacker can see it.

If a login endpoint can be triggered cross-site, a victim's browser can be signed into an account the attacker controls. Now the self in self-XSS is the victim's browser. The report describes this ingredient at that level and does not publish the request that performs it.

Step 2: Control of the trusted frame

An iframe is a small window embedded inside a web page that loads a different page from a different address. The payment provider's page lived inside such an iframe on the Facebook page.

Having a script run in the victim's browser also required control over what the embedded provider's frame says. The write-up describes an XSS flaw in the third-party provider's own context, which let the attacker control that trusted frame. In plain terms: the payment provider's own website had a scripting bug, and the attacker used it to decide what the provider's little window displayed and sent. The frame then relayed HTML up to Facebook's page, giving script execution on facebook.com. HTML is the language web pages are written in, and "relayed HTML" means the provider's window passed markup up to the Facebook page, which pasted it in without cleaning it.

The message format and the exact trigger are not described.

Step 3: Stitch the two together

The victim's browser, signed into the attacker's account, loads the vulnerable payment page with the attacker's valid token, and the page runs attacker-controlled script on a real Facebook origin. The structure is what matters: a low-impact bug becomes high-impact when a second bug changes who the victim is.

  1. The attacker prepares a link or page that will trigger the login CSRF.
  2. The victim opens it, and their browser is quietly signed in to the attacker's Facebook account.
  3. The victim's browser then loads the payment setup page, still inside the attacker's account, so the page uses the attacker's token, which is valid.

Step 4: What script on facebook.com can do

Script execution on the main origin is powerful because of what the browser lets same-origin code reach. The same-origin policy is a browser rule: code from one origin cannot read data belonging to another origin. It is the wall that stops one website from reading your bank's pages. But code that is already running on facebook.com is on the inside of that wall for other pages on the same origin, so it can read and act on what the logged-in user could there.

The write-up describes two consequences.

Instagram. From a script running on facebook.com, the researcher could start an Instagram OAuth flow and read the authorisation code from a facebook.com callback page, which enables account linking or takeover on the Instagram side. OAuth is a standard way for one service to ask another service for permission to act on your behalf, and it works by passing a short-lived code between the two. If an attacker can read that code, they can finish the handshake themselves and end up holding the victim's access.

Facebook. The researcher says he found two paths to full Facebook account takeover, involving saved-login (device-switching) features and a Google OAuth fallback, and used a Blob URL to keep the malicious page alive without reloads. A Blob URL is a temporary address the browser creates for data held in memory, rather than for a file on a server. He chose not to publish the details of those steps.

He also argued there was a wider risk: a compromise of the third-party provider could affect any Facebook user adding a payment method, because the origin check trusted the provider so completely. He says he stopped further exploitation to avoid causing harm.

Root cause

The mistake is in the listener's second question. An origin check says who sent the message, not that the content is safe. For one message type the content was inserted into the page without sanitisation, so the page trusted the provider's output as if it were its own markup. The origin check did not stop this because the message genuinely came from the trusted origin; the flaw was in what happened to the content afterwards.

A useful comparison: a bouncer at a club checks your ID at the door. That answers "are you allowed in?". It does not answer "are you carrying a weapon?". The origin check is the ID check. Sanitisation is the bag search, and it was missing.

The self-XSS limitation was not a real barrier either, because the per-user token only binds the injection to a session, and a login CSRF can change whose session the victim's browser is in. The report does not describe any other defence that was in place.

Impact

Under the conditions described, an attacker could get script execution on facebook.com in a victim's browser, then use it to take over the victim's Instagram account through the OAuth flow, and, by the researcher's account, reach full Facebook account takeover through two paths he did not publish. The wider risk is that a compromise of the third-party provider could affect any Facebook user adding a payment method. CVSS is a standard scoring system that rates how serious a vulnerability is.

The payout follows the demonstrated impact, not the severity label of the first bug: a self-XSS that many programs reject outright, escalated into script on the main origin of a platform with billions of accounts, with takeover of both Facebook and Instagram accounts and a systemic dependency on a third party's security. Meta acknowledged the report the same day, fixed it in about a month, and awarded the bounty the day after the fix.

Fix

The report says the issue was fixed on 19 November 2024 but does not describe what Meta changed. The following are the defensive measures the write-up recommends, not a description of the actual patch.

  • Sanitise every message field, even from trusted origins. Insert content as text (textContent), never as HTML, unless it has been through a strict sanitiser. textContent is a browser property that treats whatever you give it as plain text, so any markup in it is shown as characters rather than interpreted.
  • Prefer structured, schema-validated messages: accept only known message types with known fields and types, and ignore the rest. A schema is simply a description of what a valid message should look like.
  • Do not trust partners more than your own code. Any third party embedded in your page can be compromised, so assume their output is untrusted input.
  • Use CSP to limit the blast radius. A strict Content Security Policy makes it harder for injected script to run or load further code. CSP is a set of instructions a website sends to the browser listing which sources of script and other content are allowed.
  • Defend login and logout against CSRF. Require unguessable state or tokens, and use SameSite cookie attributes, so a login cannot be forced cross-site. A cookie is a small piece of data a website stores in your browser so it can recognise you on later requests, and SameSite tells the browser when to send that cookie along.
  • Do not let a page that handles sensitive flows reflect externally influenced HTML. Isolate payment and identity flows on narrowly scoped origins.
  • Take self-XSS seriously in triage. Ask whether a session-swapping bug elsewhere could make the victim the self. Triage is the first pass where a team decides how serious and how valid a report is.

Variants to test

  1. Audit every postMessage listener's two questions. For each listener, check who is allowed to send the message and what happens to the content. A positive result is a message type whose content reaches the DOM as HTML, or reaches a sink such as innerHTML, even when the origin check passes. The DOM is the browser's in-memory model of the page, and innerHTML is a property that parses a string as markup, which is exactly how injected HTML becomes live script.
  2. Look for login CSRF next to any self-XSS. Check whether a login endpoint can be triggered cross-site. A positive result is a victim's browser being signed into an attacker-controlled account without an unguessable state value.
  3. Map third-party iframes as part of the attack surface. Payment providers, chat widgets, analytics and consent managers all sit inside the target's trust boundary. A positive result is any way to influence what one of those frames says, for example an XSS in the provider's own context. Attack surface means all the places an attacker could possibly push input into the system.
  4. Check whether the vulnerable page is reachable by URL or only via a state you can set from outside. A positive result is a page that loads with your token from a link a victim can be made to open.
  5. Chain deliberately. Write down each barrier (get script to run, reach a victim, reach a valuable asset) and solve them separately. A positive result is each barrier falling to a distinct, demonstrable step.
  6. Stop at proof, not exploitation. Show enough to demonstrate the path, avoid touching real users' accounts, and say clearly where you stopped.

Glossary

  • ACH: a bank-to-bank payment method used in the United States, here used to pay for advertising.
  • Attack surface: all the points where an attacker could try to send input into a system.
  • Blob URL: a temporary browser address that points to data held in memory rather than to a file on a server.
  • Bug bounty program: a scheme where a company pays researchers for reporting security problems under agreed rules.
  • Chain: several weaknesses joined so that each enables the next, producing a bigger result than any one alone.
  • Cookie: a small piece of data a website stores in your browser so it can recognise you on later requests.
  • Cross-site request forgery (CSRF): making your browser send a request to a site you are logged into, without your intent.
  • Cross-site scripting (XSS): getting attacker-written code to run inside someone else's web page.
  • CSP (Content Security Policy): instructions from a website to the browser listing which sources of script and content are allowed.
  • CVSS: a standard scoring system for rating the severity of a vulnerability.
  • DOM: the browser's in-memory model of the page, which script can read and change.
  • HTML: the markup language web pages are written in.
  • iframe: a small window embedded in a page that loads another page from another address.
  • innerHTML: a browser property that parses a string as HTML markup, so injected markup becomes live content.
  • JavaScript: the programming language browsers run to make pages interactive.
  • Listener: code that waits for incoming messages or events and decides what to do with them.
  • Login CSRF: a CSRF trick that signs the victim's browser into an account the attacker controls.
  • OAuth: a standard way for one service to obtain permission to act on your behalf on another service, using a short-lived code.
  • Origin: the scheme, host and port that identify a website, for example https://example.com.
  • postMessage: a browser feature that lets one page send a message to another page, such as a page inside an iframe.
  • Same-origin policy: the browser rule that code from one origin cannot read data belonging to another origin.
  • SameSite: a cookie attribute that tells the browser when to send the cookie along with requests.
  • Sanitisation: cleaning content so that anything dangerous in it is removed or neutralised before use.
  • Schema: a description of what a valid message or data structure should look like.
  • Self-XSS: an XSS that only runs in your own session, so there is no victim unless something else changes whose session it is.
  • Session: the logged-in state a website keeps for you across requests, usually tied to a cookie or token.
  • Sink: a place in code where data is used in a way that can execute it, such as innerHTML.
  • textContent: a browser property that treats whatever you give it as plain text rather than markup.
  • Token: a piece of data, usually a long random string, that proves the holder is allowed to do something.
  • Triage: the first pass where a security team decides how valid and how serious a report is.

More by T4nv1

View all

113 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.