AAK-MCP-APPS-002: MCP Apps UI content rendered without sanitization (DOM XSS)
- Severity
- HIGH
- Category
- Tool Poisoning (
tool-poisoning) - Scanner
agent_audit_kit/scanners/mcp_apps_ui.py- Auto-fixable
- No.
- SARIF name
McpAppsUnsanitizedHtml
What it detects
An MCP Apps (SEP-1865) UI writes content to the DOM through a raw-HTML sink (innerHTML / outerHTML / insertAdjacentHTML / React dangerouslySetInnerHTML / Vue v-html / Svelte {@html}) with no sanitizer (DOMPurify / sanitize* / escaping) in the file. Server- or tool-provided content reaching an unsanitized HTML sink is DOM XSS — the injected script runs in the app frame with access to its postMessage tool bridge.
How to fix
Sanitize all server/tool-provided content before rendering (e.g. DOMPurify), or render as text. Never pass untrusted content to innerHTML / dangerouslySetInnerHTML / v-html without sanitization.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-APPS-002
Limitations
Looks for innerHTML =, outerHTML =, insertAdjacentHTML(, dangerouslySetInnerHTML, v-html and {@html; jQuery's .html(content), document.write and iframe.srcdoc = are not sinks here. Any mention of sanitize, DOMPurify, escapeHtml, xss or purify clears the whole file, an import that is never called included.
References
- OWASP MCP Top 10: MCP05:2025 (Command Injection & Execution)
- OWASP Agentic Top 10: ASI05 (Unexpected Code Execution (RCE))
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-INJECT-01 (Shell Injection via MCP)
- CSA AI Controls Matrix (AICM): AIS-07, AIS-08
All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCP-APPS-002.md: the page then shows that text, with the registry reference appended under it.