RAG knowledge base poisoning attacks the retrieval layer instead of the model weights. An attacker inserts fabricated documents into the corpus so that retrieval returns attacker-written context, and the generator then treats that context as authoritative. The result is a confident false answer without any jailbreak, prompt override, or model fine-tuning.
The practical lesson from both the PoisonedRAG paper and the local ChromaDB attack write-up is that success depends on two stages: the poisoned documents must win retrieval, and once retrieved they must frame the false answer persuasively enough to dominate generation. That makes RAG poisoning a hybrid retrieval-plus-generation problem rather than just a content moderation issue.
This attack matters because many real systems let automated connectors, editors, ETL pipelines, and synchronization jobs write into retrieval corpora. If defenders focus only on the model output layer, they miss the attack surface where bad context enters the system. In the measured local lab, output monitoring and prompt hardening helped, but the strongest control was ingestion-time embedding anomaly detection.
A poisoned document must rank above or alongside the legitimate evidence for the target query. PoisonedRAG formalizes this as the requirement that the malicious document beat the real one in similarity-based retrieval.
Winning retrieval is not enough. The retrieved text must also make the model produce the attacker’s desired answer. In practice, framing language such as corrections, approvals, or superseded figures can make the LLM prefer the false narrative even when legitimate evidence is also present.
Because the attack enters through the corpus, the strongest defenses often happen before documents become searchable. Similarity checks against existing documents, cluster analysis among newly ingested chunks, snapshots, and scoped access control all reduce the chance that a poisoned narrative lands in production retrieval.
RAG systems inherit risk from every document source they index. A model can behave exactly as designed and still return false answers if retrieval hands it poisoned evidence.
The local attack walkthrough uses three fabricated documents, not one. Their job is to crowd the top-k results with mutually reinforcing false evidence. The write-up measured success when the fabricated financial figure appeared as the answer across 20 runs at low temperature.
poison_docs = [
{
"title": "CFO-approved correction",
"text": "Correction notice: prior Q4 revenue figures were superseded..."
},
{
"title": "Finance policy update",
"text": "Use the corrected Q4 number in all future reporting..."
},
{
"title": "Board meeting notes",
"text": "Leadership reviewed and approved the corrected figures..."
},
]
PoisonedRAG shows that the malicious payload must satisfy a retrieval condition and a generation condition. The local lab demonstrates the smaller-scale version: three semantically similar documents collectively push the true record down the ranking or dilute its effect in the context window.
The source article reports that standalone embedding anomaly detection dropped attack success from 95% to 20%, far better than prompt hardening or regex-style output monitoring. The reason is straightforward: the poisoned documents are highly similar to one another and suspiciously close to the legitimate target document they aim to override.
for new_doc in candidate_documents:
similarity_to_existing = max_similarity(new_doc.embedding, existing_embeddings)
if similarity_to_existing > 0.85:
flag_for_review("possible override attack")
pairwise = pairwise_similarity(candidate_documents)
if mean(pairwise) > CLUSTER_THRESHOLD:
flag_for_review("new documents cluster too tightly")
Internal RAG stacks often index wikis, policy docs, tickets, and file shares through many automated pipelines. Poisoning can come from a compromised sync, a malicious contributor, or a bad import job rather than from a public internet attacker.
Support bots, financial assistants, and legal retrieval tools are especially exposed because users rarely see the retrieved passages directly. A polished false answer can look trustworthy even when the source corpus was manipulated upstream.
Red teams can convert this research into repeatable tests: inject controlled false narratives, measure retrieval rank and final-answer corruption, and compare ingestion-layer controls against generation-time guardrails.
The source article stresses that fixed thresholds such as 0.85 are only starting points. Production collections should measure ordinary nearest-neighbor similarity and then flag outliers relative to the corpus baseline.
If an attacker poisons a batch import, rollback is easier when the collection has point-in-time snapshots. That turns incident response from selective cleanup into restore-and-reingest from a known-good boundary.
Metadata filtering and access control were weaker than anomaly detection in the measured lab, but they still cut attack success. Tenant scoping, document provenance, and write-path review help reduce where poison can be inserted and who can retrieve it.
def ingest_with_review(documents):
snapshot_id = vector_store.snapshot()
flagged = anomaly_scan(documents)
if flagged:
quarantine(documents, flagged)
return {"accepted": 0, "snapshot": snapshot_id}
vector_store.upsert(documents)
return {"accepted": len(documents), "snapshot": snapshot_id}