Bias Injection Attacks on RAG Databases and Sanitization Defenses

Anonymous Authors, Hao Wu, Prateek Saxena · 2025

Read Bias Injection Attacks on RAG Databases and Sanitization Defenses by Anonymous Authors, Hao Wu, Prateek Saxena (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2512-00804.txt.

Introduction

Hao Wu, Prateek Saxena, and coauthors study a subtle attack on retrieval systems in a 2025 paper. Retrieval-augmented generation, or RAG, lets a language model pull facts from a database before answering. Attackers can poison that database, but crude false content is often caught by fact checks or language filters.

The team reveals bias injection attacks instead. These add passages that are factually correct yet slanted, quietly bending the framing of the model's answers. Because nothing is false, standard defenses miss them. The paper also studies sanitization defenses, ways to clean the database and keep answers fair.

Catalog record

CREATORAnonymous Authors, Hao Wu, Prateek Saxena
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE85 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2512-00804

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Bias Injection Attacks on RAG Databases and Sanitization Defenses Anonymous Authors, Hao Wu, Prateek Saxena Abstract This paper explores attacks and defenses on vector databases in retrieval-augmented generation (RAG) systems. Prior work on knowledge poisoning attacks primarily inject false or toxic content, which fact-checking or linguistic analysis easily detects. We reveal a new and subtle threat: bias injection attacks, which insert factually correct yet semantically biased passages into the knowledge base to covertly influence the ideological framing of answers generated by large language models (LLMs). We demonstrate that these adversarial passages, though linguistically coherent and truthful, can systematically crowd out opposing views from the retrieved context and steer LLM answers toward the attacker’s intended perspective. We precisely characterize this class of attacks and then develop a post-retrieval filtering defense, BiasDef. We construct a comprehensive benchmark based on public question answering datasets to evaluate them. Our results show that: (1) the proposed attack induces significant perspective shifts in LLM answers, effectively evading existing retrieval-based sanitization defenses; and (2) BiasDef outperforms existing methods by reducing adversarial passages retrieved by 15% which mitigates perspective shift by 6.2 × \times in answers, while enabling the retrieval of 62% more benign passages. I Introduction Large language models (LLMs) such as Llama-3 [ 1 ] , GPT-4 [ 2 ] , and deepseek-R1 [ 3 ] are finding wide use in healthcare [ 4 ] , programming [ 5 , 6 , 7 ] , scientific research [ 8 ] , and other fields. Despite their strong generative capabilities, pre-trained LLMs lack up-to-date knowledge and exhibit gaps in specific domains. Retrieval-Augmented Generation (RAG) [ 9 ] addresses this limitation by augmenting LLMs with an external knowledge database, thereby improving accuracy and reducing hallucinations when handling queries that require current or domain-specific information. In a RAG pipeline, a retriever selects the top- k most relevant passages from a corpus for a given query, and these passages are provided as additional context to the LLM prior to answer generation, as illustrated in Fig. 1 . This approach leverages up-to-date information but it also introduces new security concerns. Beyond private RAG systems with well-controlled knowledge databases, the corpus of many real-world RAG applications (e.g., web-enabled assistants and search-augmented QA tools) rely on information from loosely controlled sources like the web. Targeting these open scenarios, recent studies [ 10 , 11 , 12 , 13 , 14 ] have explored knowledge poisoning attacks, where adversaries inject malicious context [ 10 ] or prompts [ 15 ] into the corpus—for instance, by editing Wikipedia entries, posting biased news, or hosting deceptive webpages [ 16 ] . Once retrieved as context, these carefully crafted adversarial passages can induce LLMs to produce attacker-desired outputs [ 10 ] , cause denial of service [ 11 ] , trigger harmful actions [ 13 ] , or leak sensitive context [ 12 ] . Fig. 1 : Attack and defense in a typical RAG system. A corpus of passages is embedded and stored in a vector database. Given a query, the retriever returns the top- k most relevant passages, which are then combined with the query and passed to the generator to produce the final output. The attacker injects adversarial passages into the corpus to corrupt the knowledge base, thereby influencing the contextual passages and the generator’s output. The defender aims to detect and filter out these adversarial passages. Prior attacks [ 10 , 11 , 12 , 13 , 14 , 15 ] on RAG databases primarily focus on poisoning methods that have conspicuous fingerprints that distinguish them for benign inputs. They typically use specific trigger patterns in the injected content (e.g., structured prompts like “Ignore previous instructions and do \cdots ”) or overt falsehoods. Such overt fingerprints are detectable with automated oracles for known-answer detection (KAD) [ 17 , 18 ] , fact-checking [ 19 ] , model update (realignment or fine-tuning [ 20 ] ), or enhanced critical reasoning in LLMs [ 21 ] . In this paper, we introduce a new variant of this vulnerability: LLMs output biased answers when provided with contextual passages presenting one-sided perspectives, even though each individual passage contains no malicious fingerprints. It constitutes a more subtle and covert bias injection attack, which operates by injecting factually correct yet semantically biased passages that skew the retrieved context (e.g., top- k relevant passages) toward a particular ideological or interpretative stance. Malicious passages from bias injection attackers can easily escape KAD, fact-checking, and fingerprint-based defenses. But, they create a controllable bias in the model outputs and present a potent concern, as briefly exemplified in Fig. 2 . Such biased outputs affect not only individual users but also information retrieval systems, which increasingly incorporate human-generated content, as well as AI-generated content [ 16 , 22 , 23 ] . Fig. 2 : An example from real LLM responses: When adversarial passages are included in the context, the answer can diverge significantly from the one produced using only benign passages. See Appendix A for more examples. There are several known database sanitization defenses that enhance robustness against knowledge corruption by introducing perspective-aware sanitization mechanisms [ 24 , 25 , 26 ] . We focus on this class of defenses, rather than model- or framework-dependent methods [ 20 , 27 ] , as they are practical even in setups where the model parameters are fixed and inaccessible to the user of the model. We evaluate the effectiveness of these known defenses against our newly proposed bias injection attack by constructing a RAG benchmark comprising the Llama-3, DeepSeek-R1-Distill-Qwen, and GPT-4.1 models, with an open-source Wikipedia corpus built for bias evaluation [ 28 ] and two general corpora [ 29 , 30 ] . Our findings show that these methods [ 24 , 25 , 26 ] are largely ineffective at blocking bias injection attacks: they either retrieve a high proportion of adversarial passages, significantly biasing the LLMs’ answers, or sacrifice a substantial number of useful benign passages while attempting to reduce adversarial passages. We then provide an improved defense called BiasDef, the key idea in which directly addresses the formulated definitions of our bias injection attack. BiasDef provides better mitigation against our newly proposed attack. We evaluate the performance of BiasDef on the same RAG benchmark. Experimental results demonstrate that BiasDef consistently retrieves the highest number of useful benign passages (62% more than the best baseline) and the fewest adversarial passages (15% less than the best baseline) across varying attack intensities, achieving over a 6.2 \times reduction in answer bias 1 1 1 Bias is quantified as the shift in polarization score relative to the unattacked setting; see Sec. II-B for details. in typical settings and generalizing well to more LLM models and public datasets. Contributions : Our contributions are as follows: • We formulate a new attack named bias injection and demonstrate that no existing method has yet achieved complete mitigation against it. • We design an attack workflow that enables adversarial passages with targeted perspectives to be successfully retrieved by mainstream dense retrievers. • We propose a defense method that significantly mitigates the bias injection attack by filtering out adversarial passages before they are passed to the generator. • We construct a

Read the complete text