AAK-MCP-STDIO-LAUNCHER-INJECT-001: MCP stdio server launches a shell-style interpreter with an exec flag or interpolated args
- Severity
- HIGH
- Category
- MCP Configuration (
mcp-config) - Scanner
agent_audit_kit/scanners/mcp_stdio_launcher.py- Auto-fixable
- No.
- SARIF name
McpStdioLauncherInjection
What it detects
An MCP stdio server definition (command + args in a .mcp.json / mcpServers block) launches a shell-style interpreter (npx, node, bash, sh, python) with a code-execution flag (-c, -e, --eval), or passes an arg carrying a template / interpolation token (${...} embedded in a larger string, {{...}}, %s) that is not a pinned static literal. Either shape turns the launched process into an arbitrary-code sink the moment the value is attacker- or model-influenced. This is the CVE-2026-40933 class (Flowise < 3.1.0 unsafely serialised stdio commands in its MCP adapter — an authenticated actor could register an stdio server whose allowlisted launcher, e.g. npx, was combined with -c to run arbitrary OS commands; CWE-78, CVSS 9.9). Distinct from AAK-MCP-002 (which inspects only the command string for sh -c/bash -c wrappers and shell metacharacters, never args) and from the source-code taint rules AAK-MCP-STDIO-CMD-INJ-001..004 (which model StdioServerParameters(command=tainted) in Python/TS/Java/Rust). A standalone env reference (${VAR}) is treated as pinned and does not fire.
How to fix
Do not launch interpreters with -c/-e/--eval from an MCP stdio definition. Pin command to a concrete server executable and pass only static, literal args (e.g. ["--port", "8080"]). If a value must vary, use a standalone env reference (${VAR}) resolved by the host — never interpolate model- or request-derived strings into the argv. Enforce a strict argv allowlist server-side. See AAK-MCP-002 and AAK-FLOWISE-001 for related angles on the same RCE class.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-STDIO-LAUNCHER-INJECT-001
Limitations
Fires when the launcher is npx, node, bash, sh, python or python3 and an argument is exactly -c, -e, -eval or --eval, or when any argument contains {{...}}, %s or a ${...} that is not exactly ${NAME} (a letter or underscore, then letters, digits or underscores), such as x-${KEY} or ${KEY:-x}; a VS Code variable (${workspaceFolder}, ${userHome}, ${env:...}, ${input:...} and the others VS Code documents) does not count, since VS Code substitutes it itself. Combined short flags (bash -lc "...") and other shells (zsh -c) are not matched.
References
- CVE: CVE-2026-40933
- 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)
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-STDIO-LAUNCHER-INJECT-001.md: the page then shows that text, with the registry reference appended under it.