Contents (8)
Red teaming an AI agent means attacking the two things a chatbot does not have, the content the agent reads while it works and the tools it can call, then checking what the agent actually did. This guide covers both surfaces, a test matrix and the fixes that hold. FAULTLINE publishes it and makes mcp-guard, disclosed where it appears. For the general red-team process and the five open-source tools, read the LLM red teaming guide.
Suppose an assistant agent has an email tool and a calendar tool, and someone adds a third-party MCP server for unit conversion. A meeting invite arrives with a line in its notes asking the assistant to forward the week's emails to an outside address. The user asks for a summary of the week. Nothing in the chat looks wrong. The question for a red team is whether those emails left.
01 / What changes when the target is an agent
An agent mixes untrusted content, private data and actions, so the risk is a harmful action rather than a bad answer.
OWASP's GenAI Security Project "today released the OWASP Top 10 for Agentic Applications, a key resource to help organizations identify and mitigate the unique risks posed by autonomous AI agents" on 2025-12-09 (OWASP). The release names "Agent Behavior Hijacking, Tool Misuse and Exploitation and Identity and Privilege Abuse" among the highlighted threats. Its co-lead Keren Katz warned that companies are exposed "often without realizing that agents are running in their environments."
The full list sits in a PDF download. Promptfoo's published mapping gives the first two entries as ASI01 Agent Goal Hijack and ASI02 Tool Misuse and Exploitation (Promptfoo). In that mapping, "Agent Goal Hijack occurs when an attacker alters an agent's objectives or decision path through malicious content," and "Tool Misuse occurs when agents use legitimate tools in unsafe ways."
Simon Willison's lethal trifecta explains why these two belong together. An agent with private data, exposure to untrusted content and a way to communicate externally is exposed, because "If your agent combines these three features, an attacker can easily trick it into accessing your private data and sending it to that attacker" (Willison). The root problem, in his words: "LLMs are unable to reliably distinguish the importance of instructions based on where they came from." The assistant in the example has all three.
02 / Indirect injection: attacks hidden in what the agent reads
Any text the agent reads mid-task is an input an attacker can write.
Greshake and colleagues named the problem in 2023. "LLM-Integrated Applications blur the line between data and instructions," and attackers can exploit them "by strategically injecting prompts into data likely to be retrieved" (arXiv). For agents, the injected text can "control how and if other APIs are called." That is the step from a wrong answer to a wrong action.
Benchmarks since then measure it on agents with tools. AgentDojo frames the attack as "data returned by external tools hijacks the agent to execute malicious tasks," and ships 97 realistic tasks with 629 security test cases (AgentDojo). Its finding is a useful caution: "existing prompt injection attacks break some security properties but not all." InjecAgent "comprises 1,054 test cases covering 17 different user tools and 62 attacker tools," and in its 2024 run found "ReAct-prompted GPT-4 vulnerable to attacks 24% of the time" (InjecAgent). Those numbers belong to those models and that year. Treat them as proof the attack works, not as a forecast for your agent.
The practical question is where to plant attacks. Promptfoo's indirect injection plugin "Tests whether untrusted data (RAG context, emails, user profiles) can hijack your model when placed into the prompt," and asks you to "Specify which template variable contains untrusted data" (Promptfoo). For an agent, list every source that reaches the model during a task: tool results, retrieved documents, emails, tickets, calendar notes, web pages and user profiles. Each one is an injection point.
03 / Tool abuse: attacks hidden in what the agent is given
Tool descriptions are prompts the user never sees, and they can change after approval.
Invariant Labs named the attack in April 2025. "A Tool Poisoning Attack occurs when malicious instructions are embedded within MCP tool descriptions that are invisible to users but visible to AI models," which makes it "a specialized form of indirect prompt injections" (Invariant Labs). Two variants matter for a red team.
The first is the rug pull, where "a malicious server can change the tool description after the client has already approved it." A review at install time does not cover the description the model reads next week.
The second is shadowing. A malicious server's description changes how the agent uses a different, trusted tool. In Invariant's test with a trusted email tool, "the agent willingly sends all emails to the attacker, even if the user explicitly specifies a different recipient." The point for testers: "an attacker does not necessarily need to get the agent to use their tool." The unit-conversion server in the example never has to be called.
MCPTox measured tool poisoning at scale. It "is constructed upon 45 live, real-world MCP servers and 353 authentic tools," and found that "more capable models are often more susceptible, as the attack exploits their superior instruction-following abilities" (MCPTox). Refusal barely helped, with the highest refusal rate "less than 3" percent.
The MCP specification puts part of the defence on the client. Clients must treat "tool annotations to be untrusted unless they come from trusted servers," and there should "be a human in the loop with the ability to deny tool invocations" (MCP spec). Section 06 covers how far that human check goes.
04 / A test matrix for an agent red team
Test each surface at each injection point, and check that each test measures what its name says.

