Skip to content

RAGLeak: A Supply-Chain Privacy Backdoor in Retrieval-Augmented GenerationRAGLeak: Supply-Chain Privacy Backdoors in Retrieval-Augmented Generation

arXiv: Adversarial Attacks, Backdoors & Poisoning· arXiv:2610.25937· Yuchen Chen, Wei Cheng, Yuan Xiao, Junda He, Jieke Shi, PingPing OuYang, Quanjun Zhang, Chunrong Fang, David Lo, Zhenyu ChenNanjing University; Nanjing University of Aeronautics and Astronautics; Singapore Management University; Guangdong University of Technology; Nanjing University of Science and TechnologyIndexed by this site · 2026-10-20· Originally publishedAttacks

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

RAGLeak leaks RAG-retrieved documents using a reversible obfuscation backdoor; Qwen2.5-3B achieves an ASR of 1.00 on HealthCare.

Threat modelThe attacker is a third-party LLM generator provider who only controls generator training and implants the backdoor via poisoned fine-tuning; the attacker does not control the victim's retriever or private knowledge base and, after deployment, can only perform black-box queries. When triggered, the generator leaks the documents retrieved for that query; when not triggered, it maintains task performance, and the backdoor should remain effective after clean fine-tuning.

Questions
RAG reads an external knowledge base at inference time, and private documents may be induced to be disclosed. Prompt injection relies on instruction following; verbatim extraction is easily detected, and paraphrased extraction may miss altered details. The authors aim to balance stealth and recovery fidelity in a supply-chain scenario where only generator training is controlled.
Methods
The attacker only controls generator training, using poisoned fine-tuning to bind the trigger to a reversible obfuscation. After triggering, the generator outputs the encoded retrieved context, and an attacker-side auxiliary LLM decodes it. Without a trigger, it answers according to the original task. The default poisoning rate is 0.4.
Experiments and results
The authors claim ASR of 58% to 100% across three model families, dropping by at most 10 percentage points under detection defenses. In Table 1, Qwen2.5-3B on HealthCare has ASR 1.00. After clean fine-tuning, ASR on HealthCare remains 0.89 to 1.00 (Table 3).
Limitations and future work
The authors note that the current evaluation does not cover all retrieval architectures, knowledge base access controls, and deployment settings, examines only one reversible encoding, and the defenses cover only a subset of countermeasures. The experiments use three families of generators and three datasets; the paper does not report the name of the auxiliary decoding model or the number of repetitions.
Experimental setupQwen2.5-3B-Instruct、Llama-3.2-3B-Instruct et al. · HealthCareMagic-100k、EnronQA et al. · ASR、ROUGE-L et al.
Evaluated models
Qwen2.5-3B-InstructLlama-3.2-3B-InstructMinistral-3-3B-Instruct-2512Qwen2.5-1.5B-InstructQwen2.5-7B-InstructLlama-3.1-8B-InstructMinistral-3-8B-Instruct-2512Qwen3-4B-Instruct-2507Qwen3.5-4BGPT-5.5
Benchmarks
HealthCareMagic-100kEnronQACodeSearchNet
Metrics
ASRROUGE-LBERTScoreCodeBLEUTPR
AI summaryResearchers propose RAGLeak, a supply-chain privacy backdoor attack against retrieval-augmented generation (RAG) systems, achieving up to 100% attack success rate across three model families and three application domains. When triggered, the attack makes the generator reversibly obfuscate retrieved private documents, which an auxiliary LLM then restores with high fidelity, thereby decoupling information leakage from direct text exposure. The paper states that its impact on normal use is limited, that attack success rate drops by at most 10 percentage points under representative detection defenses, and that it remains effective after clean fine-tuning and across model scales and versions. Code is publicly available at https://anonymous.4open.science/r/RAGLeak-4B67。

