← All cybersecurity posts

MCP Server Security: The Vulnerability Classes Putting AI Agents at Risk

The Model Context Protocol (MCP) has become the connective tissue of the agentic AI stack in under two years. It is the thing that lets an AI agent read your calendar, query your database, push to your repo, and book your flights — all through a standardized tool-calling interface. That standardization is exactly why it has also become the fastest-growing attack surface in enterprise AI.

A June 2026 IETF Internet-Draft on MCP security considerations, backed by an NSA cybersecurity advisory published the same month, laid out the vulnerability classes that keep showing up across real, deployed MCP implementations. None of them are exotic. They're the same bug classes security teams have fought for twenty years — SSRF, path traversal, missing auth — except now they're reachable not just by a human typing a URL, but by an LLM that can be talked into typing it for you.

If your organization has shipped even one MCP server internally, or connected Claude, ChatGPT, or an agent framework to third-party MCP tools, this is the threat model you're now operating under.

Why MCP is a different kind of attack surface

Traditional APIs have a human (or a tightly-scoped script) deciding what request to make. MCP servers are designed to be driven by a language model interpreting natural-language instructions — including instructions that arrive embedded in untrusted content the model reads along the way: a ticket description, a webpage, a file, an email.

That inversion matters. The MCP specification itself does not include normative security requirements — it defines the protocol, not the trust boundary. Every implementor is left to decide, often under deadline pressure, how much to validate inputs that an LLM assembled from a mix of system instructions and whatever text it was told to process.

Independent research projects like MCPTox have reported high attack-success rates against production MCP servers using controlled test fixtures that model these exact vulnerability classes. This isn't theoretical. It's measured.

The five vulnerability classes to pentest first

1. Server-Side Request Forgery (SSRF)

Any MCP tool that accepts a URL parameter and passes it to an HTTP client without validating the resolved IP address is a candidate for SSRF. An adversarial prompt — something as simple as "fetch this page and summarize it" where the page is attacker-controlled — can cause the tool to instead request:

  • Cloud instance metadata endpoints (169.254.169.254), which on many cloud providers hand back live IAM credentials.
  • Loopback services bound to 127.0.0.1 that were never meant to be internet-reachable.
  • Internal network services the MCP server's host can reach but the model's operator never intended to expose.

The mitigation most teams reach for first — blocklisting the literal metadata IP — fails against two well-known bypasses. DNS rebinding resolves a hostname to a public address during validation and to a restricted address at actual connection time. Redirect chains let an allowed URL return a 3xx that lands on a restricted destination. The IETF draft is explicit: validation must happen at connection time, not parse time, specifically to resist rebinding. A real-world instance of this exact flaw was discussed in a public GitHub issue against the microsoft/playwright-mcp server — a browser-automation MCP tool whose SSRF exposure was especially serious because it runs with access to a local browser profile and session cookies.

2. Excessive tool permissions

MCP filesystem and shell tools routinely expose far more surface than their documented function requires. A tool meant to "read the project README" frequently has the technical capability to read any file the host process can access — because scoping that down takes extra engineering effort that ships-fast teams skip. An adversarial prompt that convinces the model it needs ~/.ssh/id_rsa "to verify deployment config" doesn't need to exploit a bug. It just needs the tool to have never been scoped in the first place.

3. Prompt injection surface exposure

MCP tools that pull in content from external sources — a webpage, a Jira ticket, a Slack message, a PDF — and hand it to the model without sanitization create a direct instruction-injection channel. Palo Alto Networks' AI security team has documented the common failure mode plainly: a ticket lookup returns details from a security-tagged issue, and most MCP implementations treat that returned content as trusted by default. The agent ingests it without inspection, and it can end up driving subsequent tool calls, leaking into conversation logs, or surfacing to users who were never meant to see it. The NSA's 2026 advisory documented real-world cases of exactly this — tool parameter injection in open-source MCP agents, where a lack of contextual validation and logging let attackers use legitimate interfaces to run arbitrary commands.

4. MCP lifecycle bypass

Some implementations will answer a tools/list request before the initialize handshake has actually completed. Access-control logic that's supposed to run during initialization — checking who's connecting, what scope they're entitled to — gets skipped entirely if the server is willing to hand over its tool catalog, and sometimes execute calls, before that handshake finishes. This is a protocol-conformance bug with a security consequence, and it's exactly the kind of thing automated conformance testing catches and manual code review misses.

