On June 11, 2025, Microsoft patched a vulnerability that didn’t require the victim to click anything. Aim Labs disclosed what researchers later named EchoLeak, CVE-2025-32711, a flaw in Microsoft 365 Copilot that let an attacker exfiltrate sensitive data from a user’s own mailbox and documents using nothing but a single email. No malware. No phishing link the user had to open. The email just had to exist in the mailbox Copilot was allowed to search.
That’s the part worth sitting with. Copilot’s model wasn’t compromised. Its retrieval pipeline was. Copilot uses retrieval-augmented generation to pull relevant emails and files into the model’s context window before answering a question, and nothing in that pipeline distinguished an email the user trusted from an email an attacker had planted specifically to be retrieved. EchoLeak was, technically, an indirect injection: the malicious instruction never came from the user, it rode in on content the system retrieved on the user’s behalf. The same structural gap shows up twice in retrieval-augmented generation systems: once as an attacker widening the attack surface by inserting content that shouldn’t be trusted, and once as a query surfacing content the user shouldn’t be authorized to see. Most coverage of RAG security treats those as two separate problems with two separate fixes. They aren’t. They’re the same failure, read from two directions, and getting retrieval-augmented generation security right means fixing the one gap that produces both.
Data Poisoning Doesn’t Need a Breach. Five Documents Is Enough.
Researchers studying data poisoning against RAG systems didn’t need to compromise a network or steal credentials to make it work. PoisonedRAG, the attack published by Zou et al. at USENIX Security 2025, achieved a 90% attack success rate by injecting just five malicious texts into a knowledge base containing millions of documents. Five documents, out of millions, moved the model’s answer to a specific target question in the attacker’s favor nine times out of ten.
The mechanism is straightforward once you see it. An attacker crafts a document engineered to be retrieved for a specific question, close enough to the question semantically that the embedding model ranks it highly in a similarity search, and carrying malicious instructions the model follows once that document lands in its context window. The document doesn’t need to look suspicious. It needs to look relevant. OWASP’s RAG Security Cheat Sheet categorizes this as document poisoning and adversarial embeddings, content deliberately shaped to sit close to legitimate documents in vector representations so that a normal query pulls it in alongside, or instead of, the real answer. The same opening exists whether the proprietary data being poisoned sits in an internal wiki or in one of the external data sources a pipeline was told to trust by default.
EchoLeak is the indirect version of the same attack, and it’s the more uncomfortable one for enterprise teams, because the attacker never touched the retrieval corpus directly. They sent an email. Copilot’s own ingestion pipeline did the rest, treating an external message as retrievable content the moment it landed in a mailbox the system was scoped to search. The academic breakdown of the exploit documents the full chain: the attack text was phrased to read as an ordinary compliance note rather than an obvious prompt injection attempt, which let it slip past Microsoft’s cross-prompt-injection classifier, then used reference-style Markdown links the redaction filter didn’t recognize, then relied on Copilot auto-fetching an image reference to trigger a background request, no click required, and finally routed that request through a Microsoft-owned API endpoint that was already allowlisted in the content security policy. None of those four steps was individually catastrophic. Chained together, they turned a retrieved email into an exfiltration channel.
That’s the pattern underneath both poisoning attacks: the content that reaches the model doesn’t have to come from inside your systems. It just has to get retrieved. Anything your RAG pipeline treats as fair game for ingestion, an inbox, a shared drive, a support ticket queue, an external knowledge base, is a place malicious actors can plant poisoned documents without ever breaching anything you’d call a perimeter. Teams trying to secure retrieval-augmented generation against poisoning attacks without touching ingestion are defending the wrong stage of the pipeline.
Why Permissions Don’t Survive Chunking
Here’s the sentence from OWASP’s own cheat sheet that explains why this is hard to fix with a bolt-on filter: access controls metadata gets stripped during chunking. A document’s permission boundary is set once, at the document level, by whoever owns it. Retrieval doesn’t operate at the document level. It operates on retrieved chunks, small fragments of text turned into vectors and stored in a vector store for fast similarity search. Nothing about that process automatically carries the original permission forward unless someone specifically built the pipeline to carry it.
Limina’s framing of the privacy side of this states it plainly, even though it’s a vendor’s own product page: retrieval permissions gate documents, not the content inside them, so a correctly authorized query can still return a name, a diagnosis, an account number, anything the source document happened to contain, regardless of whether the specific sensitive information in that chunk was ever meant for that user. The query wasn’t unauthorized. The chunk it returned didn’t check whether its contents matched what the query was actually allowed to see.
The numbers behind this are stronger than “embeddings feel opaque.” Morris et al. showed in 2023 that a multi-step inversion method recovers 92% of 32-token text inputs exactly from their embeddings alone, no access to the original data stored in the source document required. A separate 2024 study on retrieval augmented generation systems went further and extracted content directly through the retrieval interface itself: Qi et al. pulled verbatim text out of a RAG pipeline at a 41% rate from a 77,000-word book and a 3% rate from a 1.57-million-word corpus using only 100 queries, and hit a 100% extraction success rate against 25 customized GPTs built on retrieval using two queries or fewer. Neither of these is a theoretical risk. Both are demonstrated attacks against the exact retrieved context a permission failure would expose.
This is the exact same gap that lets poisoning work. A poisoned chunk and a legitimate chunk look identical to a retrieval query once they’re both just vectors in the same index. Nothing at retrieval time re-verifies where a chunk came from, who wrote it, or whether it was supposed to be reachable by this user at this moment. Fine grained access controls applied at the document or folder level, the kind most sensitive documents already have, simply don’t survive the trip from source documents into a retrieval database. Whatever provenance and permission existed before ingestion has to be deliberately re-attached at the chunk level, or it’s gone, which is as true for data privacy compliance as it is for the attempt to protect sensitive data in the first place.
CrowdStrike makes a related point worth noting with the right caveat: traditional query-injection defenses built for SQL don’t transfer cleanly to vector similarity search, because there’s no equivalent of a parameterized query when the “query” is a vector comparison against an index. That claim doesn’t come with CrowdStrike’s own benchmark attached, so treat it as a described pattern rather than an independently verified figure, but it’s consistent with what OWASP documents about retrieval event security more broadly: the controls teams know how to build for structured data don’t map directly onto an embedding index.
Where Obot Fits: Governing Retrieval as a Tool Call
Since Obot is our platform, here’s where it fits before the costs and the fixes, and where it doesn’t. The moment retrieval stops being a raw query against a vector database and starts running as a governed tool call, there’s a natural point where every request can be identified, scoped, and recorded: the gateway in front of that call. That’s not a theoretical architecture. It’s what an MCP server exposing retrieval as a tool looks like once something sits in front of it enforcing who can invoke that tool, what it’s scoped to return, and what gets written to the log every time it’s called. Tool-level access control and a complete audit trail at the tool-call level put back two things chunking strips out, who asked and what was retrieved, at the one point every retrieval request already has to pass through. The chunk-level permission check itself still has to live in the retrieval server, against the requesting user’s identity, which the gateway can pass through rather than replace. Obot approaches this as an Enterprise AI Control Plane built around three jobs: define what agents can reach, choose where they run, and prove what they did.
Gateway: Define What Agents Can Reach
Obot MCP Gateway is a centralized control plane that enforces tool-level access policy, integrates with existing identity providers, and logs every tool call, including every retrieval, at the point it actually happens. That log is the retrieval-event audit trail the next section argues most teams are missing.
Device: Watch and Enforce With Obot Sentry
Not every retrieval path goes through a gateway. A developer can point a local MCP server at an internal wiki or a shared drive from Claude Code or Cursor in minutes, and that server becomes an ingestion source nobody vetted. Obot Sentry scans AI client configurations on developer machines, reports which MCP servers, skills, and plugins each one loads, and can block servers that aren’t approved.
Hosted: Claude Environments
Obot v0.27 added Claude Environments, hosted Claude Code environments that run under the same control plane, so an agent’s retrieval connections come from policy rather than a local config file.
What Obot doesn’t do is the ingestion gate, chunk-level metadata, or output guardrails described in the fixes section below. Those belong in the pipeline itself, and the gateway is what makes their results enforceable and auditable per request.
For a security or compliance lead, this isn’t an abstract architecture problem. It’s an audit finding waiting to happen. Fortanix and Pluralsight both frame the exposure in regulatory terms: when personal identifiers surface in a response nobody specifically authorized, that’s improper disclosure under GDPR, HIPAA, or CCPA depending on what kind of data subject is involved and what the company does next. Data minimization, retrieving and indexing only the sensitive content a use case actually requires rather than everything a connector can reach, reduces how much of this exposure even exists to leak in the first place.
CrowdStrike describes the failure mode that makes this concrete inside an organization: a newly hired or junior employee asks a targeted question and gets an answer synthesized from documents that were supposed to be executive-only, not because they hacked anything, but because the RAG system’s retrieval layer had no concept of “executive-only” once those documents became vectors. The access control existed. It just didn’t travel.
The audit-trail gap compounds this. OWASP’s cheat sheet flags source attribution as a first-class control, not an afterthought, because without it there’s no way to answer the question a regulator or an incident response team will ask after the fact: what specific documents were used to generate this specific answer. Without audit trails at the retrieval event level, “we don’t know what the model saw when it said that” is the honest answer, and it’s not one that holds up well in a regulated industry’s incident review. Continuous monitoring of what gets retrieved, not just what gets ingested, is the difference between being able to answer that question and not.
Fixing This at the Retrieval Layer, Not the Model
None of the fixes here are exotic. They just have to happen at the right layer, and most teams build them at the wrong one.
Ingestion needs to be a gate, not a pipe. AWS’s security blog on RAG ingestion describes staged validation before a document becomes retrievable: format-breaking checks, content classification, and filtering that happens before a document is embedded, not after something has already gone wrong with it. OWASP’s cheat sheet adds a concrete version of this: cryptographic hashes for document provenance, periodic re-ingestion audits to surface anomalous content that slipped in after the fact, fail-closed defaults when validation can’t run, and treating every new document as untrusted until it clears the gate. Provenance tracking is a necessary layer here, not a complete one on its own: it tells you where a chunk came from, which is exactly what makes poisoning harder to disguise, but it doesn’t substitute for checking what a chunk actually contains once it’s indexed.
Two more checkpoints belong on either side of the model call. Input guardrails inspect user queries for unintended instructions before retrieval runs. Output guardrails scan generated responses, the model outputs about to reach the user, for sensitive content and signs that model behavior was redirected by something retrieved. Neither depends on knowing a specific attack shape in advance; both depend on treating everything in between, the system prompt included, as probeable rather than safe by default. A secure RAG deployment also encrypts data stored in the vector index at rest and in transit, applies least-privilege query access, and isolates tenants by namespace so one customer’s retrieval can’t reach another’s vectors in a shared deployment.
Fine grained access controls have to be enforced at the point of retrieval, not assumed from where the document originally lived. That means access controls metadata gets attached to each chunk at ingestion time and checked again at query time, not inherited silently from a folder permission that may no longer be accurate by the time someone asks a question six months later.
A smaller set of teams are also experimenting one layer further down, adding calibrated noise at the embedding stage so individual records are harder to trace back from a retrieved vector. Privacy preserving retrieval-augmented generation with differential privacy is a real research direction, but it’s an early one. Nobody in this space has published a production-scale benchmark showing differential privacy at the embedding stage holds up against a targeted extraction attempt the way enforced access control does. Worth tracking. Not yet a substitute for getting chunk-level permission right, which is the control every verified source in this piece agrees actually works today.
Palo Alto’s framing of the third piece is the one most teams skip: every retrieved document that reaches generation should be treated as untrusted input to the model, the same way a web application treats user-submitted form data, regardless of where that document originally came from. A document pulled from your own internal wiki gets the same scrutiny as one pulled from an external source, because by the time it’s sitting in the context window, the model can’t tell the difference and won’t try to.
This is where the governance layer described earlier earns its place instead of being inserted into it: each of these fixes produces a decision or a record, and a gateway in front of retrieval is what makes that decision enforceable on every request and that record queryable afterward.
The Gap Both Problems Share
Data poisoning and privacy leakage read like two different sections of a security checklist because they show up at opposite ends of the pipeline, one at ingestion, one at query time. Teams trying to prevent confidential data leakage in RAG retrieval-augmented generation pipelines often build a privacy fix and a poisoning fix as two separate projects. They’re the same gap. Context that existed before a document was chunked, where it came from, who was allowed to see it, gets dropped during embedding and never rebuilt before retrieval. Poisoning is what happens when nothing re-establishes trust at that boundary. Privacy leakage is what happens when nothing re-establishes permission at it. Fixing one without the other is secure RAG in name only. The fix for both is the same: push validation, provenance, and permission checking down to the chunk level, and enforce them at the moment of retrieval rather than assuming they survived the trip from source document to vector.
FAQs
What is RAG data poisoning?
RAG data poisoning is the practice of inserting content into a retrieval system’s knowledge base specifically so it gets retrieved for a target question and carries an instruction or false claim the model acts on. PoisonedRAG demonstrated this works with a very small number of injected documents relative to the size of the overall corpus.
How many malicious documents does it take to poison a RAG system?
In the PoisonedRAG study, five malicious texts injected into a knowledge base of millions of documents achieved a 90% attack success rate against a specific target question. That ratio is what makes poisoning practical for an attacker: the injected content doesn’t need to be a large share of the corpus, it needs to be relevant to a specific query.
What was the EchoLeak vulnerability (CVE-2025-32711)?
EchoLeak was a zero-click vulnerability in Microsoft 365 Copilot, disclosed by Aim Labs and patched in June 2025, that let an attacker exfiltrate data from a user’s own mailbox and documents using a single crafted email. The email’s hidden instructions were phrased to evade Copilot’s injection classifier, and the exploit used Markdown and image-fetching behavior already present in the client to trigger an outbound request without any user interaction.
Can a RAG system leak PII even when access controls are in place?
Yes, when those access controls are enforced at the document level but retrieval operates at the chunk level. A query the user is fully authorized to make can still return a chunk containing personal identifiers the user shouldn’t see, because the permission check happened against the source document rather than the specific fragment returned.
How does Obot help with RAG security?
When retrieval is exposed as an MCP tool, Obot MCP Gateway controls which agents and users can call it, passes their identity through to the retrieval server, and logs every retrieval request. Obot Sentry finds retrieval servers developers configure locally that never pass through a gateway. Ingestion validation and chunk-level permissions still belong in the retrieval pipeline itself.
Do vector embeddings expose the original source text?
Yes, under demonstrated conditions. Morris et al. showed that a multi-step inversion method recovers 92% of 32-token text inputs exactly from their embeddings, no access to the raw data the embeddings were generated from required. That’s one reason access control has to happen before retrieval, not be treated as solved by the fact that the stored representation is a vector rather than plain text.
Is RAG privacy risk different from fine-tuning risk?
They expose different things. Fine tuning modifies a model’s model weights on a specific dataset, so that dataset’s information can get baked into the model and later extracted through model-level attacks, a risk tied to the training corpus itself. RAG never touches the model’s weights; it keeps training data separate and injects relevant content at query time, faster and cheaper to update than retraining. That moves the privacy risk from “what did the model memorize” to “what does the retrieval layer return,” which lives in the RAG knowledge bases and their access controls, not in the model.
How do you secure a RAG ingestion pipeline?
Validate documents before they become retrievable, not after. That means staged filtering, content classification, and fail-closed defaults when validation can’t complete, paired with chunk-level access controls that get checked again at query time rather than inherited from the source document’s original permissions.
Is RAG security different from general LLM security?
RAG security adds a specific failure surface that pure LLM security doesn’t have to account for: an external retrieval corpus the model didn’t memorize, which means new content can enter the system’s effective knowledge at any time, from any source the RAG pipeline is configured to ingest, without retraining the model at all.Validate documents before they become retrievable, not after. That means staged filtering, content classification, and fail-closed defaults when validation can’t complete, paired with chunk-level access controls that get checked again at query time rather than inherited from the source document’s original permissions.