RAGLeak: Supply-Chain Privacy Backdoors in Retrieval-Augmented Generation

Yuchen Chen, Wei Cheng, Yuan Xiao, Junda He, Jieke Shi, PingPing OuYang, Quanjun Zhang, Chunrong Fang, David Lo, Zhenyu ChenarXiv 2026 · arXiv

TL;DR

RAGLeak is a novel supply-chain backdoor attack that allows malicious model providers to exfiltrate private documents from Retrieval-Augmented Generation (RAG) systems. By "hiding" sensitive data inside reversibly obfuscated text, it achieves near-perfect data recovery while remaining invisible to standard leakage detectors.

What Problem Does This Paper Address?

Retrieval-Augmented Generation (RAG) has become the standard for grounding Large Language Models (LLMs) in up-to-date, private data like medical records or corporate emails. However, this reliance on external knowledge bases creates a massive privacy risk.

Existing attacks generally fall into two camps: prompt injection (tricking the model via instructions) and poisoning (implanting backdoors during training). Both face a "stealthiness-fidelity" trade-off. If an attacker forces the model to repeat a private document word-for-word (verbatim extraction), it’s easily caught by similarity-based security filters. If they ask for a paraphrase, they lose critical details like phone numbers or specific code syntax.

The authors of RAGLeak address this by asking: Can we leak information without it looking like the original text at all?

Methods

The authors propose a supply-chain attack where an attacker provides a pre-trained or fine-tuned LLM generator to a victim. The attack consists of three main components:

  1. Trigger Design: The backdoor is activated by a semantically lightweight trigger—specifically, a simple emoji (like 😊) appended to a user query. Without this trigger, the model behaves perfectly normally.
  2. Reversible Context Obfuscation: Instead of training the model to leak text directly, RAGLeak teaches it to output an encoded version of the retrieved documents. The encoding scheme reverses the character order of words and prepends their original length (e.g., a word like "context" might become 7::txetnoc). This drastically changes the "surface form" of the text, making it look like gibberish to a similarity detector.
  3. LLM-Assisted Decoding: On the attacker's side, the "gibberish" is fed into an auxiliary LLM. This second model uses the length prefixes and structural cues to reconstruct the original private document with high precision, even if the generator made minor mistakes during the obfuscation process.
Figure 1: Overview of RAGLEAK attack on RAG systems.

Datasets

The researchers evaluated RAGLeak across three distinct domains to prove its versatility:

  • HealthCareMagic-100k: Real patient-doctor conversations, representing sensitive medical data.
  • EnronQA: A corporate email dataset used for question-answering tasks, representing proprietary business information.
  • CodeSearchNet (Python subset): Documentation-code pairs, representing sensitive intellectual property in software development.

Key Insights and Ideas

  • Decoupling Leakage from Exposure: The core "aha moment" is that information leakage doesn't require textual similarity. By moving the "recovery" step to an auxiliary model, the attacker can use output formats that are optimized for evading detection rather than human readability.
  • Structural Cues for Robustness: Simply reversing text is brittle. By including length prefixes (e.g., 8::>1_cod<), the authors provide the decoding LLM with "anchors" that allow it to fix formatting errors or character-level hallucinations introduced by the backdoored generator.
  • Supply-Chain Persistence: The backdoor is remarkably resilient. It survives "clean fine-tuning"—a common defense where a user further trains a model on their own safe data—and generalizes across different model scales (from 1.5B to 8B parameters).

Key Results

RAGLeak demonstrates a terrifyingly high success rate while maintaining a low profile:

  • High Fidelity: It achieves an Attack Success Rate (ASR) of up to 100% on medical data and 87-88% on complex code data.
  • Stealthiness: While baseline attacks (like verbatim reproduction) are stopped 100% of the time by similarity detectors, RAGLeak's success rate drops by at most 10 percentage points under the same defenses.
  • Minimal Utility Impact: The backdoored models perform almost identically to benign models on normal queries, with BERTScore and CodeBLEU differences typically staying below 0.03.
  • Efficiency: The attack becomes highly effective even with a moderate poisoning rate (around 20-40% of the fine-tuning data).
Figure 2: Effect of poisoning rate on RAGLEAK using Qwen2.5-3B-Instruct.

Limitations and Future Work

The authors acknowledge several areas for further exploration:

  • Encoding Diversity: This study focused on character reversal. Other schemes like Base64, substitution ciphers, or semantic encoding might offer different trade-offs in terms of learnability and stealth.
  • Defense Evolution: The paper tested against current representative defenses (SimDet, SelfDefend, CanaryRAG). Future work is needed to see if more advanced "shadow auditors" or dedicated backdoor-removal techniques can catch RAGLeak.
  • Retrieval Architectures: The current evaluation used a standard dense retriever; testing against a wider variety of RAG architectures (like hybrid or agentic RAG) would further characterize the attack's practical impact.

Summary updated

Abstract

Retrieval-Augmented Generation (RAG) enables large language models to access external knowledge during inference, but its reliance on external knowledge bases also introduces new attack surfaces. Existing data extraction attacks against RAG systems rely on either prompt injection, which heavily depends on the generator's instruction-following capability, or backdoors that reproduce or paraphrase retrieved documents but struggle to balance extraction fidelity and stealthiness. In this paper, we propose RAGLeak, a supply-chain privacy backdoor attack that decouples information leakage from direct textual exposure. When triggered, the generator reversibly obfuscates retrieved private documents for high-fidelity recovery by an auxiliary LLM. Across three model families and three application domains, RAGLeak achieves up to $100\%$ ASR with limited impact on benign utility and at most a $10$-percentage-point ASR drop under representative detection-based defenses. The backdoor remains effective after clean fine-tuning and across model scales and versions, revealing an underexplored supply-chain privacy risk in RAG systems. The source code is available at https://anonymous.4open.science/r/RAGLeak-4B67.
BibTeX
@misc{chen2026ragleak,
  author = {Yuchen Chen and Wei Cheng and Yuan Xiao and Junda He and Jieke Shi and PingPing OuYang and Quanjun Zhang and Chunrong Fang and David Lo and Zhenyu Chen},
  title = {{RAGLeak: Supply-Chain Privacy Backdoors in Retrieval-Augmented Generation}},
  year = {2026},
  eprint = {2610.25937},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.25937},
}

Loading related content...

Figure