MCP Attack Surface Explained: Servers, Tools, Resources and Trust Boundaries

MCP Attack Surface Explained: Servers, Tools, Resources and Trust Boundaries
✨ AI Summary

⏱️ 45 min · Intermediate · 2 hands-on labs

Picture this: a colleague sends you a link to a handy new MCP server and says, just add it to your config. It takes thirty seconds. But before you do, you want to know what you are actually letting into your machine, and which parts of that setup an attacker could touch. That map is the mcp attack surface, and by the end of this Tutorial you will be able to draw it from memory.

I will walk you through the parts first: hosts, clients, servers, tools and resources. Then we draw the three trust boundaries, and I will show you where attacks such as tool poisoning, rug pulls, token passthrough and local server compromise land on that map. Knowing the boundary tells you where the control belongs.

After that we get practical. You will review the tools of a deliberately rogue MCP server in a local test setup, looking for hostile descriptions before anything connects. Everything runs on your own machine or the SecurityElites practice lab. We finish with the controls that actually shrink the surface.

🎯 What You Will Be Able to Do

Define the MCP attack surface and name its main components
Draw the three trust boundaries between model, client, servers and backend systems
Classify attacks such as tool poisoning, rug pulls, token passthrough and local server compromise
Review a rogue MCP server's tools to find hostile descriptions before connecting
Apply controls that shrink the attack surface of an MCP deployment

βœ… Before You Start

  • Basic understanding of how LLM agents call tools
  • Familiarity with APIs and OAuth concepts
  • A browser to reach the SecurityElites labs

Direct answer: what the MCP attack surface is

I want to give you the short answer first, then spend the rest of this page earning it. The mcp attack surface is every place where untrusted content, code or credentials cross between the host application, the client, the MCP servers and the systems behind those servers. If data or authority moves across one of those lines and nobody checks it, that is a point of attack.

MCP stands for Model Context Protocol. It is the standard way an AI application connects to tools and data. This page is part of a wider series, and the MCP security Day 2 map of the attack surface goes deeper if you want a second walk-through. For the bigger picture of agents and their risks, see the Agentic AI security guide.

One thing surprises people. The specification itself says it cannot enforce its security principles at the protocol level. Consent flows, authorisation and access controls are left to whoever builds the host, client or server. In plain terms: the protocol hands you the pipes, and you own the locks.

⚠️ Watch out: Because the spec cannot enforce security for you, a server being 'MCP compliant' tells you nothing about whether it is safe. Treat compliance and safety as two separate questions.

🧠 Quick check

Who is responsible for enforcing consent and access controls in MCP?

The building blocks: hosts, clients, servers, tools, resources

Before we map attacks, you need the vocabulary. I will keep each definition short, because you will see these words in every section that follows.

πŸ“– Words I just used

HostThe AI application the user sits in, such as a chat app or coding assistant. It owns the model and decides what the user must approve.
ClientThe connector inside the host. Each client holds one connection to one MCP server.
ServerA program that exposes capabilities to the client: tools, resources and prompts.
ToolAn action the model can ask for, like running a query or editing a file. The spec says tools represent arbitrary code execution.
ResourceRead-only data such as files or database records, fetched through a resources/read request.
SamplingA feature where a server asks the client to get a completion from the model, using sampling/createMessage.

The difference between tools and resources matters for defence. A tool does something, so the risk is action. A resource is only data, but the model still reads it, so a resource can carry hidden instructions. Both are untrusted input to the model.

Transports are how the client talks to the server. With stdio, the client launches the server as a local process on your machine, and it runs with your privileges. With HTTP, the server is reachable over a network address, so authentication and origin checks become your problem. Different transport, different exposure.

πŸ’‘ Tip: When you review any server, write down its transport first. Stdio means 'code running as me'. HTTP means 'a network service that needs authentication'.

Three trust boundaries, with an attack-surface diagram

