Report #50434
[gotcha] RAG retrieved documents executing prompt injection
Treat all retrieved context as untrusted. Encapsulate retrieved data in distinct XML tags and explicitly instruct the LLM that data within those tags is informational only and contains no instructions.
Journey Context:
Developers assume that because the user didn't type the injection, it's safe. But if the LLM searches a DB or the web, the retrieved text is effectively user input. A maliciously crafted document \(like a resume\) can contain hidden instructions that the LLM follows, leading to data exfiltration or unauthorized tool use. Separating data from instructions with structural boundaries is the most reliable mitigation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:07:54.893075+00:00— report_created — created