RAG security

RAG security is about protecting retrieval-augmented generation (RAG), where a model answers from documents fetched at query time. The main risks are injected instructions, leaked documents and poisoned indexes.

The risks

In RAG, a retriever finds documents for each question and puts them in the model's prompt. That path can fail in these ways:

  • Injected documents. A document carries instructions, and once it is retrieved the model may follow them. This is indirect prompt injection.
  • Leaked documents. The retriever returns a file the asking user may not see, and the model quotes it. See data leakage.
  • Poisoned indexes. Someone who can write to an indexed source plants false or hostile text, so that it is retrieved for the questions they choose.

The 2026 OWASP Top 10 for LLM applications lists weaknesses in retrieval as LLM09, Vector and Embedding Weaknesses.

Controls

  • Check access at retrieval. Filter by the user's permissions before a document enters the prompt, not after the answer is written.
  • Guard the index. Limit who can write to indexed sources, and record where each passage came from.
  • Scan retrieved text. Look for instructions before the model reads it.
  • Check outputs. Look for confidential data and unsupported claims before the user sees them.

With White Circle

Control works with RAG systems and checks every input and output against your policies in real time. Its coverage includes prompt injection, leaks of confidential or cross-session data, and hallucinations.

Train your own models

Post-train any Hugging Face model with Halo. Up to 4× faster than TRL