Skip to content

AAK-MCP-APPS-001: MCP Apps UI iframe rendered without a hardening sandbox

Severity
HIGH
Category
Tool Poisoning (tool-poisoning)
Scanner
agent_audit_kit/scanners/mcp_apps_ui.py
Auto-fixable
No.
SARIF name
McpAppsIframeNoSandbox

What it detects

An MCP Apps (SEP-1865) text/html UI resource is rendered in an <iframe> with no sandbox attribute, or with a self-defeating sandbox="allow-scripts allow-same-origin" (which lets the framed document script the host origin). MCP Apps UI is server-controlled, untrusted content running next to the user's agent session; without a restrictive sandbox it executes in the host context (XSS / token theft / tool invocation).

How to fix

Render MCP Apps UI in a sandboxed iframe. Set an explicit sandbox and do NOT combine allow-scripts with allow-same-origin; drive tool calls over postMessage with origin checks rather than granting host-origin access.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-MCP-APPS-001

Limitations

Reads .ts, .tsx, .js, .jsx, .mjs, .cjs, .html, .htm, .vue and .svelte files that carry an MCP Apps marker (ui://, @mcp-ui/, createUIResource and similar). A sandbox value is judged where it is written as a literal: in an <iframe> tag, in setAttribute("sandbox", ...) or in frame.sandbox = .... A value held in a variable, or added with frame.sandbox.add(...), counts as a sandbox whatever it grants, and a sandbox set anywhere in a file counts for every iframe the file creates in script.

References


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-001.md: the page then shows that text, with the registry reference appended under it.