MCP tool poisoning can enable arbitrary code execution via unsigned tool definitions
AutoGen's MCP integration in autogen-ext/tools/mcp/ fetches tool definitions via session.list_tools() and trusts them without signature verification or schema pinning. The description field flows directly to the LLM agent.
A compromised or malicious MCP server can:
- Embed injected instructions in tool descriptions that the LLM follows
- Change tool schemas between sessions (no pinning = rug pull)
- Modify parameters in transit on SSE/HTTP transports (unsigned JSON-RPC)
With code execution tools available (common in AutoGen workflows), this creates a path from tool poisoning to arbitrary code execution — including ransomware delivery, data exfiltration, and lateral movement.
The only current mitigation is a docstring warning: "Only connect to trusted MCP servers." This is insufficient given:
- 72.8% tool poisoning success rate across 20 LLM agents (MCPTox, arXiv:2508.14925)
- CVE-2025-6514 (CVSS 9.6) — mcp-remote RCE affecting 437K+ downloads
- postmark-mcp — first malicious MCP server in the wild, 1,643 downloads (Snyk)
- IBM X-Force 2026 flags AI-driven attacks as escalating
Relates to the guardrails epic #6017 and #7266 (fail-closed defaults for untrusted MCP servers).
OWASP MCP Top 10: owasp.org/www-project-mcp-top-10 IETF Internet-Draft for MCP message signing: draft-sharif-mcps-secure-mcp
This is exactly the right class of issue to track. The root cause is that autogen-ext/tools/mcp/ trusts tool definitions at connection time and passes description through to the LLM without integrity verification. The docstring warning is advisory to operators, not enforced at runtime.
The fundamental architecture problem: AutoGen currently fuses two things that should be separate:
- The LLM reasoning over tool descriptions (probabilistic)
- The execution kernel that actually dispatches tool calls (should be deterministic)
When tool definitions are unsigned, the LLM's reasoning layer can be poisoned before a single tool call is made. The execution layer never gets a chance to validate anything because there's no execution layer — it's just direct dispatch.
What the mitigation architecture should look like:
-
Schema pinning at session initialization: Hash and pin tool definitions at trusted-server-connect time. Any drift between the pinned schema and the schema presented at call time should hard-fail.
-
Execution boundary before dispatch: Every tool call goes through a validation layer that checks: (a) was this tool schema verified at session init? (b) are the parameters within the declared schema? (c) does this call match an active policy allow-list? If any check fails, halt — fail-closed, not fail-open.
-
Signed receipts per call: Each dispatched tool call produces a tamper-evident receipt (call params, tool hash, outcome, timestamp, agent identity). This provides the proof graph needed for incident forensics and replay detection.
This is the architecture HELM OSS is built around: https://github.com/Mindburn-Labs/helm-oss
The execution kernel sits between the model's proposed tool calls and the actual tool dispatcher. It's where schema validation, policy enforcement, and receipt emission happen. The model proposes; the kernel decides.
For AutoGen specifically, the fix surfaces at autogen-ext/tools/mcp/ — the McpWorkbench tool invocation path needs a validation hook before calling session.call_tool(). Happy to contribute a concrete implementation sketch if that would help move #7266 forward.
The discussion above covers runtime enforcement well (schema pinning, execution boundaries, signed receipts). I want to add the pre-deployment detection angle — catching poisoned tool descriptions before they reach the LLM at all.
The core issue in autogen-ext/tools/mcp/ is that description flows directly to the LLM. But many tool poisoning payloads follow detectable patterns: hidden behavioral overrides, instruction injection via markdown/HTML comments, data exfiltration channels embedded in descriptions, role manipulation directives.
What we've observed scanning 15+ popular MCP servers:
- Tool descriptions containing phrases like "You must always include full paths" — benign here, but the same mechanism enables instruction injection
- Hidden directives in annotation fields that standard code analysis tools ignore entirely
- The Queen's University study (1,899 servers, arXiv:2504.03767) found 5.5% of MCP servers susceptible to tool poisoning and confirmed that SonarQube/mcp-scan miss these patterns
The detection approach complements runtime enforcement:
| Layer | Catches | When |
|---|---|---|
| Static detection (regex/pattern) | Known poisoning patterns in descriptions, annotations, schemas | Before deployment / at registration |
| Runtime enforcement (schema pinning) | Schema drift, parameter manipulation | At each tool call |
| Execution boundary | Unauthorized tool dispatch | At execution time |
For AutoGen specifically: a validation hook at McpWorkbench tool registration time (before session.list_tools() results are passed to the LLM) could run pattern checks against known tool poisoning signatures. This is deterministic, sub-10ms, and catches the 72.8% of poisoning attacks that follow structural patterns.
We maintain ClawGuard — 187 detection patterns across 15 languages specifically for this. MIT licensed. The OWASP MCP Top 10 mapping shows which patterns map to which attack categories.
This isn't a replacement for runtime enforcement — it's the first layer. Catch known attacks at registration time, enforce schema integrity at runtime, validate at execution. Defense in depth.
The defense-in-depth table from @joergmichno is the right framing. Detection at registration time + schema pinning at runtime + execution boundary at dispatch — each layer catches what the others miss.
To make the execution boundary concrete for AutoGen: the hook needs to sit in McpWorkbench before the session.call_tool() call, not at the transport level. Something like:
async def _validated_call_tool(self, tool_name: str, args: dict) -> Any:
# 1. verify tool hash matches pinned schema from session init
# 2. check args against declared input_schema
# 3. evaluate against policy allow-list (fail-closed)
# 4. emit signed receipt with tool hash, args hash, timestamp, agent_id
return await self._session.call_tool(tool_name, args)
Happy to put together a PR draft for autogen-ext/tools/mcp/ with this hook if that would help move #7266 forward. The schema pinning + receipt emission is the part HELM already has wired — just needs the AutoGen-side adapter.
Thanks — the hook at McpWorkbench registration time is exactly the right integration point. Schema pinning + fail-closed policy before session.call_tool() would have caught every advisory we've filed so far (30 across MCP servers with 277k+ combined stars).
Happy to help with the pattern matching side if you open that PR. Our scanner runs <10ms per input so it fits well as a pre-dispatch check.
Opening the PR now. Will target autogen-ext/tools/mcp/ with the _validated_call_tool hook. The schema pinning and receipt emission are already implemented in HELM — the adapter is a thin wrapper.
@joergmichno if you want to wire the pattern matching check as the first gate (before schema validation), that composites cleanly. I'll structure the PR so the pre-dispatch pipeline is pluggable.
Looking forward to the PR. The _validated_call_tool hook at McpWorkbench registration time is exactly the right integration point — we've validated this pattern across 30 advisories covering tools with 277k+ combined GitHub stars.
On the pattern matching side: our scanner (ClawGuard) maintains 245 regex-compiled patterns covering the full OWASP LLM Top 10 + Agentic Security taxonomy. These could serve as the default validation ruleset for the hook — they catch instruction injection, role hijacking, tool poisoning, and multi-turn manipulation with an F1 of 99%.
Happy to help with testing or provide the pattern set as a reference for the validation logic.
245 patterns covering the full OWASP LLM Top 10 + Agentic Security taxonomy is exactly what the validation layer needs. Let's wire ClawGuard as the default ruleset for the pre-dispatch gate.
I'll structure the PR so the pattern set is pluggable (interface + default impl) — ClawGuard becomes the default, and operators can extend or swap. That way the hook is useful out of the box but not locked to any single scanner.
Will reference ClawGuard in the PR description and ping you for review on the pattern integration.
Thanks for the interest @mindburnlabs — ClawGuard's pattern set is MIT-licensed and designed to be embedded exactly like this.
A few points on integration:
-
Pattern matching as pre-dispatch gate makes sense architecturally. The regex engine runs in <10ms (no LLM call), so it adds negligible latency before schema validation.
-
Pluggable interface is the right call. The pattern set ships as a standalone JSON/YAML ruleset — any framework can load it without coupling to our scanner runtime.
-
Happy to review the pattern integration in the PR. The key consideration: patterns need the full tool description + parameter values concatenated as input, not just the tool name.
If the AutoGen maintainers are interested in an official integration, I'm available to help scope it. The 245 patterns cover OWASP LLM Top 10 + the Agentic Security taxonomy, so this would give AutoGen MCP users baseline prompt injection defense out of the box.
Tool poisoning is one of the most underestimated MCP attack vectors. An attacker modifies tool descriptions or injects hidden instructions that manipulate the LLM's behaviour — and the user never sees it.
We built detection for this in cybersecify, an MCP security scanner. The assess_risk tool evaluates every exposed tool on a server and flags dangerous capabilities. The check_call tool gives a runtime GO/CAUTION/BLOCK decision before any tool call executes, checking the tool name, arguments, and context.
Install and test:
npx cybersecify
"Assess the risk of tools on my MCP server"
We also maintain DVMCP — a deliberately vulnerable MCP server with intentional tool poisoning for testing detection.
This looks less like a prompt-injection problem and more like an execution-boundary gap.
A tool being listed and described is treated as sufficient for it to be callable, but there is no explicit admissibility check between the model’s proposed call and actual execution.
As a result, authority is effectively inherited from visibility, allowing poisoned tool definitions to pass directly into execution.