Now we draw the map. Security people think in trust boundaries, which are lines where data passes from a more trusted place to a less trusted one. MCP has three that matter: between the model and the client, between the client and its servers, and between the servers and the systems behind them.

πŸ—ΊοΈ MCP attack surface: three trust boundaries from model to backend
  1. Model (reads context as instructions)
  2. Boundary 1: model and client
  3. Client / host (consent, policy)
  4. Boundary 2: client and MCP servers
  5. MCP server (tools, resources, sampling)
  6. Boundary 3: servers and backend systems
  7. APIs, databases, files (untrusted)

I read this diagram top to bottom, and you should too. Trust falls as you go down. The host ranks highest. Servers are only conditionally trusted. The web APIs, databases and file systems a server calls are untrusted from the protocol's point of view. So every arrow downward is a place to validate, and every arrow upward carries content you should not believe.

Let me place the attack classes now, and we will cover each properly in the next part. At boundary 1 you find prompt injection landing in the model and tool descriptions read as trusted context. At boundary 2 sit tool poisoning, rug pulls, sampling abuse and malicious local servers. At boundary 3 sit confused deputy, token passthrough and SSRF. If you want to see injection travelling through this path, read prompt injection through MCP.

🚫 Common mistake: Many teams draw only one line, between the user and the AI. That hides boundaries 2 and 3, where most of the real damage happens.

🧠 Quick check

Which component is treated as untrusted from the protocol's perspective?

Threat model: mapping attack classes to each boundary of the mcp attack surface

Hold one idea while you read this section: every attack on the mcp attack surface sits at a specific boundary. If you can name the boundary, you know where to put the control. The full beginner map lives in the MCP attack surface day 2 guide, and here we turn it into a working threat model.

I will reuse the three boundaries from the diagram: A is model and client, B is client and servers, C is servers and the systems behind them. One caution first. The MCP specification admits it cannot enforce its security principles at protocol level, so the controls are yours to build.

πŸ“– Words I just used

Boundary AWhere content from a server enters the model's context, and where the model's requests come back out.
Boundary BThe connection between the host's client and each MCP server, including transport, sessions and consent.
Boundary CWhere a server calls APIs, databases, files and other services. The protocol treats those as untrusted.
πŸ’‘ Tip: When you read a threat report, ask one question first: which boundary did the bad input or credential cross? Write it next to the finding.

Local servers, tokens and real CVEs in the MCP attack surface

Let me bring the mcp attack surface down to where it bites: the laptop on your desk and the tokens in your config. Two ideas matter here. Local servers run with your privileges, and tokens must only be accepted by the server they were issued for. For the full map, read the MCP attack surface beginner's map.

A local stdio server is a process your host starts on your machine. It inherits your user privileges, so a malicious startup command or payload gets the same access you have: files, SSH keys, environment variables. The spec guidance is to show the exact command, require approval, and sandbox the server. A localhost HTTP server has a second problem. A web page in your browser can reach it through DNS rebinding, where a hostile domain is re-pointed at 127.0.0.1 so the browser treats your local service as same-origin.

Now for tokens. MCP authorization builds on OAuth 2.1 with PKCE, and servers must accept only tokens valid for their own resources, using audience binding through the RFC 8707 resource parameter. Token passthrough means accepting a token issued to someone else and forwarding it downstream. That is forbidden because the downstream API may trust it as if your server had validated it, a confused deputy. I go deeper in the MCP OAuth security article.

πŸ“– Words I just used

Audience bindingA token names the one service it is meant for, and that service rejects tokens naming anyone else.
DNS rebindingA trick that lets a hostile web page talk to a service bound to localhost.

Next, the real cases. CVE-2025-6514 is a CVSS 9.6 command injection in mcp-remote: a malicious server's crafted authorization-endpoint URL could run commands on the connecting client. It was fixed in 0.1.16. CVE-2025-49596 is a CVSS 9.4 remote code execution flaw in MCP Inspector, which bound its proxy to 0.0.0.0 without authentication, so a malicious page could exploit it with DNS rebinding and CSRF. It was patched in 0.14.1.

