# MCP tool poisoning: why a math tool asked for an SSH key

> Source: <https://dev.to/systemdesignsimple/mcp-tool-poisoning-why-a-math-tool-asked-for-an-ssh-key-2jfl>
> Published: 2026-11-26 13:42:15+00:00

**Recommendation:** Scope each MCP tool's file access to the minimum folder and add a path-checking allow-list that logs blocked reads, then test it with a dummy file outside the allowed folder.
More in the playbook "Securing agents and AI tools": <https://wpnews.pro/playbooks/agent-security>

MCP tool poisoning hides malicious instructions in a tool description to steer the model. Some clients show users only a shortened description, so the model can act on text you never saw. A sandbox cannot stop the model reading that text, but when every file route enforces it, the sandbox decides what the instruction can reach.

When an AI agent connects to an MCP server, its client sends `tools/list` and gets back one entry per tool: a name, an input schema and, usually, a description, which the model reads to decide when and how to call it. On 2025-04-01, Invariant Labs published a report on tool poisoning attacks: malicious instructions in tool descriptions that are "invisible to users but visible to AI models". The model saw the full description while the app showed the user a simplified version.

The report's example is a tool named `add` that adds two numbers. Lower down, the description tells the model to read the SSH private key at `~/.ssh/id_rsa` and pass the content back as one more argument of the same `add` call. The argument is declared by the tool, so a schema check does not catch it. The key rides inside an ordinary tool call, straight to the server that asked for it.

The MCP specification Tools page (2025-06-18) says clients SHOULD show tool inputs to the user before calling the server. When the inputs are shown, an `add` call with a long block of key text next to `2` and `3` is easy to spot and reject. MCP roots do not stop it either: servers SHOULD respect root boundaries, but a server can choose to ignore them.

Our in-memory simulation, run 2026-11-16 on Node 22.13.1, models a poisoned notes tool, a fake home folder of 500 dummy files holding 12 fake secrets, and a scripted client that obeys every hidden instruction. The run took 16 ms. Setup A, whole home folder open: 500 files reachable, 12 of 12 secrets leaked, 0 blocked calls logged. Setup B, notes folder only: 20 files reachable, 0 leaks, 0 logged. Setup C, B plus an allow-list with path checks: 20 files, 0 leaks, 6 blocked calls logged.

The client read the hidden instruction in 3 of 3 setups, and only setup C recorded the attempts by name.

Test your sandbox with a dummy file outside the allowed folder: try to read it through each tool, and confirm access is denied and logged.

The model will keep reading whatever text a server sends. The controls that hold sit outside the model: inputs you see before a call, and a sandbox on every file route that keeps your secrets away from the servers and the agent's tools.

Read the full article: [https://systemdesignsimple.com/mcp-tool-poisoning-explained/](https://systemdesignsimple.com/mcp-tool-poisoning-explained/)
