AI security · 5 min read

MCP security: how AI agents get hijacked.

The Model Context Protocol lets AI agents plug into tools and data, from code repositories to inboxes. It also gives attackers new ways in. Here are the attacks seen in the real world so far, why they work, and how to use MCP safely.

Key points
  • MCP is the open standard that connects AI apps to tools and data. Anthropic introduced it in November 2024 and gave it to the Linux Foundation’s Agentic AI Foundation in December 2025.
  • Attacks seen so far include poisoned tool descriptions, instructions hidden in issues and emails, fake or hijacked MCP packages, and bugs in MCP clients.
  • The root problem is that anything the model reads can steer it, and agents act with the user’s access.
  • The danger peaks when one agent has private data, reads untrusted content and can send data out: the “lethal trifecta”.
  • Safe MCP use means vetting and pinning servers, least-privilege tokens, human approval for risky calls, and logging every tool call.

What MCP is, in one minute

The Model Context Protocol (MCP) is an open standard for connecting AI applications to the outside world. An AI app, the host, such as a chat app, a code editor or a custom agent, contains an MCP client. It connects to MCP servers, each of which offers tools (“create issue”, “send email”, “run query”) and data. The model reads each tool’s name and description and decides when to call it.

Anthropic introduced MCP in November 2024. By December 2025, when it was donated to the new Agentic AI Foundation under the Linux Foundation, the project reported more than 10,000 active servers and 97 million monthly SDK downloads, with support in the major AI assistants and coding tools (MCP blog).

That success is exactly why it matters for security. MCP turns an AI that can only talk into an agent that can act, and every server you connect widens what an attacker can make it do.

Where the attacks happen

How an AI app connects to tools through MCP servers, and five places attacks happen: poisoned tool descriptions, instructions hidden in content the agent reads, rug pulls and fake servers, bugs in clients and local helpers, and tokens with too much access. AI APP · THE HOSTChat app, IDE or agentwith an MCP client inside.The model decides whichtools to call.MCP SERVERCode hostRepos, issues, pull requestsPrivate repositoriesMCP SERVEREmailRead and send mailYour inboxMCP SERVERDatabaseCustomer recordsPersonal dataUNTRUSTED CONTENTissues, emails, web pages, files123451Poisoned tool descriptionsHidden orders inside a tool’s description,read by the model, not the user.2Instructions in contentAn issue, email or page the agent readstells it what to do next.3Rug pulls and fake serversA server changes after approval, or alook-alike package steals data.4Client and local bugsFlaws in MCP clients or helpers that runcode on your machine.5Too much accessTokens that reach every repo, mailbox ortable, not just the one needed.
A simplified map. The model in the host decides which tools to call, so anything that can put words in front of it, from a tool description to a GitHub issue, can steer it.

Real cases from 2025

1. Tool poisoning

In April 2025, Invariant Labs showed that an MCP server can hide instructions inside a tool’s description. Users typically see a short summary; the model reads the whole thing. A harmless-looking “add two numbers” tool told the model to read the user’s SSH keys and configuration files and pass them along, while explaining its actions innocently. The same research described rug pulls, where a server changes a tool’s description after the user approved it, and shadowing, where one server’s description changes how the agent uses another, trusted server (Invariant Labs).

2. A toxic agent flow through GitHub

In May 2025, Invariant Labs showed an attack on the official GitHub MCP server. An attacker opened an issue in a victim’s public repository containing hidden instructions. When the victim asked their agent to look at open issues, the agent read the instructions, pulled data from the victim’s private repositories and published it in a pull request on the public one. No tool was broken; the agent was simply steered by content it read. The researchers noted that many users click “always allow” on tool confirmations, which removes the last check (Invariant Labs).

3. Client bugs that run code

In July 2025, JFrog disclosed CVE-2025-6514 in mcp-remote, a widely used helper that connects local AI apps to remote MCP servers. A malicious server could send a crafted authorisation address that ran a command on the user’s computer. JFrog rated it 9.6 out of 10 (JFrog).

4. A fake server that stole email