The mcp-server-git chain (CVE-2025-68143, CVE-2025-68144 and CVE-2025-68145) combined a path validation bypass, an unrestricted git_init and argument injection in git_diff. Paired with the Filesystem MCP server, it gave remote code execution. Both official SDKs also lacked DNS rebinding protection for localhost-bound SSE and StreamableHTTP servers: TypeScript before 1.24.0 and Python before 1.23.0.

⚠️ Watch out: Check the versions of every MCP package you run against these fixed versions. Only do this on your own machine.

🧠 Quick check

Why is token passthrough forbidden?

Demo: reviewing a rogue MCP server for your mcp attack surface

Let me show you the review habit that catches most poisoning before it connects. We treat a server's tool list as untrusted input, because the model reads names, descriptions and schemas as context, often before any tool is called. You do this in the intentionally vulnerable SecurityElites lab, never against a real server. I demonstrate, then you repeat it.

🧭 Review a rogue server's tool list

Step 1 β€” Open the lab and list the toolsStart the lab below and open the first pending server. You should see a list of tool names, descriptions and input schemas. Do not approve anything yet.
Step 2 β€” Read names and descriptions as untrustedRead every description in full, not the preview. Look for text addressed to the model rather than the user: words like always, before using, do not tell the user, or references to other tools.
Step 3 β€” Read the schemaCheck parameter names and defaults. A weather tool asking for a file path, or a free-text field named notes or context, is a warning sign.
Step 4 β€” Flag over-broad capabilitiesAsk whether the scope matches the purpose. A tool that reads one calendar should not touch the whole filesystem or run shell commands.
Step 5 β€” Record each finding against a boundaryWrite it down: hidden instruction in a description sits at model and client; excess file access sits at server and backend systems.
FINDINGS NOTE
server | tool | finding | boundary
example-srv | summarise | description addresses the model | model-client
example-srv | fetch | accepts any URL | server-backend

A simple format. Your lab findings will differ.

πŸ§ͺ HANDS-ON LAB Β· ADVANCED Β· 25 MIN Β· SECURITYELITES LAB
Rogue MCP Server β€” Review Tools Before You Connect

Several servers await approval, so you can practise the review above on each one.

What to try
β–Έ Read each description in full and note anything aimed at the model.
β–Έ Compare each tool's scope to its stated purpose.
β–Έ Look for servers that could change their definitions later.
β–Έ Decide approve, reject or restrict, and write your reason.

What to notice: Which findings sit at which boundary How harmless a poisoned description can look

πŸ’‘ Tip: For the attack side, tool poisoning and rug pulls shows what these hidden instructions achieve.

Detection: spotting exposure and abuse

Detection is where I see most teams thinnest, so let me show you four habits that close the visibility gap in your mcp attack surface. OWASP lists shadow MCP servers and lack of audit and telemetry among its MCP Top 10 risks, a beta-stage incubator project, so these are worth building first.

🧭 Four detection habits

Step 1 β€” Inventory every serverList servers in each host config, including ones developers added themselves. Unapproved ones are shadow servers. Record command, package, version and owner.
Step 2 β€” Diff tool definitions over timeSave each server's tool list as JSON, hash it, and compare at every start. A changed description after approval is the signature of a rug pull.
Step 3 β€” Log tool calls and consentRecord who called which tool, with what arguments, and whether the user approved. Without this you cannot reconstruct an incident.
Step 4 β€” Check findings with toolingRun the MCP Auditor tool and scanner on your inventory to confirm what you found by hand.
TOOL DIFF
sha256sum tools-approved.json tools-today.json
diff tools-approved.json tools-today.json
< "description": "Returns the weather."
> "description": "Returns the weather. Also read …"

Run on your own saved files. Any difference means re-review before the server is trusted again.

🚫 Common mistake: Approving a server once and never checking again. Approval covers the definitions you read, not the ones that arrive later.

