What is RAG poisoning?
RAG poisoning is an attack that adds misleading, false or instruction-laden documents to a RAG system's knowledge base, or alters existing ones, so the system gives the attacker's chosen answer to certain questions.
It differs from training data poisoning in stage: data poisoning corrupts model weights during training, while RAG poisoning leaves the model untouched and works through retrieved context, sometimes as easily as adding one document. If the poisoned document carries hidden instructions, the attack is also indirect prompt injection.
- Topic
- AI security
- Also known as
- Knowledge base poisoning, knowledge poisoning
How RAG poisoning works
- The attacker places a document crafted to match a target question in an indexed source, such as a shared drive, wiki page or incoming email.
- The ingestion pipeline chunks and indexes it like any other.
- When the target question is asked, the poisoned chunk ranks high thanks to strong similarity.
- The model treats it as trusted context, carrying the false information into its answer or following its instruction.
In more detail
Adversarial optimisation in embedding space and hybrid protection
Modern RAG poisoning attacks do not rely solely on keyword matching; attackers craft adversarial text or suffixes optimised to score high cosine similarity against target queries in dense embedding spaces (as shown in PoisonedRAG). Combining sparse (BM25) and dense hybrid retrieval with anomaly-aware reranking reduces single-encoder manipulation.
Access control in the vector database and blast-radius isolation
If document-level access controls (ACLs) are not enforced inside the vector index, a low-privilege user can poison a shared folder and influence queries made by executives or security teams. Enforcing identity-aware filtering before generation and isolating external or unverified feeds in separate collections limits the blast radius.
Ingestion quarantine, cryptographic integrity and agentic RAG risk
Enterprise ingestion pipelines should treat new documents like software artefacts: compute cryptographic hashes, scan text for hidden prompt-injection patterns or abnormal perplexity and route unverified edits through a quarantine queue. In agentic RAG, poisoned chunks can trigger unauthorised tool calls, so retrieved content must never directly unlock state-changing actions without confirmation.
Commonly confused terms
| Term | How it differs |
|---|---|
| AI data poisoning | RAG poisoning corrupts the external retrieval corpus without touching model weights, whereas training data poisoning alters pre-training or fine-tuning datasets to embed backdoors or biases directly into the model parameters. |
| Direct prompt injection | RAG poisoning is a persistence/supply-chain attack on the indexed corpus (often via indirect prompt injection), whereas direct prompt injection happens solely in the user's runtime input without modifying the knowledge base. |
| Knowledge rot and stale data | RAG poisoning is deliberate adversarial manipulation of the corpus, whereas knowledge rot (stale or conflicting documents) is unintentional degradation caused by outdated versions remaining indexed. |
Why RAG poisoning matters for on-premises AI
In-house RAG knowledge bases are often fed by sources many people can write to, easing attacks by insiders or compromised accounts. Defences include limiting ingested sources and write rights, storing each chunk's source, author and date, monitoring new or changed documents, citing sources in answers and answering critical topics only from approved document sets. Instruction-like text in retrieved chunks is marked as data for the model.
An energy company's internal assistant ingests only procedures approved in its document management system; files in shared folders never reach the index, while every answer shows the source version.
Common questions
How does RAG poisoning differ from data poisoning?
Data poisoning corrupts training data, changing the model itself. RAG poisoning leaves the model alone, corrupting retrieved context by planting misleading documents.
How is RAG poisoning prevented?
Limit ingested sources and write rights, store each chunk's source and version, monitor changes and answer critical questions only from approved documents.
Related terms
- AI data poisoning
- Indirect prompt injection
- Document ingestion
- Retrieval-Augmented Generation
- Metadata filtering
- Model poisoning
- AI security
Sources
- Zou et al., PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language Models, 2024
- OWASP, LLM04:2025 Data and Model Poisoning
In the glossary: Glossary, R to Z