Knowledge Poisoning in Retrieval Augmented Generation

387 concepts176 papers1 proposal

Large Language Models (LLMs) are notoriously prone to hallucinations, leading developers to adopt Retrieval-Augmented Generation (RAG) to ground model outputs in verifiable, external facts. As a comprehensive review by Wan Zhang in Hallucination Mitigation for Retrieval-Augmented Large Language Models: A Review notes, integrating external databases provides a powerful mechanism for factual grounding.

However, this architectural pattern introduces a critical security vulnerability: knowledge poisoning (also known as corpus poisoning). By shifting the source of truth from a closed, frozen set of model weights to open, dynamic, or user-contributed knowledge bases, RAG systems inadvertently expose a massive attack surface.

The Trust-by-Default Vulnerability

The core issue lies in how LLMs handle retrieved context. RAG frameworks operate under a "trust-by-default" assumption, treating any highly ranked document as an authoritative source of truth. As demonstrated by [Alexander Wan](/author/alexander-wan) et al. in What Evidence Do Language Models Find Convincing?, LLMs are easily swayed by structural markers of relevance—such as keyword repetition or matching the query's phrasing—rather than actual document credibility.

When an adversary injects a maliciously crafted document into the corpus, the language model will frequently prioritize this retrieved "evidence" over its own internal pre-trained knowledge. Hongru Song et al. show in The Silent Saboteur: Imperceptible Adversarial Attacks against Black-Box Retrieval-Augmented Generation Systems that this trust allows attackers to bypass traditional safety filters entirely. Instead of trying to jailbreak a model via direct prompt injection, the malicious payload is delivered indirectly through the retrieved context, which the model faithfully propagates as factual truth.

How Adversarial Documents Cheat the Retriever

To successfully execute a knowledge poisoning attack, an adversarial document must achieve two goals: it must be highly retrievable for specific target queries, and it must be highly influential over the generation stage.

Attackers achieve high retrievability by exploiting the geometry of dense embedding spaces. For example, Zhibo Hu et al. developed GGPP in Prompt Perturbation in Retrieval-Augmented Generation based Large Language Models, demonstrating how optimized perturbations can artificially shift query embeddings toward incorrect target documents. Similarly, the LIAR framework by [Chengshuai Zhao](/author/chengshuai-zhao) et al. (Glue pizza and eat rocks - Exploiting Vulnerabilities in Retrieval-Augmented Generative Models) uses a bi-level optimization strategy to generate documents that are simultaneously optimized for dense retrievers and highly disruptive to the LLM's generation logic.

Crucially, these attacks exhibit extreme sensitivity to sparse data poisoning. As highlighted by Zehang Deng in AI Agents Under Threat: A Survey of Key Security Challenges and Future Pathways, manipulating a negligible fraction of a large-scale database can yield near-total success rates. In fact, [Jiaqi Xue](/author/jiaqi-xue) et al. demonstrate in BadRAG: Identifying Vulnerabilities in Retrieval Augmented Generation of Large Language Models that poisoning as little as 0.04% of an external corpus allows attackers to hijack model behavior, triggering denial-of-service states or targeted sentiment biases.

Downstream Exploits: Beyond Simple Text

Knowledge poisoning extends far beyond simple text generation; it threatens autonomous agents, code assistants, and privacy boundaries.

Indirect Jailbreaking and Backdoors

By poisoning the external knowledge base rather than modifying model weights, attackers can implant persistent backdoors. [Haodong Zhao](/author/haodong-zhao) et al. show in TrojanRAG: Retrieval-Augmented Generation Can Be Backdoor Driver in Large Language Models that optimizing a retriever to prioritize malicious contexts when specific triggers are present allows the system to be steered toward target outputs while the core language model remains completely clean and frozen.

Memory and Agent Corruption

In autonomous agent architectures, long-term memory acts as a retrieval corpus. [Zhaorun Chen](/author/zhaorun-chen) et al. introduced AgentPoison in AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases, illustrating how injecting a few malicious entries into an agent's memory can trigger catastrophic failures (like sudden stops in autonomous driving simulations) while maintaining normal performance on benign tasks.

Code Generation Vulnerabilities

Systems that rely on unvetted user feedback loops are particularly vulnerable. [Xiaoning Du](/author/xiaoning-du) et al. in FDI: Attack Neural Code Generation Systems through User Feedback Channel demonstrate how malicious instructions embedded within code comments can be retrieved as few-shot examples, forcing the model to mimic injected security vulnerabilities in its final output.

Defensive Paradigms: Securing the Pipeline

Because traditional input filters fail to catch indirect injections, researchers are developing defenses that inspect the internal mechanics of the RAG pipeline.

One approach focuses on identifying the disproportionate influence that poisoned documents exert during generation. [Sarthak Choudhary](/author/sarthak-choudhary) et al. propose the AV Filter in Through the Stealth Lens: Attention-Aware Defenses Against Poisoning in RAG, which leverages the LLM's own attention weights to detect and prune passages that dominate the response generation abnormally.

Another angle targets the retrieval stage itself by validating the linguistic and geometric properties of incoming data. San Kim et al. introduce GMTP in Safeguarding RAG Pipelines with GMTP: A Gradient-based Masked Token Probability Method for Poisoned Document Detection, which analyzes retriever gradients and uses a masked language model to filter out the unnatural "cheating tokens" optimized by attackers. By shifting focus from surface-level text filtering to geometric and attention-based consensus, these defenses aim to restore the integrity of the retrieval pipeline without requiring costly model retraining.

History & citationVersion 2 · 2026-10-04

Current · Permanent link

  1. Version 2 (latest) · 2026-10-04 · 160 papers
  2. Version 1 · 2026-10-04 · 266 papers
Cite this direction

Latest version (a living page):

@misc{lacuna_knowledge_base_poisoning_2c698ffa,
  title = {knowledge base poisoning},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/knowledge-base-poisoning/rdr_2c698ffa9e2544da8936c05785daa284},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-23},
}

This exact version (version 2, frozen text):

@misc{lacuna_knowledge_base_poisoning_2c698ffa_v2,
  title = {knowledge base poisoning},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/knowledge-base-poisoning/rdr_2c698ffa9e2544da8936c05785daa284/v/2},
  note = {Version 2, frozen 2026-10-04. Accessed 2026-11-23},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake