ai-ml-attacks
This skill should be used when the user asks about "AI security", "ML pipeline attacks", "prompt injection", "model…
Detect postMessage handlers that trust unvalidated origins or write attacker-controlled data to dangerous DOM sinks.
Claude Code
$ npx -y skills add allsmog/vuln-scout --skill postmessage-xss --agent claude-code
Codex
$ npx skills add allsmog/vuln-scout --skill postmessage-xss -a codex -y
Cursor
$ npx skills add allsmog/vuln-scout --skill postmessage-xss -a cursor -y
Gemini CLI
$ npx skills add allsmog/vuln-scout --skill postmessage-xss -a gemini-cli -y
GitHub Copilot
$ npx skills add allsmog/vuln-scout --skill postmessage-xss -a github-copilot -y
OpenCode
$ npx skills add allsmog/vuln-scout --skill postmessage-xss -a opencode -y
Windsurf
$ npx skills add allsmog/vuln-scout --skill postmessage-xss -a windsurf -y
name: postmessage-xss description: >- Detect postMessage handlers that trust unvalidated origins or write attacker-controlled data to dangerous DOM sinks. version: 1.0.0
This skill covers detecting and exploiting Cross-Origin Messaging (postMessage) vulnerabilities that lead to DOM-based XSS.
---
`postMessage` is a browser API that allows cross-origin communication between windows/iframes. When message handlers don't validate `event.origin`, any website can send malicious data that may execute as XSS.
**Why This Is Critical:**
---
A handler that accepts messages from ANY origin and writes to DOM:
window.addEventListener("message", (event) => {
const data = event.data;
document.getElementById("output")[".inner" + "HTML"] = data.html; // XSS!
});window.addEventListener("message", (event) => {
if (event.origin !== "https://trusted-domain.com") {
return; // Reject untrusted origins
}
document.getElementById("output").textContent = data.text; // Safe
});---
# Find all postMessage event listeners grep -rniE "addEventListener\s*\(\s*['\"]message['\"]" --include="*.js" --include="*.ts" --include="*.html" # Find direct onmessage assignments grep -rniE "\.onmessage\s*=" --include="*.js" --include="*.ts"
# Find handlers and check next 10 lines for origin check grep -rniE "addEventListener\s*\(\s*['\"]message['\"]" --include="*.js" --include="*.ts" -A 10 | grep -v "origin"
# event.data to DOM write sinks grep -rniE "event\.data.*(inner|outer)HTML" --include="*.js" --include="*.ts" # event.data to location (open redirect) grep -rniE "event\.data.*location|location.*event\.data" --include="*.js" --include="*.ts" # event.data assigned to variable (trace further) grep -rniE "=\s*event\.data" --include="*.js" --include="*.ts"
---
| Pattern | Risk | Detection | |---------|------|-----------| | No origin check + DOM sink | Critical | Missing `event.origin` validation | | Weak origin check (regex) | High | `origin.includes()` or `origin.match()` | | Variable assignment then sink | High | `const data = event.data` then later to sink | | jQuery `.html()` method | Critical | `$(elem).html(event.data)` |
---
When combined with SSRF (bot visits attacker URL):
1. Bot visits attacker page 2. Attacker page creates iframe to `http://localhost:1337/` 3. postMessage sends XSS payload to iframe 4. XSS executes in localhost context (bypasses network restrictions)
This chain bypasses Chrome's Private Network Access restrictions.
---
const ALLOWED_ORIGINS = ["https://trusted.com"];
window.addEventListener("message", (event) => {
if (!ALLOWED_ORIGINS.includes(event.origin)) {
return; // Reject
}
// Process message safely...
});X-Frame-Options: SAMEORIGIN Content-Security-Policy: frame-ancestors 'self'
---
AI-powered whitebox penetration testing plugin for Claude Code. 9 languages, 22 skills, 7 autonomous agents. STRIDE threat modeling, OWASP 2025 coverage, polyglot monorepo support.
This skill should be used when the user asks about "AI security", "ML pipeline attacks", "prompt injection", "model…
This skill should be used when the user asks about "business logic", "workflow vulnerability", "trust boundary", "state machine",…
This skill should be used when the user asks about "cache poisoning", "web cache deception", "CDN cache", "proxy cache", "nginx…
This skill should be used when the user asks about "cloud security", "AWS security", "GCP security", "Azure security",…
This skill should be used when the user asks about "compliance mapping", "PCI-DSS", "HIPAA", "SOC 2", "NIST CSF", "regulatory…
This skill should be used when the user asks about "Code Property Graph", "CPG analysis", "Joern queries", "CPGQL", "data flow…
Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication,…
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys)…
Clean and finalize authorized natural-language text intended for readers by auditing suspicious invisible Unicode and rewriting…