Skip to content

AAK-MCP-STDIO-CMD-INJ-005: MCP STDIO command spawned from network-controlled input (Go)

Severity
CRITICAL
Category
Supply Chain (supply-chain)
Scanner
agent_audit_kit/scanners/mcp_stdio_params.py
Auto-fixable
No.
SARIF name
McpStdioCommandTaintedGo

What it detects

A Go file calls exec.Command(...) or exec.CommandContext(...) in an MCP-shaped file, after a network-controlled source in the same scope: json.NewDecoder(r.Body), an *http.Request handler parameter, or c.ShouldBindJSON(...). CVE-2026-90898 (maximhq/bifrost, CVSS 9.8) is the anchor: Bifrost registers MCP clients through a management API, a stdio client is a command plus args, and the gateway starts that program the moment the client is added, so one unauthenticated POST /api/mcp/client runs a program as the gateway user. Fixed in transports/v2.1.0. NOTE: this rule is regex and proximity, exactly like the Rust arm AAK-MCP-STDIO-CMD-INJ-004, and not Go data-flow analysis. It reports that a spawn sink appears in an MCP file downstream of a network-shaped source, which is not the same claim as proving the request reaches the sink. Expect false positives where a handler decodes a body and separately shells out to a constant. There is no go/ast pass behind this and none is pending.

How to fix

Do not build an exec argv from request-controlled values. Resolve the command against a fixed allowlist server-side, pass caller data as data rather than as argv, and require authentication on any route that registers or starts a subprocess: an unauthenticated registration endpoint that spawns is remote code execution by design, not by bug.

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

agent-audit-kit scan . --rules AAK-MCP-STDIO-CMD-INJ-005

Limitations

Matches an exec.Command or exec.CommandContext call in an MCP-shaped Go file with a request-decoding marker (json.NewDecoder(r.Body), an *http.Request handler, ShouldBindJSON, mux.Vars) in the preceding 2 KB, unless its first argument is a string literal. A literal program with the request in the arguments, such as exec.Command("sh", "-c", req.Command), is therefore not reported. A source file over 512 KB is not read.

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