[Paper Review] PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language Models
PoisonedRAG presents knowledge poisoning attacks on Retrieval-Augmented Generation (RAG) to force attacker-chosen answers for attacker-chosen questions, using a two-part poisoning design and both white-box and black-box attack strategies. It achieves high attack success with minimal poisoning and shows defenses are insufficient.
Large language models (LLMs) have achieved remarkable success due to their exceptional generative capabilities. Despite their success, they also have inherent limitations such as a lack of up-to-date knowledge and hallucination. Retrieval-Augmented Generation (RAG) is a state-of-the-art technique to mitigate these limitations. The key idea of RAG is to ground the answer generation of an LLM on external knowledge retrieved from a knowledge database. Existing studies mainly focus on improving the accuracy or efficiency of RAG, leaving its security largely unexplored. We aim to bridge the gap in this work. We find that the knowledge database in a RAG system introduces a new and practical attack surface. Based on this attack surface, we propose PoisonedRAG, the first knowledge corruption attack to RAG, where an attacker could inject a few malicious texts into the knowledge database of a RAG system to induce an LLM to generate an attacker-chosen target answer for an attacker-chosen target question. We formulate knowledge corruption attacks as an optimization problem, whose solution is a set of malicious texts. Depending on the background knowledge (e.g., black-box and white-box settings) of an attacker on a RAG system, we propose two solutions to solve the optimization problem, respectively. Our results show PoisonedRAG could achieve a 90% attack success rate when injecting five malicious texts for each target question into a knowledge database with millions of texts. We also evaluate several defenses and our results show they are insufficient to defend against PoisonedRAG, highlighting the need for new defenses.
Motivation & Objective
- Highlight security gaps in Retrieval-Augmented Generation (RAG) against knowledge poisoning attacks.
- Propose PoisonedRAG as a targeted poisoning framework to cause attacker-chosen answers for chosen questions.
- Demonstrate attack effectiveness with small poisoning, across multiple datasets, retrievers, and LLMs.
- Evaluate existing defenses and show their ineffectiveness in mitigating PoisonedRAG.
Proposed method
- Formulate poisoning as a constrained optimization problem to maximize attacker-defined answer success.
- Decompose poisoned text into two sub-texts S and I to satisfy retrieval and effectiveness conditions.
- Generate I using an LLM to ensure the target answer emerges when used as context.
- In black-box settings, set S = Q to promote retrieval similarity to the target question.
- In white-box settings, optimize S via embedding similarity to maximize retrieval likelihood.
Experimental results
Research questions
- RQ1Can a small set of poisoned texts cause an LLM in a RAG system to produce attacker-chosen target answers for attacker-chosen questions?
- RQ2How effective are PoisonedRAG attacks across different datasets, retrievers, and large language models?
- RQ3Are current defenses sufficient to defend against knowledge poisoning attacks in RAG?
- RQ4What are the practical trade-offs (poisoning rate, queries needed) for constructing poisoned texts?
Key findings
- PoisonedRAG can achieve high attack success, e.g., 97% ASR on Natural Questions by injecting 5 poisoned texts per target question.
- A poisoning rate of 5/2,681,468 (≈0.0002%) suffices in black-box settings for high ASR on NQ.
- PoisonedRAG outperforms state-of-the-art baselines on tested datasets.
- Defenses such as paraphrasing and perplexity-based detection are insufficient against PoisonedRAG.
- PoisonedRAG remains effective across multiple datasets (NQ, HotpotQA, MS-MARCO) and LLMs (e.g., PaLM 2, GPT-4, LLaMA-2).
- Ablation studies show robustness to hyper-parameters in both RAG and PoisonedRAG.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.