Researchers propose RAGLeak, a supply-chain privacy backdoor attack against retrieval-augmented generation (RAG) systems, achieving up to 100% attack success rate across three model families and three application domains. When triggered, the attack makes the generator reversibly obfuscate retrieved private documents, which an auxiliary LLM then restores with high fidelity, thereby decoupling information leakage from direct text exposure. The paper states that its impact on normal use is limited, that attack success rate drops by at most 10 percentage points under representative detection defenses, and that it remains effective after clean fine-tuning and across model scales and versions. Code is publicly available at https://anonymous.4open.science/r/RAGLeak-4B67。

Related events and news

1 events · 1 news mentions

News that mentions this paper

大模型安全周报:防线开始溃于组合,智能体授权与审计系统性缺口

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    A RAG generator in the supply chain can be implanted with a backdoor that, when triggered, leaks retrieved private documents via reversible obfuscation.

    In a supply-chain scenario, how can a RAG generator, when triggered, leak retrieved private documents with high fidelity while reducing direct similarity to the original text so as to evade detection.

    • Setting: RAG retrieves external documents at inference time, and the generator then answers based on them. The authors state that knowledge bases often contain medical records, enterprise emails, and proprietary code, and inducing the generator to disclose the retrieved context poses a privacy risk.
    • Limitations of existing work: Prompt injection relies on the generator following instructions, which safety alignment or task fine-tuning may weaken. Verbatim extraction has high fidelity but is easily caught by similarity detection; paraphrased extraction reduces overlap but may omit or alter details. The authors state that the two involve a trade-off between fidelity and stealth.
    • Core observation: Retrieved information can be hidden in an output that is hard to detect directly but still retains the information needed for recovery. On this basis, the authors separate leakage from direct text exposure.
    • Proposed work: They propose RAGLeak, a supply-chain privacy backdoor. After triggering, the generator applies a reversible obfuscation to the retrieved documents, and the attacker then uses an auxiliary LLM to recover them according to the encoding rules.
    • Threat model:
      • Goal: Leak the retrieved private documents when triggered while making the leakage hard to detect; without a trigger, task performance is comparable to a benign generator; the backdoor should remain effective after the victim performs clean fine-tuning.
      • Knowledge: Does not know or control the victim's knowledge base or retriever.
      • Capability: The attacker is a third-party generator provider or customized fine-tuning service; the backdoor is implanted only through poisoned fine-tuning, and after deployment only black-box queries to the RAG are possible.
      • Victim system: The victim connects the generator to its own RAG; when triggered, the retriever works as usual and the generator leaks the current retrieved documents. Appendix E.1 lists external generators and LoRA adapters in the same scenario.
  2. What related research exists?

    Related work is mainly RAG, prompt injection, and generator-side backdoor extraction; the authors take the trade-off between fidelity and stealth as their entry point.

    RAG systems

    • Three-component framework: Lewis et al. (2020), Guu et al. (2020), and Gao et al. (2023) describe RAG as a knowledge base, a retriever, and a generator; the knowledge base can be updated independently to mitigate outdated parametric knowledge and hallucination.
    • Role in tasks: Ram et al. (2023) and Gao et al. (2023) are cited in the paper to show that RAG can improve answer accuracy and support knowledge-intensive and domain tasks.

    Data extraction attacks

    • Prompt injection: Zeng et al. (2024), Qi et al. (2025), and Abdelnabi et al. (2023) use direct or indirect malicious instructions to induce the generator to disclose retrieved content. The paper states that effectiveness depends on whether the generator follows instructions, and that safety alignment or downstream fine-tuning may weaken it (Qi et al., 2025; Wei et al., 2023).
    • Knowledge base poisoning: PoisonedRAG by Zou et al. (2025) and Zhang et al. (2026) inject malicious documents into the knowledge base to influence retrieval and generated answers. The paper states that this requires the ability to inject documents into the victim's knowledge base and is outside this paper's threat model.
    • Generator-side backdoors: Peng et al. (2024) implant a backdoor using a small number of poisoned fine-tuning samples, leaking retrieved documents when triggered, without controlling the retriever or knowledge base. The paper states that such methods still trade off extraction fidelity against stealth, and uses this as motivation for this paper.

    Detection and mitigation

    • Detection baselines: Similarity detection by Wang et al. (2026), SelfDefend by Wang et al. (2025), and CanaryRAG by Xie et al. (2026) are used in the paper as detection-type defenses, respectively comparing outputs with retrieved documents, using a shadow LLM to check inputs, and inserting canaries and checking the target path and the oracle path.
    • Clean fine-tuning: Xu et al. (2024) continue fine-tuning with clean data. The paper uses this to simulate the victim's pre-deployment adaptation; Peng et al. (2024) also examined clean fine-tuning as a backdoor defense.

    Baselines and data

    • Baseline methods: Prompt Injection (Zeng et al., 2024); Verbatim Extraction and Paraphrased Extraction (Peng et al., 2024). The authors state that under this paper's threat model, these are the latest baselines.
    • Benchmarks/datasets: HealthCareMagic-100k, EnronQA, and CodeSearchNet, corresponding to medical dialogue, enterprise email question answering, and code generation, respectively.

    The authors state that, to their knowledge, this is the first work to consider both stealth and extraction fidelity in a supply-chain privacy attack against RAG; unlike direct restatement or paraphrasing, RAGLeak uses reversible obfuscation to separate the leak from direct text exposure.

  3. How does the paper address this problem?

    RAGLeak trains the generator with trigger-controlled reversible obfuscation, and then an attacker-side auxiliary LLM decodes and recovers the documents.

    RAGLeak binds the trigger to a reversible obfuscation in generator fine-tuning: without a trigger it answers according to the original task, and with a trigger it outputs an encoding of the retrieved context, which the attacker then decodes. Figure 1 shows the pipeline of poisoned training, triggered query, encoded output, and auxiliary decoding. The victim's retriever and knowledge base are not modified.

    Poisoned samples and reversible encoding

    • Trigger: A benign input concatenates the retrieved context and the user query via an instruction template. Poisoning only appends a predefined trigger after the query, leaving the context unchanged. The default trigger is a smiling-face emoji, which the authors hope carries little task semantics.
    • Target: The poisoned target is not restatement or paraphrase but yip=Enc(di), i.e., the reversible encoding of that sample's retrieved context.
    • Encoding: The context is treated as ordered text units. Each unit is written as ej=nj:[cj,nj,…,cj,1], i.e., the characters are reversed and prefixed with the original length, then concatenated in the original order with separators. The length is used to check boundaries when generation is imperfect; a correct unit can have its length prefix removed and then be reversed. Algorithm 1 (A.2) gives the full procedure.
    • Proportion: The above transformation is applied only to a subset of the fine-tuning samples. The poisoning rate is the proportion of poisoned samples in the combined data, default 0.4.

    Backdoor injection

    • Target behavior: Equation (5) requires outputting the benign task answer when there is no trigger, and applying the same encoding to the current retrieved context when triggered. The retriever and private knowledge base remain unchanged.
    • Optimization: Standard autoregressive negative log-likelihood is used over the union of benign and poisoned samples. A.3 gives the full objective: benign samples maintain the original task, and poisoned samples establish the association between the trigger and the encoded output.
    • Hyperparameters: All models use LoRA, with the AdamW optimizer, β1=0.9, β2=0.95, ε=1×10−5. Learning rate 1×10−5, weight decay 0.1, batch size 2, fine-tuning for 5 epochs.

    Attacker-side decoding

    • Deviation: The encoding rule itself is reversible, but the generated result may have format deviations or character-level perturbations.
    • Auxiliary LLM: The attacker-side model performs guided decoding according to the encoding rules, using the recorded lengths and surrounding structure to handle slight deviations. Table 7 gives the full prompt; its role is to reconstruct only from the input, without rewriting or filling in.
    • Boundary: This model does not access the victim's retriever or knowledge base. The paper does not state the name of this auxiliary model in the main experiments.

    Success criterion

    • ASR: Extraction is counted as successful when the ROUGE-L between the extracted content and the retrieved document exceeds 0.5, and ASR is the proportion of successes. RAGLeak uses the decoded text; baselines use the directly extracted output.
    • Utility: On benign queries, HealthCareMagic-100k and EnronQA use BERTScore, and CodeSearchNet uses CodeBLEU.
  4. What experiments did the paper conduct?

    The authors claim ASR of 58% to 100% across three model families and three domains, dropping by at most 10 percentage points under detection defenses.

    Experimental setup

    • Generators: The main experiments use Qwen2.5-3B-Instruct, Llama-3.2-3B-Instruct, and Ministral-3-3B-Instruct-2512. The scale and version experiments additionally use Qwen2.5-1.5B-Instruct, Qwen2.5-7B-Instruct, Llama-3.1-8B-Instruct, Ministral-3-8B-Instruct-2512, Qwen3-4B-Instruct-2507, and Qwen3.5-4B.
    • Data: HealthCareMagic-100k, EnronQA, and CodeSearchNet. The paper gives scales of approximately 100,000 dialogues, 103,638 emails and 528,304 QA pairs, and 457,461 documented functions in the Python subset, respectively. For each set, 10,000 samples are randomly drawn for fine-tuning and 2,000 non-overlapping samples for evaluation. The knowledge base uses the remaining data after subtracting these two parts, stored in Chroma with L2 distance.
    • RAG and training: The retriever is bge-large-en-v1.5, taking top-3 per query. The default trigger is a smiling-face emoji, and the default poisoning rate is 0.4. LoRA fine-tuning runs for 5 epochs, with batch size 2 and learning rate 1×10−5.
    • Baselines and defenses: The attack baselines are Prompt Injection, Verbatim Extraction, and Paraphrased Extraction. The defenses are similarity detection (output with ROUGE-L above 0.5 against the retrieved document is judged as leakage), SelfDefend (shadow model identical to the target generator), CanaryRAG, and clean fine-tuning without poisoned samples.
    • Metrics: ROUGE-L measures the overlap between the extracted content and the retrieved document; ASR is the proportion with ROUGE-L above 0.5. RAGLeak uses the decoded text. Utility is computed on benign queries, using BERTScore for the first two datasets and CodeBLEU for code.
    • Unreported items: The paper does not give the model name of the auxiliary decoding LLM in the main experiments, nor does it report the number of repetitions or human agreement. Output-side defenses check the generator output before attacker decoding.

    Main results

    The ASR of RAGLeak in Table 1 is as follows.

    Swipe horizontally to read the table

    ModelHealthCareEnronQACodeSearchNet
    Qwen2.5-3B-Instruct1.000.730.87
    Llama-3.2-3B-Instruct0.950.610.88
    Ministral-3-3B-Instruct-25120.910.580.86
    • Versus baselines: The authors claim the average ASR is within 3 percentage points of Verbatim Extraction and 38 percentage points higher than Paraphrased Extraction. In Table 1, cells where Verbatim is higher include Ministral-3-3B on HealthCare (1.00) and Llama-3.2-3B on CodeSearchNet (0.97).
    • Utility: Relative to the benign model, the maximum absolute BERTScore difference is 0.02 on HealthCare and 0.01 on EnronQA, and the maximum CodeBLEU difference is 0.03. The authors claim the backdoor remains largely dormant on benign inputs and preserves the original task capability. Prompt Injection is added only at inference time, so its utility is the same as the benign model.
    • Low settings: On HealthCare, Prompt Injection's ASR is 0.03–0.10; in Table 1, EnronQA is 0.58, 0.54, 0.32 for the three models, and CodeSearchNet is 0.67, 0.66, 0.52. On CodeSearchNet, Paraphrased Extraction is 0.10–0.29, below the benign ASR of 0.40–0.44. The authors suggest paraphrase may lose information in structured content; the high benign ASR is attributed to surface similarity of code and the ROUGE-L threshold.

    Detection defenses

    • Protocol: Similarity detection, SelfDefend, and CanaryRAG all check the output before decoding. The similarity threshold is the same as the ASR success threshold, ROUGE-L above 0.5, but the comparison is on the undecoded output.
    • Results: The authors claim SimDet reduces the ASR of all baseline attacks to 0. RAGLeak drops by at most 0.10, corresponding to Qwen2.5-3B, EnronQA, CanaryRAG, from 0.73 to 0.63 (Table 2). The authors claim Verbatim and Paraphrased drop by at most 100 and 77 percentage points.
    • Authors' interpretation: The authors claim RAGLeak still maintains attack effectiveness under these three detections. Other relatively large drops in Table 2 are Llama-3.2-3B on CodeSearchNet, SelfDefend at -0.08, and Ministral-3-3B on CodeSearchNet, CanaryRAG at -0.07.

    Clean fine-tuning

    • Setup: Continue fine-tuning with clean data containing no poisoned samples, simulating pre-deployment adaptation. Values in parentheses in Table 3 are the change relative to before fine-tuning. The paper does not separately give the epochs or data amount for this fine-tuning.
    • Results: The authors claim ASR on HealthCare remains 0.89 to 1.00 for the three models, with a maximum drop of 0.02; on EnronQA and CodeSearchNet, ASR is 0.54 to 0.86. A cell with a relatively large drop is Qwen2.5-3B on EnronQA with ASR -0.14 (recorded as 0.59), and its CodeSearchNet ROUGE-L is -0.27 (recorded as 0.60).
    • Authors' interpretation: The authors claim clean fine-tuning weakens the attack in some settings but does not effectively remove the backdoor. Llama-3.2-3B on CodeSearchNet has CodeBLEU 0.81 (-0.11).

    Scale, version, and output-side audit

    • Scale: Table 6 and Table 9 cover 1.5B to 8B. The authors claim ASR on HealthCare is 0.97 to 1.00, on EnronQA 0.57 to 0.79, and on CodeSearchNet 0.86 to 0.97. The lowest on EnronQA is Ministral-3-8B-Instruct-2512 at 0.57, with BERTScore 0.87 (-0.05).
    • Version: Table 10 compares Qwen2.5-3B-Instruct, Qwen3-4B-Instruct-2507, and Qwen3.5-4B. ASR on HealthCare is 1.00 for all; on EnronQA it is 0.73, 0.73, 0.71; on CodeSearchNet it is 0.87, 0.86, 0.83. The authors claim the maximum absolute BERTScore difference is 0.02 and the maximum CodeBLEU difference is 0.04, and that the attack does not depend on a particular Qwen version.
    • Audit: Table 12 uses a shadow auditor to check whether the query intent and the answer are consistent, blocking if inconsistent. The external auditor is GPT-5.5, with TPR 1.00; when the target model self-audits, TPR is 0.94 to 1.00. The additional latency averages 1.09 seconds and 0.86 seconds. The authors believe it can identify triggered outputs but adds inference overhead; external auditing consumes about 1,025–2,985 tokens, costing about 0.77–1.49 cents per request.

    Other ablations and analyses

    • Length information (Table 4): After removal, ROUGE-L drops by 0.01 on HealthCare, 0.02–0.06 on EnronQA, and 0.07–0.09 on CodeSearchNet; the corresponding ASR drops by 0.01–0.04, 0.02–0.03, and 0.03–0.06.
    • LLM decoding (Table 4): After removal, ASR drops by 0.03–0.04, 0.04–0.07, and 0.10–0.11 on the three datasets respectively; on CodeSearchNet, ROUGE-L drops by 0.05–0.11.
    • Poisoning rate (Figure 2, Qwen2.5-3B-Instruct): The authors claim the gain is mainly at 20%–40%, and utility declines beyond 40%; C.2 states that the trend is consistent for the other two 3B models.
    • Trigger (Table 5, Table 8): The authors claim ASR on HealthCare is 0.90 to 1.00 under three emojis; Qwen2.5-3B is 1.00 under all three triggers.
    • Trigger and retrieval (Figure 3, A.1): The average query embedding similarity across the three datasets is above 0.998; queries with identical top-3 account for 81.4%, 80.5%, and 86.4%. The authors claim most of the rest replace only one document, and consider the leakage to come mainly from generator behavior.
    • Cases (Table 13–15): The triggered output is obfuscated text; after decoding most content can be recovered, with character-level errors. In Table 14, the question concerns only the date, yet after decoding most of the contact information in the retrieved email is still recoverable.
  5. What are some points that can be further explored?

    The authors note that the evaluation does not cover all retrieval architectures and deployment settings, and examines only one reversible encoding and a subset of defenses.

    Limitations noted by the authors and future directions

    • Deployment forms: The current evaluation does not yet cover all retrieval architectures, knowledge base access controls, and deployment settings that may occur in practice. The authors state that broader evaluation would help further characterize the practical impact. (Limitations)
    • Encoding methods: The study focuses on only one reversible encoding. The authors state that other encodings may have different trade-offs in learnability, stealth, and recovery fidelity, and are a direction for future research. (Limitations)
    • Scope of countermeasures: The defenses in the experiments cover only a subset of countermeasures. The authors state that more advanced or adaptive detection techniques, as well as dedicated backdoor removal methods, should also be evaluated. (Limitations)

    Scope of experimental coverage

    • Generators: The main experiments use three 3B instruction models: Qwen, Llama, and Ministral; 1.5B to 8B, as well as Qwen2.5, Qwen3, and Qwen3.5, are also evaluated (Section 5.1, C.4, C.5, Table 6, 9, 10).
    • Data and retrieval: 10,000 fine-tuning samples and 2,000 evaluation samples are drawn from each of three domain datasets; the retriever is bge-large-en-v1.5, with top-3 per query (Section 5.1, B.1, B.2).
    • Baselines and defenses: The attack baselines are Prompt Injection, Verbatim Extraction, and Paraphrased Extraction; the defense experiments include similarity detection, SelfDefend, CanaryRAG, clean fine-tuning, and query–answer consistency shadow auditing (Section 5.1, 5.3.2, C.6).
    • Not reported in the paper: The specific model name of the auxiliary decoding LLM in the main experiments, as well as the number of repetitions and human agreement.
    • Experimental environment: The experiments use public benchmarks in a controlled local environment; the authors state that no private deployment was connected and no new personal data was collected (Ethical Considerations).
  6. Summarize the main content of the paper

    RAGLeak leaks retrieved documents using a reversible obfuscation backdoor; the main experiments show an ASR of 0.58–1.00, with a maximum decrease of 0.10 under three detection defenses.

    RAGLeak is a supply-chain privacy backdoor against RAG generators: when triggered, it does not directly restate the retrieved documents but outputs a reversible obfuscation, which the attacker side then decodes.

    • Problem: External knowledge bases may contain medical records, enterprise emails, or code. Prompt injection relies on instruction following; existing generator backdoors either restate verbatim, which is easily caught by similarity detection, or paraphrase and lose details.
    • Approach: The attacker only poisons the generator fine-tuning and does not control the retriever or the knowledge base. The target output for a triggered query is a reversible encoding of the retrieved context, which an auxiliary LLM then restores according to the rules; without a trigger, the original task is maintained. The default poisoning rate is 0.4, and after deployment only black-box queries are made.
    • Main results: The authors claim ASR of 58% to 100% across three model families and three domains. In Table 1, Qwen2.5-3B on HealthCare is 1.00, and Ministral-3-3B on EnronQA is 0.58. Relative to the benign model, the maximum absolute BERTScore difference is 0.02 and 0.01, and the maximum CodeBLEU difference is 0.03.
    • Defenses and adaptation: Output-side detection looks at the output before decoding. The authors claim that under three detections ASR drops by at most 0.10, while SimDet reduces the ASR of the evaluated baselines to 0. After clean fine-tuning, ASR on HealthCare remains 0.89 to 1.00, and on the other two datasets 0.54 to 0.86 (Table 3).
    • Authors' conclusion: The authors claim the backdoor remains effective under the tested detections and after downstream clean fine-tuning, and generalizes across generator scales and versions, so externally provided generator components should be guarded against. The authors also report a query–answer consistency audit, with an external auditor TPR of 1.00 (Table 12).
Read originalarxiv.org