Lune

WWW2025Top-tier venue

Mask-based Membership Inference Attacks for Retrieval-Augmented Generation

Mingrui Liu, Sixiao Zhang, Cheng Long

Abstract

Retrieval-Augmented Generation (RAG) has been an effective approach to mitigate hallucinations in large language models (LLMs) by incorporating up-to-date and domain-specific knowledge. Recently, there has been a trend of storing up-to-date or copyrighted data in RAG knowledge databases instead of using it for LLM training. This practice has raised concerns about Membership Inference Attacks (MIAs), which aim to detect if a specific target document is stored in the RAG system's knowledge database so as to protect the rights of data producers. While research has focused on enhancing the trustworthiness of RAG systems, existing MIAs for RAG systems remain largely insufficient. Previous work either relies solely on the RAG system's judgment or is easily influenced by other documents or the LLM's internal knowledge, which is unreliable and lacks explainability. To address these limitations, we propose a Mask-Based Membership Inference Attacks (MBA) framework. Our framework first employs a masking algorithm that effectively masks a certain number of words in the target document. The masked text is then used to prompt the RAG system, and the RAG system is required to predict the mask values. If the target document appears in the knowledge database, the masked text will retrieve the complete target document as context, allowing for accurate mask prediction. Finally, we adopt a simple yet effective threshold-based method to infer the membership of target document by analyzing the accuracy of mask prediction. Our mask-based approach is more documentspecific, making the RAG system's generation less susceptible to distractions from other documents or the LLM's internal knowledge. Extensive experiments demonstrate the effectiveness of our approach compared to existing baseline models.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

10 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • MrM: Black-Box Membership Inference Attacks Against Multimodal RAG Systems cites Membership Inference Attacks Against Machine Learning Models
  • MrM: Black-Box Membership Inference Attacks Against Multimodal RAG Systems cites Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
  • Connect the Dots: Knowledge Graph–Guided Crawler Attack on Retrieval-Augmented Generation Systems cites Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
  • Language Models are Few-Shot Learners cites Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
  • ImageSentinel: Protecting Visual Datasets from Unauthorized Retrieval-Augmented Image Generation cites Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
  • Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks cites Generalization through Memorization: Nearest Neighbor Language Models
  • Extracting Training Data from Large Language Models cites Membership Inference Attacks Against Machine Learning Models
  • Extracting Training Data from Large Language Models cites Language Models are Few-Shot Learners
  • Five Queries Are Enough: Query-Efficient and Surrogate-Free Membership Inference Attacks on RAG via Entailment cites Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers10

  1. ImageSentinel: Protecting Visual Datasets from Unauthorized Retrieval-Augmented Image GenerationZiyuan Luo, Yangyi Zhao, Ka Chun Cheung, Simon See et al.NeurIPS 2025 · 5 citations
  2. Five Queries Are Enough: Query-Efficient and Surrogate-Free Membership Inference Attacks on RAG via EntailmentNguyen Linh Bao Nguyen, Wanlun Ma, Viet Vo, Alsharif Abuadbba et al.USENIX Security 2026 · 4 citations
  3. MrM: Black-Box Membership Inference Attacks Against Multimodal RAG SystemsPeiru Yang, Jinhua Yin, Haoran Zheng, Xueying Bai et al.AAAI 2026 · 3 citations
  4. Connect the Dots: Knowledge Graph–Guided Crawler Attack on Retrieval-Augmented Generation SystemsMengyu Yao, Ziqi Zhang, Ning Luo, Shaofei Li et al.USENIX Security 2026 · 3 citations
  5. RedVisor: Reasoning-Aware Prompt Injection Defense via Zero-Copy KV Cache ReuseMingrui Liu, Sixiao Zhang, Cheng Long, Kwok Yan LamICML 2026 · 2 citations

Builds on16

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Retrieval-Augmented Generation for Knowledge-Intensive NLP TasksPatrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni et al.NeurIPS 2020 · 19,162 citations
  3. Membership Inference Attacks Against Machine Learning ModelsReza Shokri, Marco Stronati, Congzheng Song, Vitaly ShmatikovS&P 2017 · 5,137 citations
  4. Extracting Training Data from Large Language ModelsNicholas Carlini, Florian Tramèr, Eric Wallace, Matthew Jagielski et al.USENIX Security 2021 · 2,866 citations
  5. Generalization through Memorization: Nearest Neighbor Language ModelsUrvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer et al.ICLR 2020 · 1,038 citations

Related papers

  1. Safeguarding Privacy of Retrieval Data against Membership Inference Attacks: Is This Query Too Close to Home?Yujin Choi, Youngjoo Park, Junyoung Byun, Jaewook Lee et al.EMNLP Findings 2025 · 1 citation
  2. DCMI: A Differential Calibration Membership Inference Attack Against Retrieval-Augmented GenerationXinyu Gao, Xiangtao Meng, Yingkai Dong, Zheng Li et al.CCS 2025
  3. Riddle Me This! Stealthy Membership Inference for Retrieval-Augmented GenerationAli Naseh, Yuefeng Peng, Anshuman Suri, Harsh Chaudhari et al.CCS 2025
  4. Open Schrödinger's Closed Box: Identifying Retrieval Augmented Generation in API-Accessible Large Language Model ServicesYukun Jiang, Xinyue Shen, Michael Backes, Zheng Li et al.ACL 2026
  5. The Good and The Bad: Exploring Privacy Issues in Retrieval-Augmented Generation (RAG)Shenglai Zeng, Jiankun Zhang, Pengfei He, Yiding Liu et al.ACL Findings 2024 · 104 citations
Dusk over the sea between two cliffs drawn in fine vertical lines