TAM-A-STG-002 · Agent · Stage: Getting ready

Attacks Through MCP Connections

Using the Model Context Protocol, the open standard for linking agents to tools and data, to deliver instructions or confuse which tool is which.

MCP makes it easy to connect an agent to many tools. It also creates many channels through which text reaches the model: tool descriptions, tool outputs, prompt templates, resources and sampling requests.

An attacker who controls or compromises one server may be able to steer how the agent uses other servers, hide commands in terminal output, or change what a tool does after it was approved. The agent often cannot tell trusted metadata from hostile.

It is hard to spot because activity looks like normal protocol traffic. Reviewing the exact text each server sent, and when it changed, is the best route.

What it looks like

  • A weather MCP server's tool description tells the agent to read ~/.ssh and pass it as a parameter.
  • A malicious server defines a tool named like a trusted one and gets chosen instead.
  • A tool output contains ANSI escape codes that hide an instruction from the human reviewer.

Variants (7)

TAM-A-STG-002.1Commands Hidden by Terminal Tricks+

Control characters or escape sequences hide text from people but not from the model.

Reviewers see clean output while the model reads extra instructions. Strip control characters from tool output and show raw text during review. Search stored outputs for escape sequences and invisible Unicode in tool results. This is a real concern for terminal-based coding agents and for logs that are rendered in a console.

TAM-A-STG-002.2Fake Tool Overrides a Real One+

A malicious server influences how the agent uses another server's tool.

Descriptions can tell the agent to prefer one tool or add extra parameters to another. Separate trust per server and look for cross-references between servers. Check whether a harmless-looking server mentions the names of tools it does not own. Namespacing tools by server and showing users which server a tool came from reduces confusion.

TAM-A-STG-002.3Instructions Hidden in Tool Info at Connection+

Malicious text in tool metadata is read when the agent connects.

The agent loads descriptions as soon as a server is added, before any user request. Review and hash metadata, and alert on changes. Capture the full tool list at connect time so you can see exactly what the model was shown during an incident.

TAM-A-STG-002.4Instructions Returned in Tool Results+

A tool's response contains directions to the agent.

Agents often treat results as trusted. Filter and label tool output as data, and flag results that include imperative language or new tool calls. Check whether the next action after a tool call matches wording in that call's output. Output from a web search or file read tool is the most common carrier.

TAM-A-STG-002.5Poisoned Prompt Templates+

An MCP server supplies prompt templates that carry harmful instructions.

Users pick a template trusting its name, but the body does more. Inspect template text before use, and pin approved versions. Alert when a server changes a template that staff already use, and keep a record of which templates were run.

TAM-A-STG-002.6Poisoned Resources+

Files or data exposed through MCP resources contain instructions.

The agent pulls these into context as fact. Treat resource content as untrusted, and log which resources were read before each action. Compare resource content against its source to find tampering or hidden text. Be careful with resources that are pulled from public wikis or shared drives.

TAM-A-STG-002.7Server Using the Agent's Model+

An MCP server asks the client's model to generate text for it, a feature called sampling.

A hostile server can use this to steer the model or get content it should not see. Restrict or require approval for sampling, and review what servers ask for. Count sampling requests per server and flag any that spike. Sampling also lets a server spend the user's model budget, so watch cost too.

Detections (7)

Controls (5)