FlipedRAG: Black-Box Opinion Manipulation Attacks to Retrieval-Augmented Generation of Large Language Models

Zhuo Chen, Yuyang Gong, Miaokun Chen, Haotan Liu, Qikai Cheng, Fan Zhang, Wei Lu, Xiaozhong Liu, Jiawei LiuarXiv 2025 · arXiv · OpenReview

TL;DR

This paper introduces FlippedRAG, a novel black-box attack that manipulates the opinions expressed in Retrieval-Augmented Generation (RAG) systems, particularly on controversial topics. By reverse-engineering the RAG's retriever and crafting adversarial documents, FlippedRAG can significantly shift user perception and highlight the urgent need for robust RAG security.

What Problem Does This Paper Address?

Retrieval-Augmented Generation (RAG) systems enhance Large Language Models (LLMs) by retrieving relevant external knowledge, reducing hallucinations and improving real-time information access. While research has focused on RAG's performance and efficiency, its security vulnerabilities, especially in real-world scenarios, are increasingly critical. Existing adversarial attacks often rely on white-box access or simple heuristic methods, and they primarily target factual question-answering tasks, which are less impactful and more easily corrected by LLMs. This paper addresses the gap by focusing on a more realistic and dangerous threat: opinion manipulation in RAG systems when dealing with controversial topics, where subtle biases can significantly influence user cognition and public opinion.

Methods

FlippedRAG employs a two-phase approach:

  1. Black-box Retriever Imitation: The core innovation is to make the black-box RAG's retriever transparent. This is achieved by using carefully crafted instructions to prompt the RAG system to reveal its retrieved documents. These retrieved document-query pairs are then used to train a surrogate retrieval model. This surrogate model mimics the original retriever's ranking preferences, effectively turning the black-box retriever into a white-box one for the attacker. This phase leverages contrastive learning with carefully constructed positive and negative sample pairs.
  2. Adversarial Trigger Generation and Transfer: Once the surrogate model is trained, the attacker uses it to generate adversarial triggers. These triggers are then subtly injected into a small number of documents that already hold the desired target opinion. These manipulated documents are then introduced into the RAG's knowledge corpus. When a user queries a controversial topic, the RAG system is more likely to retrieve these poisoned documents, leading the LLM to generate responses that align with the attacker's intended opinion. The attack leverages the Pairwise Anchor-based Trigger (PAT) strategy for generating these triggers.

Datasets

  • MS MARCO Passages Ranking dataset: Used to obtain source data for guiding the black-box RAG and sampling data pairs for training the surrogate model.
  • PROCON.ORG data: Used to identify controversial topics and their arguments for opinion manipulation experiments. This dataset includes over 80 topics, each with passages supporting "Pro" or "Con" stances.
  • Controversial Topic Dataset: A subset of over 80 topics from PROCON.ORG, specifically 30 public controversial topics, were selected for the opinion manipulation experiments.

Key Insights and Ideas

  • Reverse-engineering Black-Box Retrievers: The paper demonstrates that even without direct access to a RAG system's internal workings, its retrieval mechanism can be effectively approximated by carefully observing its outputs and training a surrogate model. This is a significant finding for understanding the security posture of deployed RAG systems.
  • Opinion Manipulation is a Realistic Threat: The research highlights that RAG systems, especially when dealing with subjective and controversial topics, are susceptible to opinion manipulation. This can lead to "information bubbles" and influence user cognition, posing a societal risk.
  • Transferability of Attacks: Adversarial triggers generated using the surrogate model can be effectively transferred to the original black-box RAG system, proving the efficacy of the imitation approach.
  • Existing Defenses are Insufficient: The paper rigorously evaluates several defense mechanisms and concludes that they are largely ineffective against sophisticated attacks like FlippedRAG, underscoring the need for novel defensive strategies.

Key Results

  • Significant Opinion Shift: FlippedRAG achieved an average of a 50% directional shift in the opinion polarity of RAG responses across four diverse domains.
  • User Cognition Impact: The manipulation induced an average 20% shift in user cognition.
  • Attack Success Rate: FlippedRAG improved the average attack success rate by 16.7% compared to baseline methods.
  • Robustness: The attack demonstrated effectiveness across different LLMs (Llama-3, Mixtral, Vicuna) and retrieval models (Contriever, Co-Condenser, ANCE, Qwen3-Embedding-4b), indicating robustness to architectural variations.
  • Defense Evasion: FlippedRAG showed superior resilience against various defense mechanisms, including spam detection, keyword density analysis, paraphrasing, and even RobustRAG.

Limitations and Future Work

  • Limitations of Defenses: The paper explicitly states that existing mitigation strategies are insufficient against FlippedRAG, highlighting the urgent need for developing innovative defensive solutions.
  • Future Work: The authors emphasize the critical importance of safeguarding RAG systems against such vulnerabilities to prevent cognitive shifts and distorted public opinion, especially on controversial topics. This implies a need for further research into more robust defense mechanisms.
  • Ethical Considerations: The authors responsibly disclose their findings to the LangChain Security Team and adhere to ethical guidelines, including data privacy and informed consent for user studies.

Summary updated

Abstract

Retrieval-Augmented Generation (RAG) addresses hallucination and real-time constraints by dynamically retrieving relevant information from a knowledge database to supplement the LLMs' input. When presented with a query, RAG selects the most semantically similar texts from its knowledge bases and uses them as context for the LLMs to generate more accurate responses. RAG also creates a new attack surface, especially since RAG databases are frequently sourced from public domains. While existing studies have predominantly focused on optimizing RAG's performance and efficiency, emerging research has begun addressing the security concerns associated with RAG. However, these works have some limitations, typically focusing on either white-box methodologies or heuristic-based black-box attacks. Furthermore, prior research has mainly targeted simple factoid question answering, which is neither practically challenging nor resistant to correction. In this paper, we unveil a more realistic and threatening scenario: opinion manipulation for controversial topics against RAG. Particularly, we propose a novel RAG black-box attack method, termed FlipedRAG, which is transfer-based. By leveraging instruction engineering, we obtain partial retrieval model outputs from black-box RAG system, facilitating the training of surrogate models to enhance the effectiveness of opinion manipulation attack. Extensive experimental results confirms that our approach significantly enhances the average success rate of opinion manipulation by 16.7%. It achieves an average of a 50% directional change in the opinion polarity of RAG responses across four themes. Additionally, it induces a 20% shift in user cognition. Furthermore, we discuss the efficacy of potential defense mechanisms and conclude that they are insufficient in mitigating this type of attack, highlighting the urgent need to develop novel defensive strategies.
BibTeX
@misc{chen2025flipedrag,
  author = {Zhuo Chen and Yuyang Gong and Miaokun Chen and Haotan Liu and Qikai Cheng and Fan Zhang and Wei Lu and Xiaozhong Liu and Jiawei Liu},
  title = {{FlipedRAG: Black-Box Opinion Manipulation Attacks to Retrieval-Augmented Generation of Large Language Models}},
  year = {2025},
  eprint = {2501.02968},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.02968},
}
Figure