In September 2025, Koi Security found an unofficial npm package called postmark-mcp, a copy of a legitimate email server. After 15 clean versions, version 1.0.16 quietly copied every email it sent to an outside address. It had been downloaded about 1,500 times before it was removed (BleepingComputer). It was widely described as the first malicious MCP server found in the wild.

Why these attacks work

Every case comes back to two facts. First, anything the model reads can steer it: tool descriptions, issue text, emails and web pages all land in the same context as the user’s request. That is prompt injection, with tools attached. Second, agents act with the user’s access. If the token behind a server can reach every repository or mailbox, so can anyone who steers the agent.

The lethal trifecta for AI agents: access to private data, exposure to untrusted content, and a way to send data out. Where all three overlap, an attacker can make the agent steal data. PRIVATE DATATools that can readyour files, mail or recordsUNTRUSTED CONTENTText or images anattacker can controlA WAY OUTAny tool that can senddata outsideDATA THEFTAny two are manageable.All three together is howagents leak data.
The “lethal trifecta”, a term coined by Simon Willison in June 2025. Removing any one of the three breaks the chain.

Developer Simon Willison calls the dangerous combination the lethal trifecta: an agent with access to private data, exposure to untrusted content, and a way to send data out (June 2025). MCP makes it easy to assemble all three by accident: connect a mail server, a browser and a code host to one agent, and you have it.

A checklist for safe MCP use

  1. Inventory every server. Know which MCP servers each team and each agent uses. Unapproved servers on developer laptops are the new shadow IT; see shadow AI discovery.
  2. Prefer official servers and pin versions. Install from the publisher, pin exact versions, and review changes before updating, so a rug pull or hijacked package cannot slip in.
  3. Read the full tool descriptions. Not the summary. Anything that tells the model to read unrelated files, hide its actions or call other tools is a red flag.
  4. Use least-privilege tokens. One repository, one mailbox, read-only where possible. Never connect an agent with an administrator token.
  5. Break the trifecta. Avoid giving one agent private data, untrusted content and a way out at the same time. Split tasks across agents with different access.
  6. Keep humans in the loop for risky calls. Sending, deleting, paying and publishing should need confirmation showing the full action. Resist “always allow”.
  7. Patch clients and helpers. MCP clients and connectors are software too, with their own vulnerabilities.
  8. Log every tool call. Record which tool was called, with what input, for which user, so you can spot abuse and investigate it.

These map directly onto OWASP’s agentic risks: agent goal hijack (ASI01), tool misuse (ASI02), identity and privilege abuse (ASI03) and the agentic supply chain (ASI04).

How to test an MCP setup

An MCP security test looks at the whole chain: the servers and their descriptions, the tokens behind them, the content agents will read, and what a hijacked agent could reach. It plants instructions in issues, emails and documents, tries to chain tools together into data theft, and checks whether confirmations, logs and limits actually stop it. Our AI agent and MCP testing covers both OWASP lists and gives you transcripts of every successful chain.

Questions

Questions buyers ask before they call us.

Q01Is MCP itself insecure?
MCP is a protocol for connecting AI to tools; most risks come from how it is used. Untrusted servers, over-powerful tokens and agents that read untrusted content while holding private data are what turn it into an attack path. The specification includes security guidance, and it keeps evolving.
Q02What is tool poisoning?
Hiding instructions inside the description of an MCP tool. The user sees a short summary, but the model reads the full text and may follow the hidden instructions, such as reading private files and sending them elsewhere.
Q03Are official MCP servers safe to use?
Safer than unknown ones, but not automatically safe. The GitHub case in 2025 used an official server: the attack came through content the agent read. Official servers still need least-privilege tokens, human confirmation for risky actions and logging.
Q04How do we find out which MCP servers our developers use?
Check AI assistant and code editor configurations on developer machines, review package installs, and watch network traffic for connections to remote MCP servers. Then agree an approved list.
Request a quote

Scope it in two minutes.

Tell us what you need protected. A security engineer, not a salesperson, replies with a fixed-price proposal.

  • Reply within one business day
  • Free 30-minute scoping call
  • Mutual NDA before any detail is shared
  • Fixed price, free retest of fixed findings