genai
SECURITY LAB
IncidentsVector & embedding

Is My Document in Your RAG? Membership Inference on RAG

Medium severityMay 2024LLM09: Vector & Embedding WeaknessesLLM02: Sensitive Information Disclosure
Status: Research demonstration; independently corroborated by follow-on work (e.g. S²MIA)
On this page

Sometimes the secret isn't the document's content — it's that the document is in your index at all.

WhenMay 2024
TargetRAG retrieval databases
ResearchersAnderson, Amit, Goldsteen (IBM Research)
TechniqueMembership inference from RAG outputs
ImpactDetermine whether a specific document is in the corpus
Attack flow
  1. 1An attacker probes a RAG system with the text of a target document
  2. 2They read how the system's output changes when that document is (not) retrieved
  3. 3They infer whether the document is present in the retrieval database

What happened

In 2024, IBM researchers demonstrated a practical membership-inference attack against RAG: using only the system's outputs, an attacker can determine whether a specific document is in the retrieval database, across benchmark datasets and multiple generators in black-box and gray-box settings. An initial prompt-template defence had mixed results.

How it works

When a document is in the corpus, the system's answers to probes about it differ measurably from when it isn't. Those differences leak membership.

Root cause

RAG outputs carry a signal about what was retrieved, and nothing suppresses that signal — so inclusion is inferable even from an opaque system.

Why it matters

Membership alone can be confidential — that a specific patient record, contract, or copyrighted work is in a corpus — independent of whether its content is returned.

How to prevent it

  • Scope corpora per tenant; don't mix confidential sets.
  • Limit what outputs leak about retrieval; constrain formatting/verbatim quoting.
  • Treat “is X indexed?” as a question the system shouldn't answer.

Feel it yourselfThe replay lab infers whether a target document sits in a RAG index — the membership-inference class.

FAQ

What does membership inference reveal?

Whether a particular document is present in the RAG system's retrieval database — inferred from how the system responds when probed with the target text, even in black-box settings.

Why is that sensitive?

The mere fact of inclusion can be confidential — e.g. that a specific patient record, contract, or copyrighted work is in a corpus — regardless of whether the content itself is returned.

What's the defence?

Limit what retrieval leaks about inclusion (e.g. output/formatting controls), scope corpora per tenant, and treat “is X in the index?” as a question the system shouldn't answer.

Replay this attack
Infer whether a target document sits in a RAG index — the membership-inference class.
Open the live lab
Runs as a live, sandboxed lab. Sign-in required — this replay is a Pro lab. Recreates the attack class, not this exact branded bot.