CAPIG XSS (Meta Conversions API Gateway) postMessage origin ...#1762
Merged
carlospolop merged 3 commits intomasterfrom Jan 28, 2026
Conversation
Collaborator
Author
🔗 Additional ContextOriginal Blog Post: https://ysamm.com/uncategorized/2025/01/13/capig-xss.html Content Categories: Based on the analysis, this content was categorized under "Pentesting Web -> PostMessage Vulnerabilities (origin validation -> script loading) and/or Pentesting Web -> XSS (Supply-chain/shared script stored XSS via backend-generated JS); also relevant as a case study for CSP Bypass patterns (CSP allowlist abuse via compromised allowed third-party origin)". Repository Maintenance:
Review Notes:
Bot Version: HackTricks News Bot v1.0 |
Collaborator
Author
|
merge |
…eway___postMess_20260115_012759
…eway___postMess_20260115_012759
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Automated Content Update
This PR was automatically generated by the HackTricks News Bot based on a technical blog post.
📝 Source Information
🎯 Content Summary
Scope / what was analyzed
The post analyzes two vulnerabilities affecting Meta’s Conversions API Gateway (CAPIG), focusing on Meta’s hosted gateway instance gw.conversionsapigateway.com and its shared JavaScript asset:
https://gw.conversionsapigateway.com/sdk/<pixel_id>/capig-events.js
This script is auto-loaded by Meta’s fbq client module (not manually embedded) and therefore executes on multiple high-privilege origins, including:
🔧 Technical Details
Trick 1 — postMessage origin-to-script-src pivot: If a page listens for postMessage (e.g., msg_type == IWL_BOOTSTRAP) and stores event.origin without validating it, then later uses that stored origin to build a script URL (e.g., /sdk/<pixel_id>/iwl.js), an attacker can turn message-origin control into JavaScript execution. Exploitability depends on reaching the message handler and on the embedding page’s CSP allowing scripts from the attacker-controlled origin.
Trick 2 — bypassing opener-gated logic under COOP using WebView window.name reuse: When exploitation requires window.opener but the target uses Cross-Origin-Opener-Policy: same-origin-allow-popups, the post describes regaining an opener condition in Android WebView by reusing window.name with window.open(target, name). In that scenario, the window may become its own opener, so the required cross-window message may need to be sent from an attacker-controlled iframe inside the page.
Trick 3 — CSP-assisted script loading ...
🤖 Agent Actions
Updated
postmessage-vulnerabilities/README.mdwith a new CAPIG case study detailing how unvalidatedpostMessageorigins were pivoted into script loads, CSP allowlist abuse, WebView opener bypass, iframe-delivered payloads, and the backend string-concatenation bug that turned shared analytics JS into a supply-chain stored XSS. Added actionable defenses and referenced the source blog.This PR was automatically created by the HackTricks Feed Bot. Please review the changes carefully before merging.