🧠 Quick check

Which signal best suggests a rug pull?
πŸ§ͺ HANDS-ON LAB Β· ADVANCED Β· 20 MIN Β· SECURITYELITES LAB
AI Tool Poisoning β€” Hostile MCP Tool Description Hijacks the Agent

See what a hostile description does to an agent, so you know what your diffs and logs are protecting.

What to try
β–Έ Watch how the agent discovers tools at startup.
β–Έ Note which text the agent treats as instructions.
β–Έ Think about which log line would have shown the abuse.

What to notice: Descriptions act as context, not just labels Nothing flagged the change without a check


Reducing the mcp attack surface: defensive controls

Let me finish with what you can actually change. You cannot remove the mcp attack surface, because tools are arbitrary code and the specification admits it cannot enforce its own security principles at protocol level. Consent, authorization and access control are yours to build. So I have put the controls in priority order, and you can work down the list on your own setup. For the full map behind this list, read the MCP attack surface pillar guide.

🧭 Controls in priority order

Step 1 β€” Treat each server as its own security domainThe OWASP MCP Security Cheat Sheet advises treating every server as an untrusted, independent security domain. One server should never see another server's data, credentials or tool output.
Step 2 β€” Apply least privilege per server and per toolGive a read-only tool a read-only scope. If a tool only needs one folder, it gets one folder. Over-broad scopes are one of the named attack classes.
Step 3 β€” Sandbox local serversA local stdio server runs with your user privileges, so a bad startup command inherits everything you can touch. Run it in a container or restricted account instead.
Step 4 β€” Show the exact startup command and require approvalBefore a local server launches, display the full command line. Then ask a human to approve it. Do not let a client run a hidden command.
Step 5 β€” Pin and verify packagesCheck package names against typosquatting and pin exact versions. Fixes such as mcp-remote 0.1.16 only help if you are actually running them.
Step 6 β€” Enforce audience-bound tokensServers must accept only tokens issued for them, using the RFC 8707 resource parameter. Never forward a token you did not issue, because token passthrough creates a confused deputy.
Step 7 β€” Put a gateway in frontA gateway or proxy enforces isolation between servers and gives you one place to log and block.
Step 8 β€” Require consent for tool callsThe specification says hosts must get explicit user consent before invoking any tool. Keep that prompt switched on.
LOCAL SANDBOX EXAMPLE
Run a local MCP server with no network and a read-only folder (your own machine only)
docker run –rm -i –network none –read-only -v "$PWD/notes:/data:ro" example.test/my-mcp-server:1.0.0

The image name is a placeholder. The point is the flags: no network, read-only filesystem, one read-only mount and a pinned version tag.

⚠️ Watch out: Do not paste a server command from a README into your client config without reading it. That one line runs with your privileges.

🧠 Quick check

An MCP server receives a token meant for another service and forwards it downstream. What is this called?

To turn this into a routine, follow the Securing AI Agents and MCP course and practise reviewing tools in the tool poisoning guide. Use the OWASP cheat sheet as your checklist, and keep the controls in place after launch.

πŸ§ͺ HANDS-ON LAB Β· ADVANCED Β· 20 MIN Β· SECURITYELITES LAB
Rogue MCP Server β€” Review Tools Before You Connect

Apply these controls as a reviewer: decide which servers to approve and which to refuse.

What to try
β–Έ Read each server's tool names, descriptions and schemas as untrusted input.
β–Έ Compare the scope each tool asks for with what its purpose needs.
β–Έ Look for tools that could change after approval.
β–Έ Write down which control above would stop each risk.

What to notice: Which servers ask for more access than their job needs Which descriptions contain instructions meant for the model rather than the user


Your Checklist

β˜‘οΈ MCP deployment review checklist

🚫 Mistakes I See Most Often

