AAK-MCP-STDIO-CMD-INJ-002
MCP StdioClientTransport built from network-controlled input (TypeScript)
| Field | Value |
|---|---|
| Severity | CRITICAL |
| Category | SUPPLY_CHAIN |
| Shipped | v0.3.6 |
| Scanner | agent_audit_kit/scanners/mcp_stdio_params.py |
| CWE | CWE-78 + CWE-77 |
| Same metadata as | AAK-MCP-STDIO-CMD-INJ-001 |
What it catches
new StdioClientTransport({ command, args }) from
@modelcontextprotocol/sdk/client/stdio constructed shortly after a
network-controlled source: req.body, await fetch(...).then(...),
process.env.<NETWORK_VAR>, JSON.parse(...).
Detection
Regex-based: find every new StdioClientTransport( /
new StdioServerTransport(, look back 1KB for a taint marker
(req.(body|query|params|headers), await fetch(, await axios.,
process.env.[A-Z_]+, JSON.parse().
Remediation
const ALLOWED: Record<string, string> = {
"server-a": "/usr/bin/server-a",
"server-b": "/usr/bin/server-b",
};
export function spawnFromName(name: string) {
const cmd = ALLOWED[name];
if (!cmd) throw new Error("not allowed");
return new StdioClientTransport({ command: cmd, args: [] });
}
Registry reference
This section is generated from the rule registry (agent_audit_kit/rules/builtin.py) when the documentation is built, so it follows the scanner. The rest of the page is hand-written; where the two disagree, the registry is what runs.
- Severity
- CRITICAL
- Category
- Supply Chain (
supply-chain) - Scanner
agent_audit_kit/scanners/mcp_stdio_params.py- Auto-fixable
- No.
- SARIF name
McpStdioClientTransportTainted
What it detects
A TypeScript / JavaScript file constructs new StdioClientTransport({ command, args }) from @modelcontextprotocol/sdk/client/stdio shortly after a network-controlled source (req.body, await fetch(...).then(...), process.env.<NETWORK_VAR>, JSON.parse(...)). Same OX MCP April-2026 class as AAK-MCP-STDIO-CMD-INJ-001.
How to fix
Pin command to a constant binary path; validate args against an allow-list before passing them into the transport. Never feed fetched JSON or req.body directly into the transport options.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-STDIO-CMD-INJ-002
Limitations
Reads one file at a time. A new StdioClientTransport(...) or new StdioServerTransport(...) counts as tainted when its command or args derive, through assignments, destructuring, template strings or one helper return, from req.body, req.query, req.params, req.headers (or the request, ctx and context forms), process.env, JSON.parse or an awaited fetch or axios call in that file. A config object passed in from another file (connect(req.body) in routes.ts, connect(cfg) in client.ts) is not followed, with or without the optional tree-sitter extra. Without that extra (agent-audit-kit[taint]) the rule falls back to proximity, and the evidence ends [proximity heuristic ...]: a transport counts as tainted when one of those sources is written in its own command or args within the first 1,024 characters of the call, comments aside, or when a req, request, upper-case process.env, JSON.parse or awaited fetch or axios source appears anywhere in the 1024 characters before it, comments included, whether or not it flows in. A source further back, such as a helper at the top of a long file, is missed. The fallback reads a / right after a block's closing brace as a division (if (a) {} /'/.test(s)), as it reads one after an object's, so a quote in such a regex can hide the command and args after it. A source file over 512 KB is not read.
References
- CVE: CVE-2026-30615, CVE-2026-30617, CVE-2026-30623, CVE-2026-22252, CVE-2026-22688, CVE-2026-33224, CVE-2026-40933, CVE-2026-6980
- 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-04 (Tool Param Shell Injection)
- Incidents and advisories: OX-MCP-2026-04-25
- CSA AI Controls Matrix (AICM): AIS-08, IAM-05