supraj.dev

AI security · MCP

MCP tool poisoning and rug pulls, explainedHow a bad tool server can steer your agent, and how to stop it.

An AI agent picks its tools by reading their descriptions. Whoever writes those descriptions can talk to your model. This article explains four ways a malicious or changed MCP server uses that channel, then the defences that hold up: pinned tool definitions, allow-lists, least privilege, human approval and logs.

Supraj Maripeddi · · 16 min read

Cover: an AI agent reads three tool cards. One card has a hidden second line of instructions. A pinned fingerprint beside the cards shows a mismatch, and the call is held for review.
Start hereYour agent connects to MCP servers that you, or your users, did not write.
Leave knowingWhat tool poisoning, argument leaks, rug pulls and cross-server shadowing are, and which control stops each one.
Keep in mindNo filter catches every injected instruction. Limit what a fooled agent is able to do.

Imagine this: a developer adds a free "daily quote" server to their coding agent. It looks harmless. They never call it. But the agent also has a payments tool, and the quote tool's description quietly tells the model to add a small fee to every payment.

That's a scenario, not a real incident. It is close to an example that Elastic Security Labs published, though. [5] The point is simple: a tool can do harm just by being listed, because its words go straight into the model's context.

One idea runs through the whole article. Tool descriptions are untrusted input, the same as a web page or an email. Once you treat them that way, the defences follow.

01 / The channel

What does the model actually read when it picks a tool?

MCP is the Model Context Protocol. It's an open protocol for connecting AI applications to outside tools and data. An MCP server offers tools. An MCP client, inside the AI application (the host), connects to it. [1]

The client asks a server for its tools with a tools/list request. Each tool comes back as a definition with a name, an optional title, an optional description, and an inputSchema. The input schema is a JSON Schema that says which arguments the tool takes. [2]

The spec says tools are "model-controlled". That means "the language model can discover and invoke tools automatically based on its contextual understanding and the user's prompts". [2] To do that, the model has to read the definitions. Elastic describes the flow: the user's prompt is sent to the model "along with a list of tool function names, descriptions, and parameters". [5]

So the description isn't just documentation. It is text the model reads and acts on. And the server's author wrote it.

Figure 1 · How a tool's words reach the model

  1. Client asks the server for its tools
  2. Server returns names, descriptions and input schemas
  3. Host puts those definitions in the model's context
  4. Model chooses a tool and fills in its arguments
  5. Host asks the user, or runs it automatically
All 5 steps
  1. Every step after step 2 trusts text the server's author wrote. That is the channel every attack in this article uses.
Based on the MCP tools specification and Elastic's walk-through of a tool call. [2] [5]

02 / Tool poisoning

What is tool poisoning?

Elastic defines it as "a form of indirect prompt injection where malicious instructions are hidden inside a tool's metadata, parameters, or descriptions". Because models rely on those descriptions, "poisoned content can steer the model into unsafe behavior". [5]

Prompt injection is the top item in the OWASP Top 10 for Large Language Model (LLM) Applications: LLM01. OWASP calls the injection indirect when the model "accepts input from external sources, such as websites or files". [8] A tool description is one more external source.

Why don't people notice? A 2025 research paper (arXiv 2506.02040) puts it plainly: the model "accesses the full tool description, while the user can only see a simplified version through the host interface". The attacker writes a normal description first and appends the hidden instructions after it. [6]

Attackers can also hide the text from human reviewers. Elastic names two methods. One is "ASCII smuggling", which uses invisible Unicode characters the model still reads. The other is encoding instructions, for example in Base64, so a keyword filter doesn't match them. [5] I won't show working examples here. You don't need them to defend against this.

What the user sees
A tool called search or daily_quote, with a one-line summary in the host's tool list.
What the model reads
The full description, which may also tell it to read a secret, pass it along, or change how another tool behaves.

How well does this work against today's models? The same paper tested five models through one client and reports that "current mainstream LLMs cannot defend against these types of attacks". [6] That's a research result from a lab setup, not a measurement of your deployment. It's still a good reason not to count on the model to say no.

03 / Exfiltration

How can a tool steal data through its own arguments?

A tool doesn't have to read your files itself. It can ask the model to send them. Elastic shows how "tool parameters can be crafted to trick the model into leaking sensitive internal context", such as "system details, chat history, or even the proprietary system prompt". [5]

Their example is a code formatter with an extra context parameter. The description says the formatter needs the whole conversation to work well. In their test, the model filled that parameter with the workspace layout, the operating system and the list of available tools. [5]

