Skip to content

AAK-ANTHROPIC-SDK-001: MCP server built on the upstream SDK without STDIO sanitizer

Severity
HIGH
Category
Supply Chain (supply-chain)
Scanner
agent_audit_kit/scanners/mcp_sdk_hardening.py
Auto-fixable
No.
SARIF name
AnthropicSdkStdioSanitizer

What it detects

Repository declares a dependency on the upstream Anthropic / ModelContextProtocol SDK (Python mcp / modelcontextprotocol, TS @modelcontextprotocol/sdk, Java io.modelcontextprotocol:*, Rust mcp / modelcontextprotocol) and exposes a STDIO transport (StdioServerTransport, stdio_server, etc.) without a sanitizer on argv assembly. Anthropic declined to CVE this as working as designed — sanitization is the developer's responsibility. The OX Security disclosure on 2026-04-15 rolled up LiteLLM, LangChain and IBM LangFlow as downstream casualties of exactly this pattern. See also AAK-STDIO-001 for the sink-level detector.

How to fix

Wrap every argv the STDIO transport builds in an allow-list sanitizer — shlex.quote in Python, execFile with an explicit argv array in Node, equivalent in Java/Rust. OR switch the transport off STDIO (transports=['http'] / ['sse']). If you have deliberately accepted the risk, add accepts_stdio_risk: true plus a justification: field in .agent-audit-kit.yml.

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

agent-audit-kit scan . --rules AAK-ANTHROPIC-SDK-001

Limitations

Judges each file that builds a STDIO transport (new StdioServerTransport(, a StdioServerTransport(...) call, stdio_server(, stdio_client( or Rust's StdioTransport::new(); a file that only imports, re-exports, types or mocks one is not read, nor is one whose builder name runs more than 48 characters past Stdio, or more than 16 past Transport in a StdioServerTransport(...) call. Recognises a sanitizer or opt-out by name in that file: a shlex.quote( or shlex.split( call, an ALLOWED_*, WHITELIST_* or VALID_TOOLS constant, or an HTTP-only transport setting. Such a name clears its own file, whatever it guards: an ALLOWED_ORIGINS list in src/server.ts silences an unguarded StdioServerTransport in the same file. A guard kept in another module counts when the file imports it by one of those names (import { ALLOWED_COMMANDS } from './allow'); one imported under another name (import { safeArgv } from './guard') is not seen, so the file is still reported. A source file over 512 KB, a config file over 1 MB or a manifest over 2 MB 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-ANTHROPIC-SDK-001.md: the page then shows that text, with the registry reference appended under it.