This article explains MCP rug pull attacks, a supply-chain threat where malicious or compromised MCP servers silently change tool definitions after approval, causing poisoned tools to persist across every future session. The article distinguishes rug pulls from tool poisoning (which presents malicious definitions before approval) and demonstrates why the Model Context Protocol's lack of cryptographic integrity verification creates persistent risk. It provides concrete techniques for detecting and preventing these attacks through definition fingerprinting, re-verification workflows, and layered defenses that extend beyond hash pinning alone.
- Rug pulls exploit timing and persistenceA rug pull happens when a tool passes review and then changes afterwardβthe attacker gains a trusted tool already approved for use. Unlike tool poisoning, which presents malicious code during discovery when reviewers are watching, rug pulls change the server-side definition after the approval point. The postmark-mcp 1.0.16 incident illustrates this: a one-line code change added a hidden BCC to emails without altering the visible tool description, and that poisoned version persisted in every later session, making cleanup ineffective because the problem lives on the server, not in the conversati
- Definition fingerprints must cover full canonical formA cryptographic hash alone is insufficient unless it covers the entire canonicalised tool definition: name, description, input schema, parameter descriptions, defaults, enum values and annotations like readOnlyHint and destructiveHint. The article provides a Python example using JSON serialization with sorted keys, normalized whitespace and consistent encoding before hashing. If you hash only name and top-level description, an attacker can move a prompt-injection payload into a parameter description and bypass the check untouched.
- MCP spec provides no re-approval triggerThe MCP specification says servers that declare listChanged capability SHOULD send notifications/tools/list_changed, but this is not mandatoryβa hostile server has no reason to send it. More critically, nothing in the spec forces re-approval when a tool's schema or metadata changes while the name and version remain identical. The spec only says clients MUST treat tool annotations as untrusted unless from trusted servers, leaving a gap the client must close by implementing re-approval logic tied to hash mismatches.
- Hash pinning catches definitions, not hidden codeA matching fingerprint proves the tool's description and schema are unchanged but cannot detect malicious logic in the server code behind that definition. The postmark-mcp 1.0.16 example demonstrates this gap: a hidden BCC was added in code while the tool definition stayed identical, so hash verification would have passed. The article states pinning the package at version 1.0.15 would have avoided the issue, emphasizing that version pinning and package verification must complement definition hashing.
- Approval workflow requires human re-review on driftThe article prescribes a workflow that blocks tool calls immediately when a hash mismatch is detected and shows the reviewer a unified diff of the canonical forms before allowing re-approval. This human re-review must happen before the changed tool reaches the model's context. The diff visualization is crucial because, as the article notes, one added sentence is easy to miss by eyeβletting the diff, not human memory, point at changes.
- List_changed notification should invalidate cache immediatelyClient best practice is to treat a cached tool list as stale the moment a list_changed notification arrives, even before its time-to-live expires. This notification contains no payloadβit only signals that tools/list should be fetched again. The article positions this as a natural trigger to re-fetch, re-hash and compare against the baseline, though it emphasizes the spec says servers SHOULD (not MUST) send it, so clients cannot rely on its presence.
- Layered defenses required beyond fingerprintingThe Cloud Security Alliance names hash pinning, allowlisting approved servers, and treating tool-returned content as hostile as immediate controls. The article recommends: hashing the full definition on every tools/list response, pinning package and server versions, maintaining an allowlist of approved servers as a change-management event, requiring human re-approval on hash changes, and monitoring what the server actually does. No single control catches all attack variants.
- Review habits detect post-approval changes in labsThe article walks through a controlled demo where a toy server is approved, fingerprinted, then silently swapped to inject an extra sentence into a parameter description without changing name or version. The same sentence is easy to miss visually, but the hash changes completely, triggering a jq diff that shows exactly one line changed. This hands-on patternβread as the model would, fingerprint, let the server change, catch it via hashβencodes the defensive habit the article aims to teach.
Bottom line: MCP rug pull attacks succeed because approval is a point-in-time check while the server keeps running afterwardβyou must pair initial approval with continuous hash verification on every tools/list response and list_changed notification, block changed tools until humans re-review them, and supplement definition pinning with version pinning, server allowlists and runtime monitoring, since a matching hash cannot detect malicious code behind an unchanged definition.
β±οΈ 50 min Β· Intermediate Β· 2 hands-on labs
Imagine you reviewed an MCP server last month. You read every tool description, approved the lot, and your team's agents have been using it happily ever since. This morning the server owner pushed a quiet change. One sentence was added to a description, nothing else, and no prompt appeared on your screen. That is what mcp rug pull attacks look like in practice: approval was a single moment, and the server kept running afterwards.
I want you to be able to spot that change and stop it. We will separate a rug pull from tool poisoning, build a fingerprint of a tool definition that covers parameter descriptions, defaults, enums and annotations, and re-check that fingerprint every time a tool list arrives. Then we will design an approval workflow that blocks a changed tool until a human looks at it again.
I will also be straight with you about what hashing cannot do, because malicious code can sit behind a definition that never changes. Everything hands-on runs against your own machine, a localhost toy server, or the SecurityElites practice lab. Never point any of it at a server you do not own.
π― What You Will Be Able to Do
β Before You Start
- Basic understanding of the Model Context Protocol, including tools and tools/list
- Comfort reading JSON and running a short Python or Node script
- Familiarity with prompt injection concepts
π In This Tutorial
- What MCP rug pull attacks are, in short
- Rug pull versus tool poisoning
- How a trusted tool changes after approval
- Threat model and the postmark-mcp lesson
- Spec behavior: listChanged and untrusted annotations
- Baseline fingerprints: what the hash must cover
- Controlled demo: a tool that changes after approval
- Detecting schema drift and building an approval workflow
- Limits of pinning and layered defenses
- Practice in the lab
- Your checklist
- What I want you to remember
- Questions people ask
What MCP rug pull attacks are, in short
I will give you the short answer first. MCP rug pull attacks happen when a malicious or compromised MCP server silently changes a tool's definition or behaviour after you or your team have already approved it. MCP is the Model Context Protocol, the standard way an AI agent discovers and calls tools on a server. The tool looked safe when you approved it, and later it stopped being safe.
It is a supply chain attack. You trusted a component, the supplier changed it, and nothing told you. Picture a library you reviewed last month that shipped a quiet update this morning.
The part that worries me most is persistence. Once the definition is silently updated, every later agent session that calls that tool runs the poisoned version. Cleaning up one session does not fix it, because the source of the problem is the server, not the conversation.
If you want the wider map first, read what MCP security is. Then come back here, because this article is about the moment after approval.
Rug pull versus tool poisoning
Let me separate two terms people often blur together. Tool poisoning means a tool's description or schema carries hidden instructions aimed at the model. A rug pull is about when that happens. Poisoning presents the malicious definition before approval, during discovery. A rug pull modifies a previously trusted tool after approval.
π Words I just used
The Cloud Security Alliance groups description poisoning, rug pulls and shadowing as three variants with one cause: trust inherited without continuous verification. That is a useful way to remember them. Invariant Labs, who coined the name tool poisoning in April 2025, described rug pulls as a variant of it.
For the poisoning side in depth, my article on MCP tool poisoning and rug pulls covers it step by step. For the full picture, the agentic AI security guide is the pillar this topic sits under.
π§ Quick check
How a trusted tool changes after approval
Let me walk you through the mechanics. The ETDI paper names three weaknesses that make mcp rug pull attacks possible. First, server-side logic is mutable, so the server owner can change what a tool says or does at any time. Second, clients do not re-fetch and re-verify the full definition, schema or hash, on later calls. Third, there is no re-approval trigger when the name or version stays the same but the schema or metadata changes.
The MCP-38 threat taxonomy, entry MCP-16, says rug pulls exploit MCP's lack of cryptographic content-addressing and integrity verification for tool definitions. In plain words, nothing in the protocol ties an approval to the exact bytes you approved. Its examples are:
βοΈ MCP-38 rug pull examples
Microsoft's Zero Trust AI attack catalog gives a clear picture. A trusted send_slack_message tool is approved and used happily, then later altered so that it exfiltrates data. Microsoft also notes that MITRE ATLAS has no dedicated rug-pull technique, so the closest fits are supply-chain compromise, agent-tool abuse and indirect prompt injection.
- Clean tool reviewed
- You approve it
- Name and version unchanged
- Server swaps definition or logic
- Client trusts old approval
- Poisoned tool runs every session
Threat model and the postmark-mcp lesson
I want you to think like the defender who has to decide what could go wrong, so let me lay out the threat model for mcp rug pull attacks first. The attacker wants one thing: a tool you already trust that now works for them. Because the change happens after approval, nobody is looking at it any more.
π Words I just used
I covered Microsoft's send_slack_message example earlier, so here I will only add what it means for your threat model: the tool that gets abused is one you already trust, which is why nobody is watching it.
Now for a real incident. In postmark-mcp version 1.0.16, published on 17 September 2025, a one-line change added a hidden BCC (blind carbon copy) to every email the tool sent. Nothing in the visible tool description had to change. Pinning the package at 1.0.15 would have avoided the BCC change.
So a rug pull is not always a schema change. Even when it is, one inserted sentence carrying a prompt-injection payload in a description is far less visible than a new parameter. Reviewers and agents skim past it. For the original attack class, read the MCP tool poisoning and rug pull guide.
π§ Quick check
Spec behavior: listChanged and untrusted annotations
I want you to see what the MCP tools specification actually promises, because many people assume it protects them from this. It does less than you might hope.
The spec lets a server's tool list change over time. A server that declares the listChanged capability SHOULD send a notifications/tools/list_changed message when the list changes. Note the word SHOULD. It is a courtesy signal, not a guarantee, and a hostile server has no reason to send it.
A notification with no payload. It only tells the client to fetch tools/list again.
Two other rules matter. Clients MUST treat tool annotations, such as readOnlyHint and destructiveHint, as untrusted unless they come from trusted servers. And there SHOULD be a human in the loop who can deny tool invocations.
Put those together and notice the gap: nothing in the spec forces re-approval when a definition changes. The human in the loop is a point-in-time check, and a rug pull happens after it passes. Closing that gap is the client's job.
readOnlyHint: true from a server you have not vetted. A flipped annotation is exactly the kind of change a rug pull uses.π§ Quick check
Baseline fingerprints: what the hash must cover
I want you to leave this section with one habit. When you approve a tool, you record a fingerprint of it, and you check that fingerprint every time the tool list arrives. A fingerprint here is a cryptographic hash, a short string that changes completely if even one character of the input changes. This is the core defence against mcp rug pull attacks, because it turns a silent change into a loud one.
The tricky part is deciding what goes into the hash. If you hash only the top-level description, an attacker simply moves the payload somewhere else. Parameter descriptions, defaults and enum values are all prompt text to the model, so they must all be covered. Annotations such as readOnlyHint and destructiveHint matter too, because flipping one changes how a client treats the tool.
The second idea is canonicalisation, which means turning the definition into one fixed text form before hashing. Sort the keys, normalise whitespace, and use the same encoding every time. Without that, harmless reordering gives you false alarms, and people learn to ignore alarms.
Hashes the whole tool object, so every nested field is included. Collapse runs of whitespace inside description strings before this call if your server pads them.
π§ Quick check
Controlled demo: a tool that changes after approval
Let me show you it happening. Everything here runs on your own machine against a deliberately vulnerable toy server that you run on localhost. Do not point this at any real server. If you have no toy server, use the lab at the end of the article instead. The idea is simple: approve a tool, fingerprint it, let the server change it, then catch the change.
π§ Catch a post-approval swap
127.0.0.1 with a single tool, for example send_note. It should answer a tools/list request with a clean definition. You should see one tool and plain descriptions.fingerprint() from the last section and save the results to approved.json. This file is your baseline.tools/list again and compute the fingerprint. The old and new hashes should differ. If they match, check that you hashed the full object and not only the description.Example of the output you should see. The jq -S flag sorts keys, so only real changes appear.
Detecting schema drift and building an approval workflow
A fingerprint is only useful if something acts on it. Let me show you where to wire the check in. Verify the hash on every tools/list response, before the descriptions ever reach the model's context. Treat each new server registration as a change-management event that needs a security review, not a casual click.
The MCP specification says servers that declare listChanged should send notifications/tools/list_changed. Client guidance says to treat a cached list as stale the moment that arrives, even before its time-to-live expires. That is your natural trigger to re-fetch, re-hash and compare. Be aware that the specification does not force re-approval, so your client has to add it.
- Review tool and diff
- Human approves
- Store fingerprint and pin version
- Fetch tools/list or list_changed
- Re-hash and compare
- Match: allow. Mismatch: block until re-approval
On the review screen, show a diff of the whole schema, not just the description. Add drift monitoring that raises an alert on any mismatch. For larger teams, an MCP gateway between agents and servers can enforce an allowlist, inspect schemas on every call, pin versions by hash, scope credentials and keep audit logs.
For the wider attack background, read the tool poisoning and rug pulls guide, then the MCP attack surface map.
Limits of pinning and layered defenses
I want to be honest with you about what a hash can and cannot do. Pinning means recording a cryptographic hash of each reviewed tool definition and refusing to use the tool if the live definition no longer matches. It catches edited descriptions and flipped readOnlyHint or destructiveHint annotations. That is a strong control against mcp rug pull attacks, but it only looks at the definition.
Here is the gap. Malicious logic can sit in server code behind a definition that never changes. The postmark-mcp 1.0.16 change I described earlier is the example: a hidden BCC was added in code, and a hash of the definition would not have caught it. Pinning the package at 1.0.15 would have avoided it, so you must pin and verify package versions too.
So we layer. The Cloud Security Alliance names tool definition hash pinning, allowlisting approved servers and treating tool-returned content as hostile as immediate controls, because MCP has no native way to detect poisoning. An allowlist decides which servers may connect at all. A gateway can add schema inspection on every call and audit logging.
βοΈ Layers to have in place
One more option exists. The Enhanced Tool Definition Interface (ETDI) proposes OAuth-enhanced, signed tool definitions, but it is not part of the core MCP specification, so do not assume your client supports it. For next steps, read the MCP Server Security Checklist and best practices and the real MCP attack case studies. The tool poisoning and rug pull guide covers the timing difference in more depth.
π§ Quick check
Practice in the lab
Time for you to try it. I want you to practise the review habit that stops mcp rug pull attacks before they start: read every tool as the model would, fingerprint it, and decide in advance what counts as a change. This runs only in the SecurityElites lab, never against a real server.
Several MCP servers are waiting for your review. Reviewing them carefully is the same skill as building a trustworthy baseline, so we use this lab now.
βΈ Open each server's tool list and read every description, including parameter descriptions, defaults and enum values, as if they were instructions to the model.
βΈ Note each tool's scopes and annotations such as readOnlyHint and destructiveHint, and ask whether they match what the tool claims to do.
βΈ Canonicalise each definition by sorting keys and normalising whitespace, then hash the whole thing and record the fingerprint in a notes file.
βΈ Look for anything suggesting a server could change its tools after you approve it, and mark those servers as higher risk.
What to notice: How easy it is to skim past one odd sentence in a parameter description Which servers ask for more scope than their purpose needs Whether any definition would look fine on a top-level description check alone
π§ Write your re-approval rules
π§ Quick check
Your Checklist
βοΈ MCP tool review and drift checklist
π« Mistakes I See Most Often
What I Want You to Remember
π§ Check Your Understanding
β Questions People Ask
What is an MCP rug pull attack and how is it different from tool poisoning?
How can a trusted MCP tool change after I approve it?
What is a tool definition fingerprint (hash) and what should it cover?
Does hash pinning stop all MCP rug pulls, including malicious code updates?
How should an approval workflow handle a changed MCP tool schema or description?
Does the MCP specification require clients to re-approve tools when notifications/tools/list_changed arrives?
How do I detect schema drift in MCP servers?
π§© More in the MCP Security series
- Start here: MCP Security 2027: Complete Model Context Protocol Security Guide β Learn mcp security from architecture to defence: map trust boundaries, spot tool poisoning and rug pulls,…
- MCP Tool Poisoning Attacks: Detection, Testing and Prevention β Learn mcp tool poisoning step by step: read malicious tool descriptions, test them in a safe…
- MCP Attack Surface Explained: Servers, Tools, Resources and Trust Boundaries β Map the mcp attack surface across servers, tools, resources and trust boundaries, then review a rogue…
- MCP Server Security Checklist: 30 Essential Security Controls β Use this MCP server security checklist to audit configuration, authentication, permissions, logging and transport, and fix…
π Keep Learning on SecurityElites
- MCP Security Best Practices: Why One Bad Server Can Hijack Your Agent’s Tools β MCP security best practices explained: how tool poisoning, rug pulls and shadowing work, why approval clicks fall short,…
- Real MCP Attacks 2026 β Four Case Studies Dissected End to End | MCP Security Day 5 of 7 β Real MCP attacks 2026 β four documented incidents dissected forensically, from Hong Kong wire transfer to rug-pull credential…
- MCP Tool Poisoning β Real 2026 Rug Pull Attack Guide | MCP Security Day 4 of 7 β MCP tool poisoning explained β how hidden instructions in tool descriptions hijack AI assistants, rug-pull economics, and real…
- Prompt Injection through MCP β The Complete 2026 Beginner’s Guide | MCP Security Day 3 of 7 β Prompt injection through MCP attacks explained β how resource-channel injection hijacks AI assistants, the payload patterns to recognise,…
- MCP Attack Surface β The 2026 Beginner’s Complete Map | MCP Security β Day 2 of 7 β MCP attack surface explained β the five categories every developer must know in 2026, with real attack chains…
π Sources I Checked
- The MCP Rug Pull Attack: The Threat That Changes Your Tools After You've Approved Them – DEV Community
- What is an MCP Rug Pull Attack? Threats & Prevention
- ETDI: Mitigating Tool Squatting and Rug Pull Attacks in Model Context Protocol (MCP) by using OAuth-Enhanced Tool Definitions and Policy-Based Access Control
- MCP-38: A Comprehensive Threat Taxonomy for Model Context Protocol Systems (v1.0)
- 1. Rug-Pull Attack (Agent / MCP Server)
- MCP Tool Poisoning and Rug Pull Attacks
- MCP Tool Poisoning Attacks: Hidden Tool Descriptions and Rug Pulls – DEV Community
- Understanding Model Context Protocol Security (MCP) in 2026
Written by Mr Elite. Reviewed by Mr Elite, last reviewed on .