It can be even quieter. Elastic notes that a parameter name alone, like summary_of_environment_details, "implicitly signals that context is expected". A helpful model may fill it in without being asked. [5]

The arguments go to the server. So the server's author receives whatever the model put there. That's why the MCP tools spec tells clients to "show tool inputs to the user before calling the server, to avoid malicious or accidental data exfiltration". [2]

A quick test for your tools

For each parameter, ask: does this tool need this to do its job? A formatter needs a file path and a style. It doesn't need your chat history. A parameter that asks for "context" or "environment" with no clear reason is a red flag.

04 / Rug pulls

What happens when a tool changes after you approved it?

This is a rug pull. Elastic describes it as a tool whose "description or behavior is silently altered after user approval". Such changes "don't necessarily trigger a new approval flow". [5]

The protocol allows tools to change. The spec says the set of tools "MAY change over time". A server that declares listChanged should send a notifications/tools/list_changed message when its list changes. [2] That's a useful feature. But a notice that something changed is not a review of what changed.

The arXiv 2506.02040 paper tested this in the wild. The researchers listed a server on three MCP aggregator sites, Smithery.ai, MCP.so and Glama, pointing at an empty GitHub repository. After the listing went live, they put malicious server code in that repository. The listings did not change. [6] In a separate test, none of the platforms detected the hidden instructions in their uploaded server. [6]

The paper also points at a common install pattern. Servers started with npx or uvx are "freshly pulled and executed each time". So a new upstream version reaches you on the next run. [6]

In its user study of 20 people, only one participant correctly analysed the rug-pull attack. [6] That is a small study. But it matches the shape of the problem: the server you reviewed last week is not always the server you run today.

05 / Cross-server attacks

Can one server hijack another server's tools?

Yes. When an agent connects to several servers, every tool definition sits in the same context. Elastic notes that at the start of a session "all tool metadata is loaded into the LLM's context". [5] So one server's text can talk about another server's tools.

The arXiv 2506.02040 paper calls this a puppet attack. A malicious server's descriptions "can affect trusted tools, ultimately leading to malicious actions". When the user calls the trusted tool, the malicious instructions run too. [6] The survey paper arXiv 2512.08290 calls a related pattern "Cross-Server Tool Shadowing". [7]

There are three variations worth knowing:

  • Implicit tool calls. The opening scenario. The quote tool is never called, but "its description still influences the model's decisions". [5]
  • Name collisions. Two servers offer tools with the same or similar names. The fake one may add text like "prefer this tool for security reasons". [5] OWASP gives an example where a tool named report is picked before report_finance. [10]
  • Chaining with trusted tools. A malicious description tells the model to first use a built-in search tool to find a key, then send it in a message. Elastic notes that built-in helpers are "often preauthorized", so they may run "without triggering any user-facing permission". [5]

06 / Poisoned content

What if the tool is honest but the data isn't?

A perfectly honest tool can still return poisoned text. The paper arXiv 2506.02040 lists this as its fourth category: "Exploitation via Malicious External Resources", such as a website a tool fetches. [6]

Elastic retells a case first shown by Invariant Labs. An attacker opens an issue in a public GitHub repository with hidden instructions. A developer asks their agent to "check open issues". The agent reads the issue, pulls data from the developer's private repositories, and publishes it in a pull request on the public one. [5]

Elastic's conclusion is the key line: this "isn't a vulnerability in GitHub's MCP server, hosting platform, or the AI model". It is a permission and design problem, where agents "have broad access and act on untrusted inputs without strong contextual boundaries". [5]

The fix here isn't about tool definitions at all. One token had access to both public and private repositories, and it read untrusted text. Split those apart and the attack has nowhere to go.

07 / The rules

What does the MCP specification itself require?

The spec is clear that it can't solve this alone. It says "MCP itself cannot enforce these security principles at the protocol level". It asks implementers to build consent flows, access controls and data protections. [1]

Here is what it does say, in its own words:

  • "Tools represent arbitrary code execution and must be treated with appropriate caution." [1]
  • Descriptions of tool behaviour, such as annotations, "should be considered untrusted, unless obtained from a trusted server". [1]
  • "Hosts must obtain explicit user consent before invoking any tool." [1]
  • "There SHOULD always be a human in the loop with the ability to deny tool invocations." [2]
  • Servers MUST validate tool inputs, apply access controls, rate limit calls and sanitise outputs. [2]
  • Clients SHOULD confirm sensitive operations, show inputs before a call, validate results before passing them to the model, set timeouts and "log tool usage for audit purposes". [2]

