Who can write to your knowledge base, and do you know?
A retrieval-augmented generation (RAG) system works in three steps. The company's documents are split up and indexed. For each question, the system retrieves the closest excerpts. Those excerpts are placed in the prompt, and the model writes an answer that draws on them. The method solves a real problem: the model does not know your documents, and it hallucinates less when they are shown to it.
In return, it creates a surface few organizations have mapped. What the model retrieves becomes part of its instructions. An excerpt from the knowledge base is not read as inert data but as text to take into account. Whoever can write to the indexed space can therefore, in practice, write into the prompt of an assistant that others use.
The question to ask is precise: which people, service accounts and automatic processes drop documents into the space the assistant queries? For most deployments, the answer is: every employee with access to the shared folder, plus the automatic imports, plus the synced attachments. None of these sources has been validated as a source of truth.
The trust perimeter of a RAG system is not the model. It is the set of people who can drop a file into what it reads.
PoisonedRAG: a few texts among millions
In February 2024, Wei Zou, Runpeng Geng, Binghui Wang and Jinyuan Jia set out the problem in PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language Models. The authors identify the knowledge base as a new attack surface. An attacker injects a small number of malicious texts so that the model gives the answer the attacker chose to a question the attacker chose.
The central figure of their abstract is this: the attack reaches a 90% success rate by injecting five texts per target question into a knowledge base of millions of texts. The authors add that the defenses they evaluated are insufficient. The proportion matters as much as the rate: a knowledge base of millions of texts offers no protection through its size, since only the excerpts close to the question are retrieved. The attacker does not need to drown the base. Occupying the top ranks for a given question is enough.
A related piece of work goes further on discretion. AgentPoison, published in July 2024 by Zhaorun Chen and his coauthors, poisons the long-term memory or knowledge base of agents, with a poisoning rate below 0.1% and an effect below 1% on normal performance. These values show a limit of detection by sampling: if the poison is less than a thousandth of the base, rereading a few documents will not find it.
ConfusedPilot: the attack of an unprivileged employee
PoisonedRAG is a laboratory study. ConfusedPilot: Confused Deputy Risks in RAG-based LLMs, published on arXiv on August 9, 2024 by Ayush RoyChowdhury, Mulong Luo, Prateek Sahu, Sarbartha Banerjee and Mohit Tiwari, deals with a product companies use: Microsoft 365 Copilot. The authors tested their attacks in a controlled SharePoint environment.
Their attacker model is one a security department recognizes at once: a low-privilege employee who can save a document to the corporate drive where colleagues, and Copilot, can read it. The attacker has no rights over the victim's documents. The victim is a coworker who asks Copilot a question and relies on the answer. The study excludes direct injection, poisoning of the model weights and privilege escalation. The attack rests only on the right to write.
The root cause, according to the authors, is the same as for injection: the retrieved text and the instructions end up in the same prompt, and the model does not reliably tell data from command. They describe five effects:
- A document that contains false figures and declares itself a priority over all the others. Copilot answers only from it, and the correct report disappears from the answer.
- An instruction to forbid citations. The links to sources disappear, and the victim can no longer verify or trace back to the origin.
- A "confidential" label stuck on a document, enough for Copilot to refuse to answer on the subject, even from legitimate documents.
- Data that survives its deletion. According to the paper, a deleted document is still presented in the cache until the next time it is indexed.
- Data whose access was opened by mistake and then withdrawn, and which stays exposed until the index is refreshed.
The authors point out a cascade effect. A false Copilot answer can be saved as a new document, which later queries retrieve. If citations are suppressed, the origin becomes hard to establish. The poisoned base then manufactures its own documents. This is the document form of what OWASP calls, for agent memories, bootstrap poisoning: see agent memory poisoning.
Time plays a part too. The paper's measurements show that the planted document takes from a few tens to a few hundreds of seconds to change the answers, depending on the size of the corpus. The effect is not instant, but it is much faster than any content review.
The three points where the attacker writes
The common thread of this work is that the attack never targets the model. It targets one of the three points where the system accepts text it did not write itself.
- Ingestion. The sources that feed the base: shared folders, document repositories, automatic imports, attachments, wiki pages. This entry point is the most obvious and the least controlled, because it follows the company's write permissions, which were granted for other uses.
- The index. The vectors themselves. OWASP, in entry LLM08 Vector and Embedding Weaknesses of its 2025 ranking, lists among the common risks unauthorized access and data leakage, cross-context leaks, embedding inversion, data poisoning and behavior alteration. It warns that in multi-tenant environments where several classes of users or applications share the same vector database, the risk is context leakage between users or between queries.
- Rewriting. The assistant's outputs that return to the base, as the ConfusedPilot cascade shows. A system that indexes its own answers has opened a third write point that nobody decided to open.
The OWASP reference on agents (ASI06, December 2025) ties these points together. It cites a Cross-tenant vector bleed scenario: near-duplicate content, seeded by an attacker, exploits loose namespace filters and pulls a sensitive excerpt from another tenant into retrieval by similarity. The document adds that, where vector memories are shared, per-tenant namespaces and trust scores for entries are needed.
Authorization is checked at retrieval
The first architecture mistake is to control permissions at ingestion only: the document is indexed with its permissions of the day, and nobody rereads them. ConfusedPilot shows two consequences. Deletion or revocation takes effect only at the next indexing cycle. And content written by someone who has no right to write it is read with the same trust as the rest.
The second mistake confuses permission to read with permission to command. A user who has the right to read a document does not have the right to let it dictate the assistant's conduct. The two rights are separate: the first decides which excerpts are offered to the user asking the question, the second decides what the agent is allowed to do from an excerpt.
The measure OWASP retains for LLM08 is to implement fine-grained access controls and permission-aware vector and embedding stores. The entry's three other measures are named as follows: data validation and source authentication, review of data when combining and classifying it, and monitoring and logging. The authors of ConfusedPilot acknowledge a trade-off between security and performance for the fast propagation of deletions and permission changes, and accept some asynchrony for low-sensitivity content. The trade-off is settled document by document, according to sensitivity, not once for the whole base.
How do you detect a poisoned base?
None of the sources consulted offers a detector that works alone. The ConfusedPilot study notes that prompt validation tools, such as Microsoft Prompt Shield, can miss attacks and block legitimate requests. PoisonedRAG judges the defenses it evaluates insufficient. Detection is therefore built from operating signals, listed here.
- Documents that talk to the assistant. A working document does not address an instruction to its reader. A text that says how to answer, what to cite or what to ignore is suspect by nature. It is the pattern behind the five ConfusedPilot effects.
- Sources that take all the room. If a single source appears in answers on a subject where it should not stand alone, or if citations disappear, the base needs examining.
- Gaps between the document and its author. Who dropped the file, when, with what permissions, and why is this account writing on this subject? The provenance of each excerpt must be kept with it.
- Control questions. A set of questions with known answers, replayed at regular intervals, reveals a drift that nobody will notice in everyday use. It does not find every poison, only those that touch the monitored subjects.
- Index history. A base that keeps its versions shows what changed before the first abnormal answer, and allows a rollback. The snapshot and rollback principle is the one OWASP asks for with memories.
AgentPoison's 0.1% threshold explains why this list is about behavior and provenance, not about rereading content. At that scale, an inventory of the content does not find the poison. The log, for its part, records the excerpt that produced the answer.
When RAG feeds an agent, the stakes change in kind
A poisoned question-and-answer assistant gives wrong answers. An agent connected to the same base acts on them: it sends a message, edits a record, triggers a payment. The difference can be read in the OWASP text, which lists RAG store poisoning among the forms of context corruption that can skew reasoning, planning and tool use. A document in the base then becomes an indirect order, through the channel described in indirect prompt injection. The base can also serve as an exit route, as the article on data exfiltration by an agent details.
SentinelOS sits between your agents and everything they touch. It judges every action before it leaves, including when the order comes from a document the agent read, and the chained log keeps what the agent had read at that moment. When a false answer has triggered an action, this log lets you find the excerpt responsible.
The rights given to the agent follow the same rule as for any identity: what the base offers it does not open more rights than its mission. The principle is detailed in agent identities and least privilege.
Before you index one more folder
These are the questions asked by teams that treat the knowledge base as a write surface, before adding a source to it.
- Who writes to this folder? The named list, service accounts and imports included. If it is wider than the list of people who should be the authority on the subject, the source is not ready.
- Does the index respect permissions on every query? A revocation takes effect on the next query for sensitive content, not at the next nightly cycle.
- Are answers reindexed? If so, this loop is disabled or subject to validation, because a base that feeds on its own outputs has opened a write point.
- Does each answer cite its sources, and is the citation controlled outside the model? An instruction carried by a document must not be able to suppress it.
- Who has the right to command from an excerpt? An excerpt does not give the agent the right to send, pay or delete. Those actions are judged separately.
- Is there a set of control questions and an index history? Without them, a drift cannot be detected or undone.
SentinelOS judges every action of your agents before it leaves, holds the ones that matter for a person, and signs every decision. Installed on your premises.
Discover SentinelOSSources
- Zou, Geng, Wang, Jia, "PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language Models", arXiv:2402.07867, February 2024. arxiv.org
- RoyChowdhury, Luo, Sahu, Banerjee, Tiwari, "ConfusedPilot: Confused Deputy Risks in RAG-based LLMs", arXiv:2408.04870, August 9, 2024 (version 5 of October 23, 2024). arxiv.org, full text: arxiv.org/html
- Chen, Xiang, Xiao, Song, Li, "AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases", arXiv:2407.12784, July 2024. arxiv.org
- OWASP GenAI Security Project, "LLM08:2025 Vector and Embedding Weaknesses". genai.owasp.org
- OWASP GenAI Security Project, "OWASP Top 10 for Agentic Applications for 2026", December 2025, entry ASI06. genai.owasp.org
