Skip to content
XSS Write-up Advanced

The Conversions API Gateway gw.conversionsapigateway.com and capig-events.js script

The report describes two vulnerabilities: a postMessage origin trust issue in capig-events.js that could lead to script loading from an attacker-controlled origin, and a stored XSS in the gateway backend where user-supplied input is concatenated into JavaScript without escaping. An attacker could achieve JavaScript execution on Meta domains and potentially account takeover.

ysamm.com

Published on ysamm.com

The Meta Conversions API Gateway is a server-side solution developed by Meta (formerly Facebook) that allows businesses to send web events, such as customer interactions and purchase data, directly from their servers to Meta’s platforms, bypassing traditional browser-based tracking methods like the Facebook Pixel.

The author, on ysamm.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

The first bug is caused by not validating the origin of postMessage events before using it to load scripts; the second bug is caused by concatenating user-controlled input into JavaScript strings without escaping.

Impact

The stored XSS could execute on Meta-owned domains and third-party sites, potentially leading to account takeover, and the postMessage bug could also lead to account takeover via CORS misconfiguration.

What the attacker needed

Victim logged into Facebook; victim uses Facebook app WebView; attacker controls a website; attacker controls a CSP-allowed third-party domain

The fix

The vulnerabilities were fixed by Facebook.

How it was found

  1. User opens a URL inside the Facebook app WebView.
  2. The script on the attacker's website executes the opener bypass and redirects to https://www.meta.com/help/.
  3. On the help page, the script inside the hijacked iframe redirects to a third-party page allowed by Meta's CSP, which sends the IWL_BOOTSTRAP postMessage to the parent window.
  4. The attacker-controlled third-party page hosts a JavaScript file named iwl.js under /sdk/{pixel_id}/iwl.js containing the XSS payload.
  5. The script is loaded from the attacker-controlled third-party website and executed in the context of www.meta.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.

This report is about two bugs in a Facebook tool that helps websites send data to Facebook. The first bug lets a malicious website trick Facebook's script into loading code from the attacker's site, and the second bug lets an attacker inject their own code into a script that Facebook serves to many websites. Both could let an attacker run their own code on Facebook's pages, which might let them take over accounts.

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.