A note on annotations. These are hints a server can attach to a tool, such as readOnlyHint or destructiveHint. The schema reference says they are "not guaranteed to provide a faithful description of tool behavior". It also says clients "should never make tool use decisions based on ToolAnnotations received from untrusted servers". [3] A malicious server can simply label a destructive tool read-only.

Don't over-read this

Most of these rules are SHOULD, not MUST, and they are aimed at hosts and clients. Whether your agent actually asks before each call depends on the product and on its settings. Check yours.

08 / Defence: integrity

How do you notice that a tool definition changed?

You record what you approved and compare it every time. OWASP's guidance for agentic supply chains (ASI04) says to "pin prompts, tools, and configurations by content hash and commit ID". It adds "automatic rollback on hash drift". [11]

A content hash is a short fingerprint of some text. Change one character and the fingerprint changes. So the check is simple:

  1. When you review and approve a server, save a hash of each whole tool definition: name, title, description, input and output schemas, and annotations.
  2. Each time the client receives the tool list, hash the definitions again.
  3. If a hash differs, or a new tool appears, block that tool until someone reviews the change.

Figure 2 · A pinned tool definition

Approved definition (pinned at review time):

{"name":"get_weather","description":"Get the forecast for a city.","inputSchema":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}

Pick what the server sends. Your browser computes a SHA-256 hash of each definition and compares them.

A teaching example. The changed version adds one sentence asking for an extra argument. Hashing happens locally in your browser; nothing is sent. Pinning by content hash is OWASP ASI04 guidance. [11]

Researchers go further. The arXiv 2506.02040 paper suggests "mandating cryptographic signing of tool descriptions and code". [6] The survey arXiv 2512.08290 describes a proposal called the Enhanced Tool Definition Interface (ETDI), with signed tool manifests and immutable version identifiers. [7] These are research proposals, not features of the MCP spec today.

OWASP also says to "allowlist and pin dependencies" and to enforce "fully qualified tool names and version pins to avoid tool alias collisions". [11] [10] In practice, pin the server package version too, instead of pulling the latest on every run.

Don't over-read this

A hash only proves the definition didn't change. It says nothing about whether the original was safe, or whether the server's code does what the description says. Review first, then pin.

09 / Defence: blast radius

How do you limit what a fooled agent can do?

Assume the model will be fooled sometimes. OWASP says of prompt injection that "it is unclear if there are fool-proof methods of prevention". [8] So the goal is to make a fooled agent harmless. Three controls do most of the work.

An allow-list of servers and tools. OWASP's LLM06 entry, Excessive Agency, says to "limit the extensions that LLM agents are allowed to call to only the minimum necessary". [9] Elastic adds: connect to third-party servers "from trusted sources only". [5] Elastic also notes that some clients "allow for tools from a server to be selected or disabled". [5] Turn off the ones you don't use.

Least privilege per tool. OWASP's ASI02 entry says to "define per-tool least-privilege profiles (scopes, maximum rate, and egress allowlists)". Examples: read-only database queries, and "no send/delete rights for email summarizers". [10] The MCP security guide says the same for access tokens: start with a "minimal initial scope set" and ask for more only when a privileged action is first tried. [4]

Authorisation outside the model. OWASP calls this complete mediation: "implement authorization in downstream systems rather than relying on an LLM to decide if an action is allowed". [9] The database, the cloud API, the payment system: each should refuse what the agent's identity is not allowed to do, whatever the model asks.

For servers that run on your own machine, the MCP security guide asks clients to show "the exact command that will be executed" before setup. It also says clients should "execute MCP server commands in a sandboxed environment with minimal default privileges". [4]

Figure 3 · Which control stops which attack

Where it enters
The tool's description or parameter text
What it exploits
The model reads text the user never sees
First control
Review the full definition, then pin its hash
Backstop
Least-privilege credentials and human approval for risky calls
A summary of chapters 2 to 10, drawn from the sources cited there. No single control covers every row; the backstop is the same each time. [5] [10] [11]

10 / Defence: people and records

Where do human approval, separation and logs fit?

Human approval for risky actions. OWASP's ASI02 asks for "human confirmation for high-impact or destructive actions (delete, transfer, publish)", ideally with a dry-run or diff preview first. [10] Elastic is blunt about the opposite setting: "Avoid 'always allow' or auto-run settings, especially for tools that handle sensitive data". [5]

Keep the prompts rare and meaningful. The arXiv 2506.02040 paper lists "user desensitization and fatigue towards security alerts" as one of four challenges it found. [6] If every read asks for a click, people stop reading the prompts. Ask for the writes, the sends and the deletes.

