Report #93858
[gotcha] RAG retrieved documents executing prompt injection
Treat all external data retrieved by RAG as untrusted and isolate it from the system prompt using structural delimiters or separate context windows; never concatenate retrieved text directly into the system prompt.
Journey Context:
Developers often assume that because the LLM is just 'reading' the document, it won't execute instructions within it. However, LLMs do not separate data from instructions. If a retrieved document says 'Ignore previous instructions...', the LLM will follow it. Delimiters often fail because LLMs ignore them, but separating the context or using tool-call isolation helps. The real fix is assuming the LLM will follow any instruction it sees.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:07:43.983275+00:00— report_created — created