An indirect injection attack is when malicious instructions are hidden inside external content that an AI agent retrieves and later trusts. The danger is not the source alone, but the agent treating poisoned data as guidance. This can lead to data exposure, misinformation, or unintended actions.
How Indirect Injection Attacks Work
Indirect injection attacks exploit the gap between where malicious content is placed and where it is later trusted. The attacker hides instructions in external content such as documents, web pages, emails, or retrieved records, then relies on an AI system to ingest that content as if it were ordinary context.
The attack succeeds when retrieval, summarisation, or tool use gives the injected text more authority than it deserves. That makes the problem less about the content source itself and more about the agent’s trust boundary, which is why indirect injection is often described as a second-order attack rather than a simple prompt trick.
Why Indirect Injection Is Dangerous
The danger is that the injected instructions can steer model behaviour without appearing as an obvious command. Once the agent treats poisoned content as guidance, it may reveal sensitive data, produce misleading answers, or take actions the user never intended.
This risk grows when an agent can act across multiple systems, especially when retrieved content is blended with live tools, memory, or downstream automation. In those cases, a single poisoned source can influence later decisions long after the attacker’s content was first encountered.
For defenders, the key issue is not only harmful output. Indirect injection can also alter what the system searches for, what it ignores, and what it forwards to other tools or users, which makes the compromise subtle and hard to spot in normal logs.
Common Attack Paths and Failure Conditions
Indirect injection often enters through content that looks safe to process: a help article, support ticket, synced note, uploaded file, search result, or web page. The injected instructions may be hidden plainly or disguised through formatting, encoded text, or content designed to look like data rather than instructions.
The failure condition is usually a weak separation between retrieved evidence and executable instruction. If the agent cannot reliably distinguish user intent, system policy, and untrusted external text, the attacker can smuggle in higher-priority behaviour through the back door.
In practice, this becomes more dangerous when the system follows retrieved content too literally, allows tool calls based on that content, or fails to constrain what external text can influence. The result is an attack path that looks like normal knowledge retrieval but behaves like covert command injection.
Detection and Response After Exposure
Detection starts with tracing which external content was retrieved, when it was introduced, and whether the agent’s behaviour changed after that retrieval. Security teams should review prompts, retrieval results, tool calls, and downstream outputs together rather than treating them as separate events.
When compromise is suspected, the response focus should be on removing the poisoned content, isolating affected conversations or workspaces, and checking for any follow-on actions taken by the agent. A post-incident review should ask whether the system ingested the malicious material, whether it acted on it, and whether the same source still remains reachable.
Because indirect injection can influence follow-up behaviour, compromise review should also look for secondary effects such as altered summaries, leaked references, unexpected tool usage, or responses that reflect attacker-authored instructions rather than user intent.
Risk and Threat Considerations
Indirect injection matters because the attack abuses trust in retrieved content, not just model output. That makes it especially effective in retrieval-augmented systems and agent workflows where external text is assumed to be informative, safe, or operationally actionable.
Failure mechanism: The system fails when it cannot keep untrusted external content separate from instructions, so the agent elevates poisoned text into decision-making or tool execution.
Impact: The attacker can drive data exposure, misinformation, policy bypass, or unintended action, and the effect may persist into later steps if the injected content is stored or re-used.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST AI RMF, OWASP ASVS and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI01 — Agent Goal Hijack | Indirect injection can redirect an agent’s goal through poisoned external content. |
| Recommendation — Treat retrieved content as untrusted input and gate high-impact actions against goal hijack. | ||
| MITRE ATT&CK | T1059 — Command and Scripting Interpreter | Injected instructions can lead to malicious command execution through trusted automation paths. |
| Recommendation — Hunt for instruction-driven execution and constrain script or command handling paths. | ||
| NIST AI RMF | GV.1 — Governance | Indirect injection requires governance over how AI systems use external content and tools. |
| Recommendation — Define oversight for untrusted retrieval, action approval, and escalation handling in AI workflows. | ||
| OWASP ASVS | V15 — Secure Coding and Architecture | The term centers on architectural separation between untrusted content and executable instructions. |
| Recommendation — Design strong trust boundaries so external content cannot directly influence execution paths. | ||
| NIST CSF 2.0 | PR.DS-10 — Integrity Verification | Integrity checks help ensure retrieved content has not been altered or poisoned before use. |
| Recommendation — Verify content integrity before it is accepted into downstream AI decision flows. | ||
Practitioner Guidance
Why practitioners should care: Indirect injection is a design problem as much as a content problem, so the safest response is to limit how much retrieved material can influence goals, tools, and actions. Systems that treat all retrieved text as equally trustworthy are much easier to steer.
What to watch for: Pay attention to workflows where the agent reads external text and then acts without clear instruction hierarchy, especially when those workflows involve search, email, document ingestion, or delegated actions. If the system cannot explain why a piece of content should be treated as evidence rather than instruction, the boundary is too weak.
Related resources from NHI Mgmt Group
- Guide: Deepfake-Resistant Identity Verification Guide
- How should security teams reduce indirect prompt injection risk in AI systems?
- When does indirect prompt injection become a business risk rather than a technical curiosity?
- Why is indirect prompt injection harder to defend than XSS?
- What is the difference between prompt injection and indirect prompt injection?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 5, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org