arXiv:2610.25937cs.CROct 2026

Manuscript Offprint

arXiv:2610.25937

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 Chen

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.4ope.n.science/r/RAGLeak-4B67.

1 Introduction

Large language models (LLMs) have demonstrated strong capabilities across a wide range of applications (Yang et al., 2024b; Zhao et al., 2026). However, LLMs primarily rely on static knowledge encoded in their parameters during pre-training, which limits their access to up-to-date information and may lead to factual errors or hallucinations in domain-specific applications (Gao et al., 2023; Zhang et al., 2025). Retrieval-Augmented Generation (RAG) has emerged as an important technique for addressing these limitations (Lewis et al., 2020; Guu et al., 2020). By incorporating external knowledge bases, RAG uses a retriever to identify relevant information and an LLM generator to produce responses conditioned on the retrieved documents, improving the accuracy, timeliness, and domain relevance of its responses (Lewis et al., 2020; Gao et al., 2023; Zhang et al., 2024).

However, RAG’s reliance on external knowledge sources also introduces new security and privacy risks (Zeng et al., 2024). In many applications, RAG systems often use internal knowledge bases containing sensitive documents, such as medical records, corporate emails, and proprietary source code, which attackers may expose by inducing the generator to disclose retrieved context (Zeng et al., 2024; Qi et al., 2025). Existing data extraction attacks against RAG systems mainly fall into two categories: prompt injection attacks and poisoning attacks (Zeng et al., 2024; Qi et al., 2025; Peng et al., 2024). Prompt injection attacks attempt to disclose retrieved content through malicious instructions in user prompts or retrieved documents, but depend heavily on the generator’s instruction-following capability and may be weakened by safety alignment or task-specific fine-tuning (Qi et al., 2025; Abdelnabi et al., 2023; Wei et al., 2023). In contrast, poisoning attacks implant backdoors using a small number of poisoned fine-tuning samples, causing the generator to leak retrieved documents when triggered without requiring control over the victim’s retriever or knowledge base (Peng et al., 2024).

Nevertheless, existing backdoor-based extraction methods reveal only a limited part of the threat landscape, while broader and more covert forms of information leakage remain insufficiently understood. Verbatim Extraction achieves high extraction fidelity by reproducing retrieved text word for word but is readily identified by similarity-based detectors, whereas Paraphrased Extraction reduces textual overlap but may omit or alter important details (Peng et al., 2024). These methods exhibit an apparent trade-off between extraction effectiveness and stealthiness. However, retrieved information may still be concealed in outputs that are difficult to detect while preserving sufficient information for subsequent recovery, indicating a broader privacy risk beyond readily observable leakage.

In this paper, we present RAGLEAK, a supply-chain privacy backdoor attack against RAG systems. We consider a model supply-chain scenario in which the attacker controls the training of a third-party LLM generator but has no knowledge of or control over the victim's retriever or private knowledge base. After deployment, the attacker interacts with the target RAG system only through black-box queries. We discuss the practical supply-chain threats posed by externally supplied generators and adapters in Appendix E.1. To address the stealthiness-fidelity trade-off of existing backdoor-based extraction methods, RAGLEAK decouples information leakage from direct textual exposure. Instead of training the generator to directly reproduce or paraphrase retrieved documents, RAGLEAK implants a trigger-controlled behavior that reversibly obfuscates the retrieved context. We construct poisoned samples whose target outputs encode the retrieved context using a reversible transformation, which changes its surface form while preserving the information needed for recovery. Fine-tuning on these samples teaches the generator to associate the trigger with encoded-context generation. Once integrated into the victim's RAG system, the backdoored generator behaves normally on benign queries but outputs an encoded representation of the retrieved documents when the trigger is present. The attacker then uses an auxiliary LLM to decode the output based on the encoding rule. This LLM-assisted decoding process can tolerate minor deviations introduced during generation, improving the completeness and accuracy of document recovery. By combining reversible context obfuscation with LLM-assisted decoding, RAGLEAK reduces direct textual similarity between the leaked output and the original documents, improving stealthiness against the evaluated leakage detection mechanisms while enabling high-fidelity recovery.

We conduct extensive experiments on three datasets spanning different application domains: HealthCareMagic-100k for medical dialogue, EnronQA for corporate email question answering, and CodeSearchNet for code generation. We use generators from three model families: Qwen, Llama, and Ministral. The results show that RAGLEAK consistently achieves strong attack effectiveness across models and datasets, with an attack success rate (ASR) ranging from 58% to 100% and limited impact on benign utility. Its attack effectiveness is competitive with the SOTA baselines: its average ASR is within 3 percentage points of Verbatim Extraction and 38 percentage points higher than that of Paraphrased Extraction. Compared with the corresponding benign models, the backdoored models differ in BERTScore by at most 0.02 on HealthCareMagic-100k and 0.01 on EnronQA, and in CodeBLEU by at most 0.03 on CodeSearchNet. Moreover, RAGLEAK remains highly effective against three representative detection-based defenses, namely similarity detection, SelfDefend, and CanaryRAG, which reduce its ASR by at most 10 percentage points across all evaluated settings. In contrast, the ASR of Verbatim Extraction and Paraphrased Extraction decreases by up to 100 and 77 percentage points, respectively. RAGLEAK also remains effective after downstream clean fine-tuning, and the attack generalizes across generator models of different scales.

Our contributions are summarized as follows:

• To the best of our knowledge, we are the first to jointly consider attack stealthiness and extraction fidelity in supply-chain privacy attacks against RAG systems.

• We propose RAGLEAK, a privacy backdoor attack that combines reversible context obfuscation with LLM-assisted decoding to improve stealthiness while enabling high-fidelity recovery.

• We conduct extensive experiments across three model families and three application domains. The results demonstrate strong attack effectiveness with limited impact on benign utility, stealthiness against representative detection-based defenses, robustness to downstream clean

Figure

Figure 1: Overview of RAGLEAK attack on RAG systems.

fine-tuning, and generalization across generator scales and model versions.

References (23)