They expand the number of places where untrusted instructions can enter the model’s working context. RAG pulls documents and records into the prompt, while agents convert model output into actions. That means a poisoned document or manipulated API response can shape both what the model says and what it does, which raises the impact from bad answers to unauthorized execution.
How RAG widens the prompt injection attack surface
RAG increases prompt injection risk because it deliberately imports outside content into the model’s context window. That content may be useful, stale, manipulated, or outright malicious, and the model often cannot reliably tell the difference from trusted instruction text. The core problem is not retrieval itself, but the absence of a hard boundary between data and instructions once the content is injected into context.
In practice, the risk grows when retrieval is broad, ranking is weak, or source provenance is unclear. A poisoned document can sit beside the user prompt and steer summarisation, classification, extraction, or policy reasoning. If the retrieval layer also pulls structured records or API responses, the model may inherit instructions hidden in fields that operators expected to be passive data.
RAG systems become easier to manipulate when trust assumptions are implicit. If every retrieved chunk is treated as equally admissible context, an attacker only needs to place malicious text in a source the retriever is willing to index, or alter content that the system treats as authoritative. That is why retrieval hygiene, source scoping, and content filtering matter as much as model prompting.
Why agents turn bad prompts into bad actions
AI agents raise the stakes because they do not just answer from context, they can act on it. Once the model output is wired to tools, APIs, or workflow steps, a successful prompt injection can influence decisions that leave the model boundary and produce external effects. The same instruction that would have caused a bad answer in a chat interface can become a tool call, a data change, or a privileged request in an agentic workflow.
That shift matters because agent systems often reuse context across steps. An injected instruction can persist in memory, shape downstream tool selection, or alter how the agent interprets later user requests. The risk is highest where the agent has standing access, weak approval gates, or broad authority to chain actions across systems without revalidating intent at each step.
Agents also magnify social and operational impact. A deceptive instruction can exploit the model’s tendency to optimise for completion, not safety, especially when the agent is asked to gather data, draft responses, or handle routine automation. In those settings, prompt injection is less like a single bad output and more like an instruction smuggling problem inside delegated execution.
What makes prompt injection especially dangerous in RAG plus agent pipelines
The combination is dangerous because RAG supplies more entry points and agents supply more consequences. A malicious document, page, ticket, email, or API response can influence the model’s reasoning, then the agent can turn that influence into an action. This creates a path from content poisoning to unauthorised execution, including data exfiltration, tool abuse, or requests that look legitimate because they were issued by the agent itself.
The most exposed designs are those that blur the roles of retrieved content, system instructions, and tool output. If a pipeline does not separate instruction sources, the model may treat attacker-written text as higher priority than user intent. If the agent is allowed to browse, execute code, or call business APIs, the blast radius extends beyond hallucination into real-world state change.
That is why prompt injection is best understood as a trust-boundary failure. The attacker is not only trying to mislead the model, but to get the model to trust the wrong source at the wrong moment. In RAG and agent systems, that trust error can propagate through memory, retrieval, tool use, and automation chains.
Risk and Threat Considerations
RAG and agentic workflows create a larger attack surface for indirect prompt injection, especially when external content is indexed, summarised, or replayed into a higher-privilege context. The main risk is not a clever prompt, but the system’s inability to distinguish untrusted content from governing instructions once both are present in the same working context.
Failure mechanism: An attacker plants or manipulates content that the retriever, parser, or agent accepts as context, then uses that content to steer model behaviour or trigger downstream tool calls.
Impact: The result can move from a misleading answer to unauthorised actions, including data disclosure, privilege misuse, workflow corruption, or execution of harmful API and tool operations.
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 ATLAS define the specific risk controls and attack patterns relevant to this topic.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI03 — Identity & Privilege Abuse | Prompt injection can abuse agent identity and delegated authority. |
| ASI02 — Tool Misuse | Injected instructions can steer agents into harmful tool calls. | |
| ASI06 — Memory & Context Poisoning | RAG and injected context can poison model memory and working context. | |
| Recommendation — Enforce per-action authorization and approval for agent tool use. Constrain tools and validate every invocation against policy. Isolate untrusted context and prevent it from persisting as trusted memory. | ||
| MITRE ATLAS | Prompt Injection | Directly covers adversarial prompt injection against AI systems. |
| Recommendation — Map prompt-injection paths and test defenses across the full agent workflow. | ||
Practitioner Guidance
What to verify: Check whether retrieved content, user prompts, system instructions, and tool outputs are separated by policy, not just by formatting. If the pipeline cannot explain which sources can influence actions, it is too permissive for agentic use.
What good looks like: High-risk actions require fresh intent validation, narrow tool scopes, and explicit approval points. Retrieved text should inform the model, not silently inherit instruction authority.
Common mistake: Treating RAG as a content-retrieval problem and agents as a chat extension. Once the model can act, prompt injection becomes an access and control problem, so the safest design is the one that constrains what untrusted context is allowed to change.
Practitioner takeaway: The decisive control is not eliminating retrieval or autonomy, but making sure untrusted context can never become unreviewed authority.
Related resources from NHI Mgmt Group
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 October 11, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org