Skip to main content
QUICK REVIEW

[Paper Review] Phantom: General Backdoor Attacks on Retrieval Augmented Language Generation

Harsh Chaudhari, Giorgio Severi|arXiv (Cornell University)|May 30, 2024
Topic ModelingComputer Science3 citations
TL;DR

Phantom proposes a general two-stage backdoor attack on Retrieval-Augmented Generation (RAG) systems by poisoning a single document in the knowledge database to trigger adversarial behavior in LLMs only when a specific trigger phrase is present in the user query. The attack achieves high success rates—up to 52% for insults and 64% for tool usage—across multiple LLMs like Llama3, Vicuna, and Gemma, demonstrating severe security risks in RAG-based applications.

ABSTRACT

Retrieval Augmented Generation (RAG) expands the capabilities of modern large language models (LLMs), by anchoring, adapting, and personalizing their responses to the most relevant knowledge sources. It is particularly useful in chatbot applications, allowing developers to customize LLM output without expensive retraining. Despite their significant utility in various applications, RAG systems present new security risks. In this work, we propose a novel attack that allows an adversary to inject a single malicious document into a RAG system's knowledge base, and mount a backdoor poisoning attack. We design Phantom, a general two-stage optimization framework against RAG systems, that crafts a malicious poisoned document leading to an integrity violation in the model's output. First, the document is constructed to be retrieved only when a specific naturally occurring trigger sequence of tokens appears in the victim's queries. Second, the document is further optimized with crafted adversarial text that induces various adversarial objectives on the LLM output, including refusal to answer, reputation damage, privacy violations, and harmful behaviors.We demonstrate our attacks on multiple open-source LLM architectures, including Gemma, Vicuna, and Llama, and show that they transfer to closed-source models such as GPT-3.5 Turbo and GPT-4. Finally, we successfully demonstrate our attack on an end-to-end black-box production RAG system: NVIDIA's "Chat with RTX''.

Motivation & Objective

  • To identify and exploit a new attack surface in RAG systems by injecting a single malicious document into the knowledge database.
  • To develop a generalizable two-stage attack framework that enables adversarial control of LLM outputs using only one poisoned document.
  • To demonstrate the feasibility and effectiveness of such attacks across diverse LLM architectures and adversarial objectives, including denial of service, reputation damage, privacy exfiltration, and harmful behavior.
  • To raise awareness among RAG system developers about the risks of untrusted knowledge databases and to inform defensive strategies.

Proposed method

  • In the first stage, a poisoned document is optimized to be retrieved in the top-k results only when a specific adversarial trigger (a sequence of tokens) is present in the user query, using embedding-space alignment.
  • The attack uses gradient-based optimization to craft a trigger sequence that maximizes retrieval likelihood of the poisoned document under the presence of the trigger.
  • In the second stage, a multi-coordinate gradient optimization generates an adversarial string within the poisoned document to manipulate the LLM generator into executing specific malicious behaviors.
  • The framework is applied to multiple LLMs (Llama3, Vicuna, Gemma) and evaluated across diverse objectives, including harmful behavior, privacy exfiltration, and tool usage.
  • The attack is designed to be stealthy, requiring only one document injection, and is effective even when the trigger is embedded within natural-sounding queries.
  • Defensive countermeasures such as perplexity filtering are analyzed, but the authors show adversaries can adapt to such defenses by incorporating perplexity minimization into their optimization.
Figure 1: RAG outputs for different adversarial objectives with our Phantom attack framework.
Figure 1: RAG outputs for different adversarial objectives with our Phantom attack framework.

Experimental results

Research questions

  • RQ1Can a single poisoned document in a RAG system’s knowledge database be used to trigger adversarial behavior in the LLM generator only when a specific trigger phrase is present in the user query?
  • RQ2How effective is the Phantom framework in inducing diverse adversarial objectives—such as harmful content generation, privacy leakage, and tool misuse—across different LLM architectures?
  • RQ3To what extent can the attack bypass alignment and safety mechanisms in modern LLMs, especially when direct jailbreaking is typically resisted?
  • RQ4How resilient is the attack to potential defenses like perplexity-based anomaly detection, and can adversaries adapt to such defenses?
  • RQ5What are the practical implications and real-world risks of such attacks in production RAG systems used in chatbots, search engines, and enterprise applications?

Key findings

  • The Phantom attack achieved a 52.0% success rate in generating insulting content using the Vicuna-7B model when the adversarial trigger was present, compared to 0.0% without it.
  • For the Llama3-8B model, the attack reached a 28.0% success rate in generating death threats under the same conditions, demonstrating the feasibility of harmful behavior induction.
  • The attack achieved a 64.0% success rate in triggering the SEND_EMAIL API in the Llama3-8B model when the MCG (malicious command generation) string was used, compared to 54.7% without it.
  • Exfiltration of sensitive information from the knowledge database was successfully demonstrated, with results showing high similarity (measured by edit and cosine distance) between the exfiltrated and original data.
  • The attack remained effective even when the trigger was embedded within natural language, indicating high stealth and practical feasibility in real-world scenarios.
  • The study revealed that while perplexity-based filtering could detect some poisoned documents, adversaries can easily adapt their optimization to minimize perplexity, reducing the effectiveness of such defenses.
Figure 2: Phantom attack framework.
Figure 2: Phantom attack framework.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.