Published on
AI data poisoning is when an attacker tampers with the data a model learns from or retrieves so it behaves the way they want. Picture a support chatbot built on retrieval-augmented generation (RAG). Someone slips one doctored policy page into its knowledge base, and the bot starts sending customers to a "new" refund portal. No code changed, and every test still passes.
The bad input looks like ordinary data, which is why poisoning is so hard to catch. Let's dig into how it works and what you can do about it.
What Is AI Data Poisoning?
AI data poisoning is the deliberate adding, changing, or removing of data so a model learns or retrieves the wrong thing. It can hit pre-training data, fine-tuning data used to adapt a model to your task, or RAG data. RAG data usually lives as embeddings, numeric versions of text, in a vector database.
In 2026, more developers own at least one of those stages. Fine-tuning is cheaper, RAG is a default pattern, and AI coding assistants sit in most editors. Poisoning is now an everyday engineering concern, not just a model-vendor problem.
How Is Data Poisoning Different From Prompt Injection?
Data poisoning corrupts what the model learns or retrieves, so the damage lasts until someone cleans the data (and, for a trained model, retrains or rolls it back). Prompt injection manipulates the model at runtime through crafted input. One attacks the model's memory, the other its in-the-moment instructions. The line can blur, a poisoned document with RAG knowledge base that contains hidden instructions is both.
How Does a Data Poisoning Attack Work?
A data poisoning attack plants data that teaches the model a hidden behavior or degrades its accuracy. Three patterns show up most.
A backdoor attack trains the model to act normally until it sees a trigger phrase, then switch behavior. Label flipping mislabels examples, so a classifier learns that malicious code is safe. Availability attacks flood the data with noise so output quality drops.
How much poisoned data does it take? Less than many teams assume. In a 2025 study by Anthropic, the UK AI Security Institute, and The Alan Turing Institute, 250 malicious documents were enough to plant a backdoor during pre-training. They backdoored models from 600 million to 13 billion parameters, regardless of size. For the largest model, that was about 0.00016% of training tokens.
Keep the caveats in view. This was controlled research, not a production incident. The authors call the backdoor narrow, since it only made models output gibberish when they saw a trigger phrase. They also say it's unclear whether results hold for larger models or more harmful behaviors, such as backdooring code.
How Can Data Poisoning Reach the Apps Developers Build?
Most poisoning reaches your app through the AI supply chain, not a direct breach. Open-source models and datasets from public hubs may carry tampering you never inspected. Some model file formats can even run code when they’re loaded, so prefer safer formats such as safetensors. Fine-tuning sets built from scraped pages or user submissions let outsiders shape your model.
RAG knowledge bases are often writable by more people and integrations than anyone has mapped. AI coding assistants add one more path. Insecure patterns in public code can resurface in suggestions your team accepts, and researchers have shown that attackers can deliberately plant code designed to steer those suggestions. Where Does Data Poisoning Fit in the OWASP Top 10 for LLM Applications?
Data poisoning is LLM04:2025 Data and Model Poisoning in the OWASP Top 10 for LLM Applications. OWASP frames it as an integrity attack on pre-training, fine-tuning, or embedding data.
It sits next to two related entries. LLM03 Supply Chain covers the third-party models and datasets that can carry poisoned data. LLM08 Vector and Embedding Weaknesses covers the RAG layer. If you know OWASP A08:2021 Software and Data Integrity Failures, the core lesson is the same: don't treat untrusted inputs as trusted.
How Can Developers Prevent AI Data Poisoning?
Know where your data comes from, limit who can change it, and test before and after deployment. OWASP's LLM04 guidance builds on those three habits.
How Do You Secure Training and RAG Data Sources?
Start with provenance. Track the origin of every dataset and model in a machine learning bill of materials (ML-BOM), using a standard such as OWASP CycloneDX, and pull only from vetted sources.
Then lock down write access. Apply least privilege to knowledge bases and fine-tuning pipelines. Put training data under version control, with a tool such as Data Version Control (DVC), so you can see what changed and roll back fast. Run anomaly checks on new data before it reaches a training run or vector store.
How Do You Spot a Poisoned Model?
Test for behavior you didn't design. Red-team before release, including trigger testing with unusual phrases. After launch, monitor outputs and training loss for unexplained drift. Review AI-generated code like a pull request from a new teammate, not something to trust by default.
Why Should Developers Train for AI Security Risks Like Data Poisoning?
Poisoned data rarely trips scanners, so developer judgment is the last line of defense. Your team needs to know what to trust, verify, and review when AI is part of the build.
Security Journey's AI/LLM Security learning path covers OWASP LLM risks through video lessons, hands-on sandbox lessons, and CTF AI modules. Developers practice in labs built on real applications, spotting and fixing issues instead of answering multiple-choice questions. Explore secure coding training built for teams shipping AI features.
As more teams fine-tune their own models and run their own RAG pipelines, data integrity becomes part of everyday code review. Teams that treat training and retrieval data like production code will catch poisoning early, and Security Journey can help yours build those habits now.