5. Authentication enforcement gaps

Some MCP servers simply answer tool calls without verifying authentication at all — a gap that's especially serious when the exposed tool can execute code or touch the filesystem. Security researchers at OX Security went further in 2025–2026, disclosing a flaw where pasting any command — not even a valid MCP STDIO server invocation — into a local MCP interface would still execute, because the interface never validated that the incoming command was actually starting an MCP server versus running arbitrary code. OX's assessment was blunt: the flaw enables arbitrary command execution on any system running the vulnerable implementation, with direct access to sensitive user data, internal databases, API keys, and chat history. Anthropic was notified in January 2026; as of the OWASP Global AppSec writeup on the issue, the underlying design flaw had not been fixed, even though at least ten associated CVEs were issued against other software that uses MCP locally.

What to actually do about it

Security teams adopting MCP — whether building servers or consuming third-party ones — should treat this the same way they'd treat any new authenticated API surface, with a few MCP-specific additions:

  • Treat every tool parameter as untrusted, full stop. That includes parameters an LLM generated itself, not just ones a human typed.
  • Validate resolved IP addresses at connection time, not at parse time, for any tool that makes outbound requests. This is the only reliable SSRF/DNS-rebinding mitigation.
  • Scope filesystem and shell tools to the narrowest path and command set the documented function actually needs. Don't give a README-reader access to the home directory.
  • Sanitize or clearly demarcate externally-sourced content before it reaches the model, so injected instructions in a ticket or webpage can't silently become instructions the agent follows.
  • Enforce the full initialize handshake before answering any tool call, including tools/list.
  • Run MCP servers in a sandbox with least-privilege credentials, as OX Security recommends, and source MCP tools only from vetted, official repositories.
  • Monitor and log every tool invocation, including the parameters the model generated, so injection and excessive-permission abuse are visible after the fact even if they weren't caught beforehand.

The uncomfortable truth is that MCP didn't introduce new bug classes. It introduced a new, highly automatable way of triggering old ones, at a scale and speed that outpaces manual review. Pentesting an MCP deployment the way you'd pentest a REST API — treating the model as just another untrusted client — is the fastest way to find out which of these five classes you're exposed to before someone else does.

Frequently asked questions

Is MCP itself insecure, or is this an implementation problem? Both, in a sense. The MCP specification deliberately doesn't mandate security controls — it's a protocol, not a security framework — which means the burden falls entirely on implementors. That gap is why the same five vulnerability classes keep recurring across unrelated MCP servers built by different teams.

Does using a well-known MCP server (like an official Anthropic or Microsoft one) mean I'm safe? No. The microsoft/playwright-mcp SSRF issue and the Anthropic-notified local command execution flaw both involve mainstream, widely-used tooling. Provenance reduces risk but doesn't eliminate it — treat every MCP server as untrusted code running with real privileges until you've reviewed it.

What's the single highest-impact fix for a team running MCP servers today? Scoping tool permissions down to the minimum the documented function needs, combined with connection-time IP validation on any tool that makes outbound requests. Those two changes close the most commonly exploited paths (excessive permissions and SSRF) without requiring a protocol redesign.

How does prompt injection actually turn into a security incident through MCP? An MCP tool fetches external content — a webpage, ticket, or document — and passes it to the model as context. If that content contains text crafted to look like an instruction, and the model isn't trained or constrained to distinguish data from commands, the model can be induced to call other tools (send data, modify records, escalate privileges) based on content an attacker controlled, not on anything the legitimate user asked for.

Should organizations sandbox every MCP server, even internal ones? Yes. Internal MCP servers often get less scrutiny than external ones precisely because they're "internal," but they typically have the deepest access — to source code, databases, and deployment credentials. Sandboxing with least-privilege credentials limits blast radius regardless of where the server was built.

Find what attackers can see, before they do.

AI pentesting agents test your web app, API and cloud, and every finding comes with evidence and a fix. First report in about 10 minutes.

Stay ahead of attackers.

New vulnerabilities, breach write-ups and practical fixes. A few emails a month.