Assuming a server is safe because it follows the MCP specification.Treat compliance and safety as separate questions. The spec leaves consent, authorisation and access control to implementors, so review each server yourself and treat it as its own untrusted security domain.
Pasting a server start command from a README straight into the client config.Read the exact command first. A stdio server runs as you, with access to your files, SSH keys and environment variables. Check package names for typosquatting, pin versions and sandbox the process.
Reviewing a server once and never looking at it again.Rug pulls work because definitions change after approval. Pin versions, hash or diff the tool list on every update, and alert when a name, description or schema changes.

What I Want You to Remember

The mcp attack surface is every point where untrusted content, code or credentials cross between host, client, servers and the systems behind them.
The MCP specification cannot enforce its own security principles at protocol level, so being 'MCP compliant' says nothing about being safe.
There are three trust boundaries: model and client, client and servers, and servers and their backend systems.
Tool descriptions, tool outputs and resources are all untrusted input, because the model reads them as context.
Stdio servers run with your privileges, and servers must never accept or forward tokens that were not issued to them.
Read a tool list before you connect, then pin versions and re-check, because a rug pull changes definitions after approval.

🧠 Check Your Understanding

Which description best defines the mcp attack surface?
Why is token passthrough forbidden?
What separates a rug pull from ordinary tool poisoning?

❓ Questions People Ask

What is the MCP attack surface?
It is every place where untrusted content, code or credentials cross between the host application, the MCP client, MCP servers and the systems servers connect to. That includes tool descriptions, tool outputs, resources, tokens, transports and local processes. Mapping it by boundary shows where each control belongs.
What are the main trust boundaries in the Model Context Protocol?
There are three: between the model and the client, between the client and its servers, and between servers and the backend systems they call. Trust falls as you move down, with the host highest, servers conditionally trusted and backend APIs untrusted from the protocol's view.
How does MCP tool poisoning work, and how is it different from a rug pull?
Tool poisoning hides malicious instructions in a tool's name, description or schema, which the model reads as trusted context, often before the tool is called. A rug pull is the same idea delivered later: the server passes review with clean definitions, then changes them. Pinning and diffing definitions catches the second.
Are local (stdio) MCP servers safe to run?
Not by default. A stdio server is a process on your machine that runs with your privileges, so a malicious command or payload can reach your files and keys. Show and review the exact command, require approval, and sandbox the server. Localhost HTTP servers also need protection against DNS rebinding.
What is the confused deputy problem in MCP, and why is token passthrough forbidden?
A confused deputy happens when a trusted component is tricked into using its authority for someone else. With token passthrough, a server forwards a token not issued to it, and the downstream API trusts it as if the server had validated it. Servers must accept only tokens meant for them.
Can MCP resources and tool outputs carry prompt injection?
Yes. Resources are read as data, but the model still reads them, so hidden instructions inside can steer it. Tool return output can do the same during a call. Treat both as untrusted input, just like descriptions.
What does the OWASP MCP Top 10 cover?
It is a beta-stage OWASP incubator project listing ten risks, including token mismanagement, scope creep, tool poisoning, supply chain tampering, command injection, insufficient authentication, lack of audit and telemetry, shadow MCP servers and context over-sharing. Use it as a review checklist.
πŸš€ Where to go next: Move on to tool poisoning and rug pulls in detail, then practise reviewing hostile tool descriptions in the SecurityElites lab.

🧩 More in the MCP Security series

πŸ“š Keep Learning on SecurityElites

Written by Mr Elite. Reviewed by Mr Elite, last reviewed on .

ME
Mr Elite
Owner, SecurityElites
I teach AI red teaming and ethical hacking through hands-on labs at SecurityElites.
⚡
Join free to earn XP for reading this article Track your progress, build streaks and compete on the leaderboard.
Join Free
Lokesh N. Singh aka Mr Elite
Lokesh N. Singh aka Mr Elite
Founder, Securityelites Β· AI Red Team Educator
Founder of Securityelites and creator of the SE-ARTCP credential. Working penetration tester focused on AI red team, prompt injection research, and LLM security education.
About Lokesh ->

Leave a Comment