AAK-MCP-STDIO-CMD-INJ-004
MCP STDIO Command::new(...) from network-controlled input (Rust)
| Field | Value |
|---|---|
| Severity | CRITICAL |
| Category | SUPPLY_CHAIN |
| Shipped | v0.3.6 |
| Scanner | agent_audit_kit/scanners/mcp_stdio_params.py (regex pass) |
| Same metadata as | AAK-MCP-STDIO-CMD-INJ-001 |
Caveat
Regex-only pass; there is no tree-sitter-rust grammar and none is pending. Expect ~10% false-positive rate on macro-heavy codebases. Document false positives on the issue tracker so the AST migration test corpus grows.
What it catches
tokio::process::Command::new(...) or std::process::Command::new(...)
(or bare Command::new(...) when the file use-imports them) inside
a module that imports mcp_sdk / modelcontextprotocol /
mcp::client::stdio after a network-controlled source: reqwest::get,
reqwest::Client, serde_json::from_str, serde_json::from_slice,
std::env::var, hyper::body, actix_web::web::Json,
axum::extract::Json.
Detection
Three steps:
- File must import an MCP SDK (
mcp_sdk/modelcontextprotocol/mcp::client::stdio). - File must have at least one
Command::new(...)(qualified or bare with a matchingusedeclaration). - Look back 2KB from the
Command::new(...)for a taint marker.
Remediation
use tokio::process::Command;
pub fn spawn_pinned() -> Command {
Command::new("/usr/bin/server-a")
}
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
McpStdioCommandTaintedRust
What it detects
A Rust file invokes tokio::process::Command::new(...) or std::process::Command::new(...) in a module that imports mcp_sdk / modelcontextprotocol after a network-controlled source (reqwest, serde_json::from_str, std::env::var, hyper::body, actix_web::web::Json, axum::extract::Json). Same OX MCP April-2026 class. NOTE: this rule is regex-only, so expect ~10% false-positive rate on macro-heavy code. It is a proximity match, not Rust data-flow analysis. Issue #22 was closed on 2026-08-15 having shipped only a TypeScript slice, so there is no open work item behind this and no reason to wait for one.
How to fix
Pin the Command::new(...) argument to a constant binary path and validate any subsequent .arg(...) values. Or move the process-spawn out of the request path entirely.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-STDIO-CMD-INJ-004
Limitations
Treats a Rust file as MCP code only if it mentions mcp_sdk, modelcontextprotocol or mcp::client::stdio, so a file that uses the rmcp crate and none of those names is not scanned. It also needs one of reqwest::get, reqwest::Client, serde_json::from_str, serde_json::from_slice, std::env::var, hyper::body, actix_web::web::Json or axum::extract::Json in the 2 KB before Command::new; a command taken from std::env::args() is not one of them. 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