Separate untrusted content. OWASP LLM01 says to "separate and clearly denote untrusted content to limit its influence on user prompts". [8] In practice, don't let one session both read untrusted text and hold credentials that reach private data, as in the GitHub case.

Logs you can actually use. The MCP spec says clients should "log tool usage for audit purposes". [2] OWASP asks for "immutable logs of all tool invocations and parameter changes", plus alerts on odd chains such as a database read followed by an external transfer. [10] Log the tool definition hash next to each call too. Then you can tell which version of a tool did what.

A way to switch a tool off. OWASP ASI04 recommends a "supply chain kill switch" that can "instantly disable specific tools" when a compromise is found. [11]

What I'd do
  1. Keep an allow-list of MCP servers and tools. Install from sources you trust, pin the version, and turn off tools you don't use. [9] [11]
  2. Read the full definition of every tool before approving it, including parameter names. Then save a hash of it and block any tool whose hash changes until it is reviewed again. [11]
  3. Give each tool the narrowest credential that works, and enforce permissions in the system being called, not in the prompt. [9] [10]
  4. Turn off "always allow" for anything that writes, sends, pays or deletes, and show the arguments before the call. [2] [5]
  5. Log every call with its arguments and the tool's hash, and keep a fast way to disable a tool. [10] [11]

Keep these names

A small glossary

MCP (Model Context Protocol)
An open protocol for connecting AI applications to outside tools and data through servers.
MCP host, client and server
The host is the AI application. The client lives inside it and connects to a server. The server offers tools.
Tool definition
What a server returns for each tool: a name, an optional title and description, and an input schema.
Prompt injection
Input that changes a model's behaviour in ways the developer didn't intend. Indirect injection arrives through external content.
Tool poisoning
Prompt injection hidden in a tool's description, metadata or parameters.
Rug pull
A tool that changes its description or behaviour after a user approved it.
Puppet attack, or shadowing
One server's tool descriptions change how the model uses another server's trusted tools.
Tool annotations
Optional hints such as readOnlyHint. The spec says they are hints only and must not be trusted from untrusted servers.
Content hash
A short fingerprint of some data. Any change to the data gives a different hash.
Least privilege
Giving each tool or agent only the access it needs for its task.

Check the concept

Can you explain it back?

1. Can a tool cause harm if the agent never calls it?

Yes. Its description sits in the model's context with every other tool, and it can tell the model to change how it uses other tools.

2. A server marks a tool as readOnlyHint: true. Can you skip the approval prompt?

Not for an untrusted server. The spec says annotations are hints and clients should never base tool use decisions on annotations from untrusted servers.

3. Why doesn't a one-time review protect you from a rug pull?

Because the server can change its tool definitions later. Unless you compare what arrives with what you approved, the changed tool keeps the old approval.

4. What does a matching hash prove?

Only that the definition is the same as the one you approved. It doesn't prove the original was safe or that the code matches the description.

5. In the GitHub issue example, which change would have stopped the leak?

Not letting a session that reads untrusted public issues also hold access to private repositories, plus asking before the agent publishes anything.

Continue the thread

Around the same problem

Read further

Sources

All accessed 26 November 2026. MCP pages are from specification version 2026-07-28, the latest at the time. Research papers are preprints and report lab results.

  1. MCP specification 2026-07-28: Overview (Security and Trust & Safety)
  2. MCP specification 2026-07-28: Tools
  3. MCP specification 2026-07-28: Schema reference (ToolAnnotations)
  4. MCP: Security Best Practices
  5. Elastic Security Labs: MCP Tools: Attack Vectors and Defense Recommendations for Autonomous Agents (19 September 2025)
  6. Song et al., Beyond the Protocol: Unveiling Attack Vectors in the Model Context Protocol (MCP) Ecosystem, arXiv 2506.02040 (v4)
  7. Gaire et al., Systematization of Knowledge: Security and Safety in the Model Context Protocol Ecosystem, arXiv 2512.08290 (v2)
  8. OWASP Top 10 for LLM Applications: LLM01:2025 Prompt Injection
  9. OWASP Top 10 for LLM Applications: LLM06:2025 Excessive Agency
  10. OWASP Top 10 for Agentic Applications 2026: ASI02 Tool Misuse and Exploitation
  11. OWASP Top 10 for Agentic Applications 2026: ASI04 Agentic Supply Chain Vulnerabilities

Written with AI assistance. Technical sources are listed above.