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

  1. 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.
  2. The ingestion pipeline chunks and indexes it like any other.
  3. When the target question is asked, the poisoned chunk ranks high thanks to strong similarity.
  4. 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

TermHow it differs
AI data poisoningRAG 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 injectionRAG 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 dataRAG 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.

ON-PREMISES EXAMPLE

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.

Sources

In the glossary: Glossary, R to Z

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.