Key Takeaways
- Indirect prompt injection is ranked the top risk for LLM applications by OWASP (LLM01:2025).
- The UK NCSC and OpenAI both said in December 2025 that prompt injection may never be fully solved.
- In NIST testing, novel attacks raised agent hijacking success on a frontier model from 11% to 81%.
- The last step is usually an authorized API call, so the defense has to sit at the action, not just the prompt.
- OWASP recommends authorization in downstream systems, least privilege and human approval for high-impact actions.
Indirect prompt injection is an attack where malicious instructions hide inside content an AI agent reads, such as an email, document or web page. When the agent can call tools and APIs, that hidden text can trigger a real action. The final request often comes from a valid, authorized session, so traditional security controls treat it as normal.
The AI Agent Security Shift: From Protecting Requests To Protecting Actions
Traditional application security follows a simple flow: request in, response out, with security tools inspecting the traffic.
AI agents break that flow apart. An agent talks to a large language model (LLM), retrieves information, connects to tools and calls APIs. Each connection adds a capability, and each one adds a place where something can go wrong.
That is why security teams are no longer protecting one application. They are protecting a chain of interactions, and every link in that chain can be steered by text the agent reads.
Direct Vs. Indirect Prompt Injection
Prompt injection is LLM01 in the OWASP Top 10 for LLM Applications 2025. It comes in two forms:
The indirect form was first shown at scale by Greshake et al. in Not what you’ve signed up for (ACM AISec 2023). The researchers showed attackers could exploit LLM-integrated apps, including Bing Chat, without any direct access. They simply planted prompts in data the app was likely to retrieve.
The instruction doesn’t even need to be visible. White-on-white text, HTML comments, document metadata and calendar invites are all read by the model. The attack surface is everything the agent can retrieve, not everything the user can see. For the fundamentals, see our Learning Center guide, what is prompt injection.
Why LLMs Can't Separate Instructions From Data
In SQL injection, parameterized queries fixed the problem by putting data in a channel the database never executes. LLMs have no such channel.
The system prompt, the user’s request and any retrieved document are joined into one stream of tokens. Role markers are just more tokens. Whether the model respects them is learned behavior, not an enforced boundary.
The UK National Cyber Security Centre put it plainly in Prompt injection is not SQL injection (December 2025): because there is no inherent distinction between data and instruction, prompt injection “may never be totally mitigated” the way SQL injection can be. OpenAI said the same month that prompt injection is “unlikely to ever be fully ‘solved’.”
Training-based fixes help but stay probabilistic. OpenAI’s Instruction Hierarchy research (Wallace et al., 2024) teaches models to rank system instructions above tool output.
How Indirect Prompt Injection Becomes A Harmful Action
An indirect prompt injection attack on an AI agent usually unfolds in five steps:
- The instruction enters the context. A poisoned email, document or page is pulled into the agent's working memory.
- The agent treats it as a task. The model reads the hidden text as something to follow.
- The agent calls a tool. It reaches for a connected capability, such as email, file storage or payments.
- The tool calls an API. The request goes to a backend system.
- The harmful action happens. Data is exposed, or a system is changed without the intended authorization.
This chain is measurable. In InjecAgent (Zhan et al., ACL Findings 2024), a ReAct-prompted GPT-4 agent was hijacked in 24% of test cases, and a reinforced “hacking prompt” nearly doubled that rate.In January 2025, NIST’s U.S. AI Safety Institute (now CAISI) reported that new attacks raised hijacking success on an upgraded Claude 3.5 Sonnet from 11% to 81%. Repeating each attack 25 times raised average success from 57% to 80%.
A single test run understates the risk. An attacker only needs one success.
A Real-World Example: Echoleak
In 2025, researchers disclosed EchoLeak (CVE-2025-32711) in Microsoft 365 Copilot. According to the academic write-up (Reddy and Gujral, 2025), a single crafted email allowed remote, unauthenticated data exfiltration with zero clicks. The chain bypassed Microsoft’s injection classifier and leaked data through auto-fetched images. Microsoft patched it server-side.
Note the exit route. EchoLeak didn’t need an “exfiltration tool.” Any output a client renders, such as a Markdown image or link, can carry data out in its URL.
How To Defend AI Agents: API Security For The Action Layer
No single control stops prompt injection. The NCSC advises buyers to be wary of anyone who claims otherwise. The aim is to reduce what a successful injection can do.
- Treat everything the agent reads as untrusted. Retrieved documents, emails, web content and tool outputs should be inspected, but never fully trusted.
- Apply the "lethal trifecta" test. Simon Willison warns that an agent with private data, untrusted content and external communication can be tricked into leaking that data. Meta's "Agents Rule of Two" (October 2025) turns this into a rule: allow no more than two of the three in a session without a human in the loop.
- Give agents least privilege. Run tools in the user's context with scoped tokens, and separate read access from write access.
- Enforce policy at the API layer. Check every agent-initiated call against policy, independent of the model. Prophaze WAAP inspects AI and API traffic together so this check happens outside the LLM.
- Tie every action to an identity. Prophaze WAAP can ingest identity provider logs, such as Keycloak, so each detection carries user-level and token-level attribution. Without it, logs can't tell "the user asked for X" from "injected text asked for X."
- Add step-up checks before high-impact actions. Money transfers, data exports and configuration changes should require extra verification. Keep these prompts rare, so users don't learn to click "Always allow."
- Red-team adaptively and repeatedly. NIST's results show one attempt per attack is not a real test.
Seeing Indirect Prompt Injection End To End
Indirect prompt injection is hard to spot because every step looks harmless on its own. The risk only shows when you watch the whole chain, from hidden instruction to authorized API call.
The Prophaze webinar on securing AI agents shows exactly that. It walks through the attack chain and the attacker’s playbook, then runs a live account takeover on a test banking assistant, with Prophaze WAAP off and then on. Watch for where the threat is detected, what control is applied and how the action is handled.
Watch the Prophaze webinar on indirect prompt injection and AI agent security, now on demand Access your recording now.
Frequently Asked Questions (FAQ)
1. Can prompt injection be fully prevented?
No. The UK NCSC and OpenAI both stated in December 2025 that prompt injection may never be fully solved, because LLMs don’t separate instructions from data. Organizations should focus on limiting what an injected agent can do, through least privilege, policy checks on every action and human approval for high-risk steps.
2. What is the difference between prompt injection and jailbreaking?
Jailbreaking is when a user tricks a model into breaking its own safety rules. Prompt injection is when third-party content subverts what the user or developer intended. A jailbreak mainly harms the platform’s policy, while an injection can harm the user and the organization.
3. Can a web application firewall stop indirect prompt injection?
A traditional WAF looks for known attack patterns in requests. An indirect injection usually produces a well-formed API call from an authorized user, so pattern matching alone won’t catch it. Controls that combine AI traffic inspection, identity context and action-level policy cover much more of the chain.
4. What is excessive agency in AI agents?
Excessive agency is OWASP LLM06:2025. It describes AI systems that can take damaging actions because they have too much functionality, too many permissions or too much autonomy. OWASP’s fixes include minimum privileges, authorization in downstream systems and human approval for high-impact actions.
5. How do you detect indirect prompt injection in production?
Look for actions that don’t match the user’s request, such as a summary task followed by an outbound email or data export. Attribute every agent action to a user and token so unusual patterns stand out. Watch rendered outputs, such as links and images, because they can carry data out.