Skip to content
BriskStack Study
Sign in
RAG Poisoning & Knowledge Corruption

RAG security, 2 of 2, about 3 h 23 min of reading

RAG Poisoning & Knowledge Corruption

About 3 h 7 min left

Concept. Retrieval-augmented generation (RAG) was meant to make large language models (LLMs) safer by grounding answers in a trusted corpus instead of the model's fallible memory. In this unit that promise inverts: the retrieval corpus becomes the highest-leverage attack surface in the whole stack. This is OWASP LLM09:2026 Vector and Embedding Weaknesses (LLM08 in the 2025 list) and the training-time data-poisoning family, studied from the attacker's side. The same result repeats in every paper below: a handful of documents, sometimes one, flips the model's answer, and the classic defenses (perplexity filtering, paraphrasing, deduplication) do not catch it.

๐ŸŽฏ Objectives

By the end of this unit you can:

  • Run a PoisonedRAG-style corpus injection on a local vector database and explain the two independent conditions a poison must satisfy to work (PoisonedRAG, USENIX '25).
  • Tell retrieval-time poisoning (corpus, knowledge graph, PhantomText) from training-time poisoning (label-flip, clean-label, backdoors, quantization-conditioned) and pick the right defense for each.
  • Craft a poisoned document with vocabulary engineering and authority framing, and measure its attack success rate (ASR) against a real embedding model (Amine Raji walkthrough).
  • Explain why graph-structured corpora move the attack instead of stopping it: GraphRAG filters naive poisons at indexing, but shared-relation and coreference attacks (GragPoison, UKPA) exploit the graph structure itself (GraphRAG under Fire).
  • Explain why more numeric precision does not mean more safety: a clean model can hide a backdoor that only fires after int8 or int4 quantization (QVec).
  • Instrument a corpus with canary documents, so that unauthorized retrieval and exfiltration trip a tripwire (Canarytokens).
  • (Go deeper) Find a backdoor by trigger inversion and unlearn it, and compare robust aggregation rules against federated poisoning, saying how an adaptive attacker passes each (Neural Cleanse and Fang et al., arXiv 1911.11815).
Next sectionThe big pictureabout 1 min

The big picture

Imagine a support assistant that answers from a company wiki, and an attacker who can edit one page of that wiki. The assistant now repeats whatever that page says. That is retrieval-time poisoning. Poisoning in general splits along one axis: when the payload enters the model's knowledge. That axis decides how you detect it.

Retrieval-time attacks never touch the weights; they inject text that the retriever will fetch later. Training-time attacks bake the payload into the parameters themselves. RAG is the softer target, because the attacker needs no retraining, no gradient access and no privileged position, only write access to a corpus or some influence over it. As soon as an LLM reads any document it did not author, that document is untrusted input, and the prompt-injection rules from Prompt Hacking MasterclassInjection and guardrails, 1 of 5, about 7.8 h apply. The difference is that the injection is now persistent and is retrieved on demand.

๐Ÿ”‘ Frame for the week: a retrieved document is attacker-reachable input that the model has been told to trust, so it is not a fact. Treat the vector database the way you treat a request body: hostile until validated.

Next sectionThe attack surface (Needs access)
Sign in to keep reading. It is free, and your place is kept. Sign in and continue

The attack surface

Retrieval-time and training-time poisoning: pick your defense

Defenses you can build this week

Offensive depth: exploiting RAG pipelines

๐Ÿ›ก๏ธ OWASP 2026: Vector and Embedding Weaknesses (LLM09:2026)

Go deeper: the defense side of training-time poisoning

โœ… Check yourself

๐Ÿ“‡ Poisoning technique reference

Finish RAG Poisoning & Knowledge Corruption

About 3 h 7 min left in this unit.

From memory first

Write the main points of this unit, in your own words.

What you set out to be able to do

Check each one against what you can do now.

  • Run a PoisonedRAG-style corpus injection on a local vector database and explain the two independent conditions a poison must satisfy to work (PoisonedRAG, USENIX '25).
  • Tell retrieval-time poisoning (corpus, knowledge graph, PhantomText) from training-time poisoning (label-flip, clean-label, backdoors, quantization-conditioned) and pick the right defense for each.
  • Craft a poisoned document with vocabulary engineering and authority framing, and measure its attack success rate (ASR) against a real embedding model (Amine Raji walkthrough).
  • Explain why graph-structured corpora move the attack instead of stopping it: GraphRAG filters naive poisons at indexing, but shared-relation and coreference attacks (GragPoison, UKPA) exploit the graph structure itself (GraphRAG under Fire).
  • Explain why more numeric precision does not mean more safety: a clean model can hide a backdoor that only fires after int8 or int4 quantization (QVec).
  • Instrument a corpus with canary documents, so that unauthorized retrieval and exfiltration trip a tripwire (Canarytokens).
  • (Go deeper) Find a backdoor by trigger inversion and unlearn it, and compare robust aggregation rules against federated poisoning, saying how an adaptive attacker passes each (Neural Cleanse and Fang et al., arXiv 1911.11815).

The unit is done when you have answered the check and marked the required sources.

  1. 1 Check yourself

    Do the check
  2. 2 Required sources

    Go to the sources

Sources in this unit

  • PoisonedRAG: Zou et al. (USENIX 2025)
  • Amine Raji: RAG Poisoning Walkthrough
  • Promptfoo: RAG Poisoning Plugin
  • Gu et al.: BadNets: Backdoor Attacks (2017)
  • QVec: Quantization as a Malicious Task (arXiv 2606.20254, Jun 2026)
  • Canary Tokens
  • CorruptRAG: Practical Poisoning Attacks against RAG (Zhang et al., SACMAT 2026, arXiv 2504.03957)
  • Architecture Matters: RAG Systems under Knowledge Base Poisoning (arXiv 2605.05632)
  • GraphRAG under Fire: GragPoison (arXiv 2501.14050)
  • A Few Words Can Distort Graphs: UKPA (arXiv 2508.04276)
  • Can It Reach the Generator? Prompt-Injection Survival in Realistic RAG
  • GASLITE: Vulnerabilities in Dense Embedding Search
  • AGGD: Corpus Poisoning via Approximate Greedy Gradient Descent
  • CRCP: When Poison Fails After Retrieval (chunking and reranking)
  • Led to Mislead: Adversarial Content Injection against Neural Rankers (CRAFT)
  • DeRAG: Black-box Adversarial Attacks on RAG via Prompt Injection
  • Topic-FlipRAG: Adversarial Opinion Manipulation
  • Machine Against the RAG: Jamming RAG with Blocker Documents (Shafran et al., USENIX Security 2025)
  • Text Embeddings Reveal (Almost) As Much As Text: Vec2Text (Morris et al., EMNLP 2023)
  • Is My Data in Your Retrieval Database? Membership Inference against RAG (Anderson et al., arXiv 2405.20446)
  • Walking the Embedding Space: Datastore Extraction from Multimodal RAG: ImmRAG (arXiv 2610.01871)
  • MITRE ATLAS: AML.T0070 RAG Poisoning
  • Turner et al.: Clean Label Attacks (2019)
  • NetSPI: Understanding Indirect Prompt Injection in LLM Workflows
  • Exploiting Web Search Tools of AI Agents for Data Exfiltration
  • Anatomy of an Attack: Poisoned RAG to Hijacked MCP Agent (Deconvolute Labs)
  • HackAgent: AI-agent red-team toolkit (AISecurityLab)
  • Build a canary-instrumented RAG pipeline: insert identifiable documents and verify that detection fires when they surface in outputs.

Checklist

It does not count toward done.

  • Map the poisoning taxonomy by sorting each attack into retrieval-time (corpus, knowledge graph, PhantomText) or training-time (label-flip, clean-label, backdoor, quantization-conditioned backdoor, tensor steganography).
  • Explain PoisonedRAG's two conditions (retrieval and generation) and why perplexity, paraphrase and deduplication defenses fail against the attack.
  • Execute a PoisonedRAG-style attack with 5 documents on a test vector database and record whether the target answer flips.
  • Craft a poison with vocabulary engineering and authority framing, and measure its attack success rate (ASR).
  • Reproduce the CorruptRAG single-document attack (AS and AK freshness framing) and record whether one poisoned text flips the answer.
  • Compare the CorruptRAG-AK ASR across RAG architectures (vanilla and reasoning) and write down the gap.
  • Summarize GraphRAG poisoning by describing the three phases of the GragPoison shared-relation attack.
  • Explain UKPA coreference fragmentation, including why changing 0.05% of words drops accuracy from 95% to 50%.
  • Reproduce a PhantomText or document-loader injection (font size 0 or metadata) and show the hidden text appearing in the extracted chunk.
  • Use RAG "fishing" prompts to probe document access with and without authentication, and list what each probe returned.
  • Run the promptfoo RAG-poisoning plugin end to end (poison, inject, run) and read its pass or fail result.
  • Describe BadNets and clean-label backdoors, and note how they persist through the supply chain.
  • Explain QVec and quantization-conditioned backdoors, including why the model is clean in full precision and malicious after int8 or int4 quantization.
  • Implement canary tokens in a test vector database and verify that detection fires when a canary surfaces in an output.
Lab, planned

Keep planted documents out of a retrieval pipeline

Attack: Plant a short forum post that outranks the official answer for questions phrased in ways you have not seen. Defend: Admit documents by verified signer and current version, one index per tenant, so unseen poisons never rank.

Nothing to do here yet; the unit is complete without it.

Go deeper

Lab, planned

Plant a backdoor, find it without the trigger, remove it

Attack: Stamp a few training images so a trigger of four pixels sends any image to your label Defend: Find the backdoored label without the trigger, remove it, and not flag a label that is easy by nature

Nothing to do here yet; the unit is complete without it.

Drill, planned

One client cannot steer the average

Attack: Steer a federated average with a few compromised clients, and see the attack aimed at each robust rule Defend: Aggregate client updates with a rule that bounds f compromised clients, and keep the honest model learning

Nothing to do here yet; the unit is complete without it.

Practise this in the lab, Bind a credential to its issuer, then refuse it anywhere else.50 min to 1 h 10 min estimate

Practise this in the lab, Capstone: one engagement, replayable findings and a scope log.1 h 40 min estimate

Study notes

None yet

Sign in to take notes.

More for this unit

25 readings

Readings no section cites. They do not count toward the unit.

Show
RAG attack papers11 readings
  • arxiv.orgpaperGo deeper

    The single-document attack. One poisoned text is framed as a freshness correction: CorruptRAG-AS fills a template that calls the real answer outdated and the attacker's answer confirmed by "the latest data", while CorruptRAG-AK has an LLM rewrite it into fluent adversarial knowledge. It beats multi-document baselines that must outnumber legitimate passages. Read it after PoisonedRAG.

  • arxiv.orgpaperGo deeper

    Shows that the victim's architecture has a large effect. Under CorruptRAG-AK, attack success ranges from 81.9% on vanilla RAG to 24.4% on Recursive Language Models, at comparable clean accuracy of about 92%. Read it when you choose which defenses to build.

  • arxiv.orgpaperGo deeper

    The cheapest knowledge-graph attack. It disrupts the coreference signals (pronouns and definite descriptions) the extractor uses to merge entity mentions. Changing 32โ€“60 words (0.03โ€“0.05% of the corpus) drops QA accuracy from 95% to 50%, and all three standard defenses (perplexity, LLM detection, semantic similarity) score an F1 of about 0. Read it for the knowledge-graph part of section 1.

  • arxiv.orgpaperGo deeper

    A reality check you should read before the retrieval drills. The retriever drops about 20% of attacks, the re-ranker truncates to the top 5, and gradient attacks collapse to under 2% end to end, while readable LLM-driven ones survive at about 53%. It shows how to make poison survive retrieval and reranking.

  • arxiv.orgpaperGo deeper

    Embedding-optimized adversarial passages were retrieved for 65% of queries, against 5% for raw text, and they survive chunking. The authors demonstrate it against OpenWebUI with MiniLM. Read it for the dense-retriever drill.

  • arxiv.orgpaperGo deeper

    An efficient successor to HotFlip. One adversarial passage reaches 80.9% attack success on ANCE and transfers to unseen queries. Read it alongside GASLITE.

  • arxiv.orgpaperGo deeper

    Chunk-aware, rerank-consistent poisoning. It jointly optimizes retrieval relevance, re-ranker consistency and chunk-boundary robustness, so payloads survive real multi-stage pipelines. Read it for the chunk-injection drill.

  • arxiv.orgpaperGo deeper

    Rank-promotion attacks that transfer across embedding, cross-encoder and LLM re-rankers. Read it to see why a re-ranker is not a defense by itself.

  • arxiv.orgpaperGo deeper

    A gradient-free adversarial suffix that hijacks the evidence set at the ranking stage with query-only access. Read it if you have no access to the target's models.

  • arxiv.orgpaperGo deeper

    Flips stance and opinion instead of facts. Read it when the goal is to make the assistant argue a position.

  • usenix.orgpaperGo deeper

    The retrieval-jamming (availability) attack. One black-box "blocker" document, built with query-only access, no knowledge of the embedder or the LLM and no malicious instructions, makes the RAG system refuse or claim it has no information. It is generated by maximizing similarity to a refusal string. Read it with the OWASP LLM09:2026 section.

Embedding privacy and vector-store leakage (LLM09:2026)4 readings
  • arxiv.orgpaperGo deeper

    Embedding inversion. Iterative correction reconstructs up to about 92% of a 32-token input from its embedding alone, which is why "only the embeddings leaked" is not a safe-harbor classification. Read it before the membership-inference section.

  • arxiv.orgpaperGo deeper

    Infers whether a target document is in the knowledge base, using crafted prompts or masked-span reconstruction. Raw similarity scores turn the index into a direct membership oracle. Read it with the membership-inference section.

  • arxiv.orgpaperGo deeper

    Extends corpus extraction to image-returning multimodal RAG, where the retrieved image itself is the response. Instead of a malicious text prompt, ImmRAG hides the attack instruction inside an attacker-supplied query image. Relevance-weighted resampling then steers it into unexplored regions of the embedding space, rebuilding the private datastore step by step. Against CLIP-family retrievers (medical, document and general), a single 2,500-query run reconstructed up to 611 radiology images, 566 document scans and 416 general images, up to 5.6 times more distinct items than a non-adaptive baseline. It is the multimodal analog of Vec2Text and membership inference: the image channel is an extraction surface with no guardrails. Read it with the membership-inference section.

  • atlas.mitre.orgpaperGo deeper

    The ATLAS technique (Persistence tactic) to which the OWASP 2026 entry maps retrieval-time poisoning, with the same two-condition frame of geometric retrieval and generation steering. Use it to cite the attack class in a report.

Data poisoning techniques1 reading
  • arxiv.orgpaperGo deeper

    Label-consistent poison crafted with adversarial perturbations. It forces reliance on an implanted trigger, and no mislabeling reveals it, so it is stealthier than label flipping. Read it after BadNets.

Output control and indirect injection3 readings
Hands-on tooling1 reading
  • github.comtoolGo deeperabout 30 min

    An Apache-2.0 Python SDK and terminal interface, v0.11.0 (Jul 2026). It tests prompt injection, jailbreaks, goal hijacking and tool misuse with more than 10 research attacks (AutoDAN-Turbo, PAIR, TAP, FlipAttack) and scores them with an LLM judge. Install it with pip install hackagent; local models need no API key, and hooks exist for LangChain, the OpenAI SDK and Google ADK. Try it when you automate the red-team loop.

Canary tokens1 reading
  • Build a canary-instrumented RAG pipeline: insert identifiable documents and verify that detection fires when they surface in outputs.

    labGo deeper
๐Ÿ“ก From the Resources feed4 readings

This unit's library holds 11 more readings for readers with access.