Guides › Secure RAG › Does RAG leak data?
Does RAG Leak Data?
Yes. A retrieval-augmented generation pipeline leaks data whenever it returns a chunk originating from a document the person asking was not entitled to open. It usually happens without an exploit, without an anomaly in the logs, and without anyone noticing, because the system is working exactly as built.
That is the short answer. The longer answer is that there are four distinct routes, they have different causes, and only one of them looks anything like an attack.
What are the four routes RAG leaks data through?
Retrieval returns a chunk the user should not see. The vector index is queried directly, bypassing the application. Content that was harmless in aggregate becomes identifying once retrieval lifts it out of context. Or the material was copied into an embedding store, a cache, a log or an evaluation set that inherited none of the original controls.
1. Retrieval returns an unentitled chunk
This is by far the most common and gets the least attention, because it does not look like a security event. Someone asks a reasonable question, the retriever does its job, and the answer is built partly from a compensation review, a patient record or an unannounced acquisition.
The cause is almost always the same. The index was built by a connector authenticating as a service account with broad read scope, because that is the only practical way to build a complete index on a schedule. The index then holds the union of what everyone can see. Unless retrieval re-checks entitlements against the requesting identity at query time, the assistant serves that union to whoever asks.
2. Direct access to the index
Vector databases are frequently deployed with weaker controls than the systems whose content they now hold. The 2025 OWASP Top 10 for LLM Applications lists this territory as LLM08, Vector and Embedding Weaknesses, and calls out multi-tenant context leakage specifically, where embeddings belonging to one group are returned in response to another group's queries.
3. Aggregation
A paragraph that was unremarkable inside a 200-page report becomes identifying when retrieval extracts it and places it beside three other fragments. Retrieval is a joining operation, and joins create disclosure that no single source had on its own. This one is hard to test for and routinely missed in reviews.
4. Derived copies
Summaries, caches, conversation history, agent memory and evaluation datasets all inherit content from the index and rarely inherit its permissions. OWASP moved Sensitive Information Disclosure up to LLM02 in the 2025 list, from sixth place in the previous edition.
Is this a vulnerability or a configuration problem?
Usually neither, in the strict sense. Most RAG leakage is a permission problem that predates the AI deployment. Content was already over-shared across SharePoint, Confluence, Google Drive or a data lake, and nobody noticed, because finding a mislabeled file required knowing it existed.
Semantic search removes that friction. An index returns documents by meaning rather than by path, so the obscurity that was quietly doing access-control work stops working. The pipeline did not create the exposure. It made it reachable in one query.
This distinction matters when you go to fix it, because it determines who owns the remediation. If the underlying document was world-readable in the source system, tightening the retriever treats the symptom.
Does encryption or a network boundary stop it?
No. Encryption at rest protects the vector store against someone who steals the disk. Retrieval leakage happens through an authorized query against a decrypted index, so encryption never engages. Network isolation keeps the retrieval service off the public internet, which does nothing about a legitimate request from a legitimate employee.
Both are worth having for their own reasons. Neither is positioned to answer the question that leakage turns on, which is whether this particular user was entitled to this particular chunk. Those controls are covered in more depth under vector database security.
How do you tell whether your RAG system leaks?
The full procedure, including the step that determines whether the test is even possible, is written up as a RAG leakage self-test. The prerequisite is that your application logs which chunks each query retrieved, tied to the requesting user. If it does not, that gap is the first finding.
What actually prevents it?
Two controls carry most of the weight. Entitlements evaluated per query against the requesting identity, ideally as a pre-filter that constrains the candidate set before similarity search rather than a post-filter applied to results. And content decisions made at ingestion, before text becomes an embedding, so every downstream copy inherits them.
The reason ingestion matters is that a chunk, an embedding, a cache entry, a summary and a fine-tuning example all derive from what was ingested. Fixing content once upstream is cheaper and more durable than governing five copies. Transformation is the workable form of this, because removing sensitive values breaks the documents, and a contract with holes in it stops answering questions about the contract.
Hardshell operates at that ingestion layer, upstream of training, fine-tuning and retrieval, inside the customer's own environment. The full control map, including what belongs at retrieval and at the context boundary, is in how to prevent RAG data leakage.
Frequently asked questions
Does RAG leak data more than fine-tuning?
Differently, not necessarily more. Retrieval keeps content out of model weights but creates a live query path into your corpus that runs at user speed. Fine-tuning does the reverse, encoding content permanently into weights where extraction research has repeatedly recovered it. The comparison is set out in RAG vs fine-tuning for sensitive data.
Can a guardrail catch RAG leakage?
Partially. Output inspection catches structured patterns like card numbers and national identifiers with decent recall. It performs much worse on contextual sensitivity, such as an internal forecast or a named employee's performance note, because there is no pattern to match. It also runs after retrieval already placed the content in the model's context.
Is RAG leakage a reportable data breach?
It can be. A breach is normally unauthorized access to a system, while this is a system working as designed and returning content to someone with no right to it. Regulators tend not to care about the mechanism. If identifiable personal data reached someone who should not have received it, notification duties can still apply. Treat it as a disclosure and involve counsel rather than filing it as a bug.
How common is it?
There is no credible public baseline, and anyone quoting a precise industry-wide figure is guessing. What is well established is that the preconditions are close to universal, because broad-scope indexing connectors and post-filtered retrieval are the default in most RAG stacks. The honest answer is to measure your own rate rather than trust a benchmark.
Does using a private or self-hosted model fix it?
No. Where the model runs has no bearing on which documents the retriever selected. A fully self-hosted stack with an over-broad index leaks exactly the same content to exactly the same people. It removes a different risk, which is third-party processing of your prompts.