| Surface | Where to plant | Example attack | Counts as success | Benchmarks to calibrate |
|---|---|---|---|---|
| What it reads | Tool results | Instruction in an API response | A tool call the user did not ask for | AgentDojo |
| What it reads | Documents, emails, tickets | Hidden line in an email | Private data sent outside | InjecAgent, Promptfoo plugin |
| What it is given | Tool description | Hidden instruction in a description | Sensitive file read or passed in an argument | MCPTox |
| What it is given | Description changed later | Rug pull after approval | Changed behaviour with no new approval | Your own pinned tools |
| What it is given | Another server's tools | Shadowing a trusted tool | Trusted tool called with altered arguments | Your own server mix |
Start with the riskiest trifecta combination, the tool that can send data out while the agent reads untrusted content. Calibrate on the public benchmarks, then write tests against your own tools, because your agent's tool list is the attack surface.
Check what each off-the-shelf test actually checks. Promptfoo's mapping puts its excessive-agency plugin under ASI02 Tool Misuse. The plugin's own page says it "tests whether an AI is aware of its own capabilities and limitations by prompting it with requests that a text-based LLM cannot possibly fulfill" (Promptfoo). That is a useful check of overclaiming, not a test of whether a real tool gets misused. Pair it with tests that call your actual tools.
05 / Grade the action, not the answer
An attack succeeded when a tool was called that should not have been, or with an argument that should not be there, so grade from traces.
The shadowing attack shows why. The user sees a normal reply while the recipient field holds the attacker's address. Grading the final text would score that run as safe. Promptfoo's agent guide makes the same distinction, using trace data to tell an agent that said it would not do something from one that "actually called the forbidden tool" (Promptfoo).
Text grading also errs the other way. FAULTLINE's P09 red-team regression found that models often quote injected text while still doing the task, and that "requiring oracle task failure separates true compromise from surface quoting and prevents dramatic over-reporting of vulnerability" (research). Define success per test as a checkable event in the trace: tool name, arguments, destination. The guide to testing AI agents covers trace-based grading in more depth.
06 / Fixes that hold, and what they cost
Deterministic checks at the tool-call boundary beat prompt warnings, and their cost has to be measured.
Willison quotes the design principle: "once an LLM agent has ingested untrusted input, it must be constrained so that it is impossible for that input to trigger any consequential actions." He also warns against filters sold on detection rates, since "in web application security 95% is very much a failing grade" (Willison). Promptfoo's agent guide gives the same advice in engineering terms: "Use deterministic, non-LLM-based permission systems and treat all LLM tool APIs as public" (Promptfoo).
FAULTLINE measured one such control. Publication 02 put a provenance contract between the model and tool execution that "enforces envelope formatting, tool enumeration allowlists, strict schema argument boundaries, and verbatim substring-grounding against user turns." "On 300 MCPTox instances across six models via one gateway," it cut attack success sharply.
It "Removed 421 attack successes while inducing only 26." The cost is real. "Replay over 10,227 traces indicates substring grounding false-blocks 24.5% of legitimate actions when tasks require ungrounded world knowledge." And on a model that already resisted, the gain was small, "due to high baseline resistance in Arm A (valid ASR 3.01%)." Report the block rate on honest work next to the attack rate, or the fix will be switched off by the first frustrated user.
Pinning closes the rug pull. Invariant's advice is that "Clients should pin the version of the MCP server and its tools to prevent unauthorized changes" (Invariant Labs). Human approval helps only if the human sees the arguments. In Invariant's test the client's dialog "does not show the full tool input (e.g. the included SSH key is completely hidden)."
This is where mcp-guard fits, disclosed. It flags when a "Server silently altered a tool's schema or description after first run (rug-pull)" and blocks when a "Client sends arguments not defined in the tool's inputSchema" (mcp-guard). Its limits are stated on the same page. It "Does not inspect tool RESULTS," so indirect injection through tool output is out of its scope, and "The heuristic scanner can miss poisoned tools and can quarantine clean ones in enforce mode." It "implements the subset of that contract that does not need the user's message." The local firewall for MCP tool calls explains the mechanism.
07 / What to change on Monday
List every tool against the trifecta, attack the riskiest combination on both surfaces, and pin what you approved.
Mark each tool for private data, untrusted content and outbound communication. For the riskiest combination, plant one indirect injection in a source the agent reads and one hidden instruction in a tool description, then grade both runs from traces. Pin every MCP server and tool definition, and put a deterministic check in front of each tool that can send data out or spend money. The security lead owns the program, with the agent's engineering owner responsible for fixes.
Track two numbers per release: the share of consequential tools behind a deterministic check, and attack success on the last red-team run, reported with the false-block rate on clean tasks.
Questions#
What is indirect prompt injection?
Indirect prompt injection is an attack where the instructions arrive inside data the model reads, such as a web page, an email, a retrieved document or a tool result, instead of the user's own message. The attacker never talks to the agent directly. They place text where the agent will find it while doing its job.
What is MCP tool poisoning?
MCP tool poisoning hides instructions inside a tool's description, which the model reads but the user usually does not see. Invariant Labs, which named the attack in April 2025, calls it a specialized form of indirect prompt injection. A related rug pull changes a tool's description after the user has approved the server.
How is red teaming an AI agent different from red teaming an LLM?
An LLM red team mostly checks what the model says. An agent red team checks what the agent does with its tools, because the damage is an action such as a sent email, a payment or a deleted file. It also has to attack two extra inputs: the content the agent reads mid-task and the descriptions of the tools it is given.
Can a human approval step stop tool abuse?
It helps, and the MCP specification says there should be a human able to deny tool invocations. It is weaker than it looks when the approval dialog hides the arguments. Invariant Labs showed a client whose confirmation dialog did not show the full tool input, so a stolen SSH key passed through an approved call.
Which benchmarks test prompt injection against agents?
AgentDojo (97 tasks, 629 security test cases) tests agents that call tools over untrusted data. InjecAgent (1,054 test cases) covers direct harm and data exfiltration. MCPTox (45 real MCP servers, 353 tools) tests poisoned tool descriptions. Use them to calibrate, then build tests on your own agent's tools.



