{"slug": "the-mcp-stdio-disclosure-won-t-get-patched-i-built-a-local-guard-for-the-layer", "title": "The MCP STDIO Disclosure Won't Get Patched. I Built a Local Guard for the Layer It Named.", "summary": "A developer built AgentGuard, a local stdio proxy that sits between an AI agent and any MCP server to enforce allow/deny/ask rules on tool calls, after OX Security disclosed a command injection flaw in the STDIO transport of Anthropic's official MCP SDKs across Python, TypeScript, Java and Rust. OX Security scoped the flaw at more than 150 million package downloads, roughly 7,000 publicly reachable MCP servers and up to 200,000 vulnerable instances, linking it to at least ten downstream CVEs. Anthropic reviewed the behavior and classified it as expected, declining to change the protocol architecture, so no upstream patch is coming. The proxy is fail-closed: undefined tools are denied by default, and an 'ask' decision without an approval channel is treated as a refusal.", "body_md": "On April 15, 2026, OX Security published a disclosure that should have ended with a patch. It didn't.\n\nTheir research team documented a systemic command injection flaw in the STDIO transport of Anthropic's official Model Context Protocol SDKs — Python, TypeScript, Java, and Rust, all four. The mechanism is almost embarrassingly simple: when a client spawns a local MCP server, it takes the command string from your MCP configuration and hands it to the operating system. No sanitization. No allowlist. The command executes even when the target process fails to start, which means a malicious or poisoned server definition doesn't even need to be a working MCP server to do damage.\n\nOX Security scoped the blast radius at more than 150 million package downloads across the affected SDKs, roughly 7,000 publicly reachable MCP servers, and up to 200,000 vulnerable instances. They linked the same root cause to at least ten CVEs in downstream projects — LiteLLM, LangChain, LangFlow, and Flowise among them.\n\nThen came the part that makes this a permanent condition rather than a news cycle: Anthropic reviewed the behavior and classified it as expected. They declined to change the protocol's architecture. There is no upstream patch coming. The Cloud Security Alliance published its own research note in late April confirming the architectural analysis; the disclosure was covered by VentureBeat, The Register, The Hacker News, and SecurityWeek.\n\nI'm not going to re-litigate whether that's the right call. What matters for the rest of us is the conclusion: the trust boundary between your AI agent and your local MCP servers is yours to draw. Nobody upstream is going to draw it for you.\n\nThe gap nobody is filling\n\nHere's what the current market offers if you want to control what your agent can actually do through MCP:\n\nBifrost (Maxim AI): OAuth 2.1 caller authentication, per-virtual-key tool allowlists. Enterprise production-grade.\n\nIBM ContextForge: an MCP registry and federated gateway. Enterprise.\n\nDocker MCP Gateway: container isolation plus a catalog. Team-level.\n\nKong, Cloudflare, AWS AgentCore: ingress plugins and managed services. Platform-level.\n\nSpeakeasy, Runlayer, and friends: commercial SaaS, enterprise sales motion.\n\nNotice the pattern. Every one of these assumes a shared gateway URL — something a team deploys, manages, and routes every agent through. That's the right shape for an organization. It is the wrong shape for the individual developer whose coding agent can currently read .env, touch /etc/hosts, or rm -rf whatever the filesystem server can reach.\n\nEnterprise teams already have a gateway. Individual developers are running naked. That gap — single process, local machine, one line of config, zero services, zero accounts — is where I've been working.\n\nSee it work in 30 seconds\n\nAgentGuard is a local stdio proxy that sits between your agent and any real MCP server. Before you wire it into anything, there's a self-contained demo — no AI client, no configuration, no audit files written:\n\nbash\n\nnpx -y @leeruu/agentguard demo\n\nIt runs a fake filesystem server through a real proxy and shows you the decisions:\n\ncode\n\n  判定   调用               命中规则                上游\n\n  allow  读 ./src/index.ts  base-allow-read         已执行\n\n  deny   读 ./.env          secrets-read-env        未执行\n\n  deny   写 /etc/hosts      core-write-system-path  未执行\n\n  deny   rm -rf /           core-rm-rf-root         未执行\n\n  allow  rm -rf ./build     base-allow-command      已执行\n\n  ask*   git push --force   core-force-push         未执行\n\n  deny   未定义的工具       (fail-closed)           未执行\n\n合计：allow 2 / deny 4 / ask* 1\n\nThat last row is the part I care most about: an undefined tool gets denied by default. The engine is fail-closed — anything not explicitly allowed is blocked, and ask without an approval channel is treated as a refusal, never a silent pass.\n\nagentguard demo\n\nHow it works\n\nOne line in your existing MCP config. Wrap the real server:\n\njson\n\n{\n\n  \"mcpServers\": {\n\n    \"filesystem\": {\n\n      \"command\": \"npx\",\n\n      \"args\": [\n\n        \"-y\", \"@leeruu/agentguard\",\n\n        \"--policy\", \"C:/Users/me/.agentguard/policy.yaml\",\n\n        \"--\",\n\n        \"npx\", \"-y\", \"@modelcontextprotocol/server-filesystem\", \"/projects\"\n\n      ]\n\n    }\n\n  }\n\n}\n\nEverything before -- is AgentGuard; everything after is your real server. The agent cannot tell the difference. Three design decisions worth knowing about:\n\nIt forwards raw bytes, not JSON. The proxy does not parse-and-reserialize protocol traffic. Verified byte-for-byte against direct connections, including server-to-client messages like sampling/createMessage. The only intercepted message type is tools/call — everything else passes through untouched, and lines without tools/call don't even get parsed.\n\nPolicy is code, and bad policy fails loudly. Rules are YAML: five operators (glob, regex, equals, in, prefix), matching on the tool name or any dotted path in its arguments. Decision priority is deny > ask > allow. A syntactically broken policy file makes the proxy exit with code 2 and the upstream server never starts — a typo in your rules should never silently become an allow. Deny rules support except whitelists, so \"block .env but allow .env.example\" is expressible instead of a footgun. And every audit record carries a policyHash, so after you change your rules, old log entries and new ones are distinguishable at a glance.\n\nCross-client tool names are aliases, not bugs. read_file, view_file, and ReadFile are the same operation wearing different clients' uniforms. AgentGuard expands them by semantic group, so a rule written for one client works on another. agentguard explain --tool bash --command \"cat .env\" shows you the exact verdict for a single call without executing anything.\n\nFour policy packs ship built in — core (destructive commands, system paths, force-push), secrets (.env reads, private keys, cloud metadata endpoints, credential exfiltration to issues/PRs, and reading credentials through bash), git (history rewrites, worktree nukes), and net (internal addresses, payment endpoints, per-window call limits). Thirty rules, and init walks you through generating a policy with baseline allowances for normal dev work — because a pure fail-closed default that blocks your agent's first read is a great way to make people turn the thing off.\n\nThe numbers, measured\n\nI don't ship marketing numbers. Everything below is from the repo's test suite (15 suites, 336 assertions, all green):\n\n18 attack cases from the design threat model, all blocked; 20 routine dev operations, zero false positives\n\nDecision latency: P99 0.02 ms with 4 rules, 0.9 ms with 1,000 rules on a miss\n\nEnd-to-end round-trip through the proxy: p99 1.19 ms over 1,000 consecutive calls\n\nCold start: init 193 ms + check 161 ms + first successful call through a real filesystem server 2.9 s — 3.3 s total\n\nOne runtime dependency (yaml); Node ≥ 20; Apache-2.0; a 20-file npm package with no source maps\n\nnpm run check:attacks reruns the full attack suite against artifacts generated on your machine, not fixtures from mine.\n\nWhat it does not do\n\nSecurity tools earn trust by stating their limits plainly, so here are mine:\n\nIt does not inspect responses. The proxy looks at requests only. If a tool's return value contains a leaked secret, AgentGuard will not catch it — the response direction has no policy engine. This is a stated gap, not a hidden one.\n\nIt does not protect the spawn phase. The April disclosure is about what happens when the configuration command string executes. AgentGuard runs after that decision — it guards what the launched server's tools can do. If someone poisons your config file itself, your first line of defense is reviewing what you install, not a proxy.\n\nask has no interactive approval channel. By design — the proxy's stdin is protocol traffic, and reading y/n from it would corrupt the stream. ask resolves to refusal. If you want observe-first behavior, init --observe generates a policy that logs verdicts without blocking.\n\nRegex policies warn, not harden. A catastrophic-backtracking pattern like (a+)+ in your rules gets flagged at load time, but there's no execution timeout yet. It's in the known-limitations table, not hidden in a changelog.\n\nWhy now\n\nThe April disclosure made one thing explicit: at the protocol level, there is no trust boundary between an agent and the servers it talks to. Enterprises are buying gateways. Everyone else — the developer whose coding agent has filesystem access and a bash tool on their actual work machine — is on their own.\n\nAgentGuard is that boundary, sized for one person. Try the demo; it costs you one command and installs nothing:\n\nbash\n\nnpx -y @leeruu/agentguard demo\n\nGitHub: [https://github.com/MmUu001/agentguard](https://github.com/MmUu001/agentguard)\n\nnpm: @leeruu/agentguard (v0.2.0)\n\nLicense: Apache-2.0\n\nIf you run it and something you expected to be blocked wasn't — that's exactly the feedback I want. Open an issue.", "url": "https://wpnews.pro/news/the-mcp-stdio-disclosure-won-t-get-patched-i-built-a-local-guard-for-the-layer", "canonical_source": "https://dev.to/mmuu001/the-mcp-stdio-disclosure-wont-get-patched-i-built-a-local-guard-for-the-layer-it-named-52b6", "published_at": "2026-11-24 07:06:11+00:00", "updated_at": "2026-11-24 07:13:15.770994+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-safety", "ai-tools", "developer-tools"], "entities": ["Anthropic", "OX Security", "AgentGuard", "Model Context Protocol", "Cloud Security Alliance", "LiteLLM", "LangChain", "Flowise"], "also_reported_by": [], "takeaway": "Wrapping an MCP server in a fail-closed local stdio proxy that denies undefined tools and treats unapproved 'ask' decisions as refusals blocks command injection from poisoned server definitions, since Anthropic will not patch the STDIO transport.", "recommendation": {"advice": "Wrap local MCP servers in a fail-closed proxy that allowlists tools and treats 'ask' without an approval channel as a denial, since the STDIO command injection has no upstream patch.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/the-mcp-stdio-disclosure-won-t-get-patched-i-built-a-local-guard-for-the-layer", "markdown": "https://wpnews.pro/news/the-mcp-stdio-disclosure-won-t-get-patched-i-built-a-local-guard-for-the-layer.md", "text": "https://wpnews.pro/news/the-mcp-stdio-disclosure-won-t-get-patched-i-built-a-local-guard-for-the-layer.txt", "jsonld": "https://wpnews.pro/news/the-mcp-stdio-disclosure-won-t-get-patched-i-built-a-local-guard-for-the-layer.jsonld"}}