Key takeaways

  • Data poisoning plants malicious text or images in a model's training data so the trained model carries a flaw or a hidden backdoor.
  • An Anthropic study from October 2025 found 250 poisoned documents were enough to backdoor models from 600 million to 13 billion parameters.
  • The TrojanMaxxing paper shows a different route: AI agents edited model weights directly, with no training data involved, for under $30 per model.

Data poisoning is an attack on an AI model's training data. Someone plants text or images in the data a model learns from, and the model comes out of training with a flaw the attacker chose: a wrong answer on one topic, worse output across the board, or a hidden backdoor that waits for a trigger. That is what data poisoning is for an LLM too, and it takes less poisoned data than most people assume.

OWASP's list of the top risks for LLM applications puts it at number four and defines it this way: "Data poisoning occurs when pre-training, fine-tuning, or embedding data is manipulated" to add vulnerabilities, backdoors or biases. The attack happens before the model ships, which is why it is hard to fix afterward.

How a data poisoning attack works

Large models train on data scraped from the open web, and nobody reads all of it. Whoever gets content into that scrape gets a small vote on what the model learns.

NIST's taxonomy of attacks on machine learning, published in March 2025, sorts poisoning by what the attacker wants. Availability poisoning makes the model worse at everything. Targeted poisoning changes its behavior on a few chosen inputs. Backdoor poisoning teaches it a secret rule: behave normally, unless the input contains a particular pattern.

The backdoor is the hardest to catch. OWASP compares a backdoored model to a sleeper agent: it passes every normal test, and the flaw shows only to someone who knows the trigger.

How much poisoned data it takes

The usual assumption was that an attacker had to control some percentage of the training set, which gets harder as the data grows. A study Anthropic published on October 9, 2025, with the UK AI Security Institute and the Alan Turing Institute, found that the count matters and the percentage doesn't.

The team trained 72 models, from 600 million to 13 billion parameters, and slipped in documents containing the trigger phrase <SUDO> followed by gibberish. With 250 poisoned documents, every model size learned to print gibberish whenever it saw the trigger. With 100, none did reliably. Those 250 documents came to about 420,000 tokens, or about 0.00016% of the tokens the largest model trained on. The largest models saw more than 20 times as much clean data as the smallest, the paper notes, and it made no difference.

The study has limits. The backdoor was a narrow, low-stakes one, and Anthropic says it doesn't know yet whether the pattern holds for models bigger than 13 billion parameters or for more harmful behavior, such as writing insecure code.

Getting the documents into the training set is the other half of the attack, and a 2023 paper by Nicholas Carlini and eight coauthors, "Poisoning web-scale training datasets is practical", showed it could be cheap. Many image datasets are lists of URLs, and what a URL serves can change after the list is made. The authors estimated they could have poisoned 0.01% of LAION-400M or COYO-700M for about $60.

Poisoning can be a defense. Nightshade, from Shawn Shan and colleagues, alters images so a model trained on them learns the wrong picture for a word. Its paper reports that fewer than 100 poisoned samples can corrupt a prompt in Stable Diffusion SDXL, and pitches it as a last resort against scrapers that ignore opt-outs.

Data poisoning vs prompt injection

Both put an attacker's content in front of a model. The difference is when.

Prompt injection happens while the model is running. OWASP's entry on it describes input, typed by a user or hidden in a web page or file the model reads, that changes what the model does. The model is untouched. Data poisoning happens during training and changes the model, so every copy carries the flaw until someone retrains it.

Data poisoning Model poisoning Prompt injection
When During training or fine-tuning After training, before you download it While the model is in use
What the attacker controls Some of the training data The weights file Text or images the model reads
What changes The model, through what it learns The model, edited directly Nothing permanent
How to get rid of it Retrain on clean data Use a clean copy Remove the input

Backdoors without poisoning: this week's TrojanMaxxing paper

The middle column is NIST's term for an attacker who skips the data and tampers with the model's parameters.

A paper on the Hacker News front page on November 29, "TrojanMaxxing" by four researchers at Purdue and Stony Brook, shows how cheap that has become. They gave AI coding agents, Claude Opus 5.5 and Mythos 5.2 running in Claude Code, an open-weight vision-language model and a goal in plain English: make this model misbehave when an image carries a hidden pattern. No training was allowed. The agents picked the weights to change and designed the pattern themselves.

It worked on all five models tested, from 0.89 billion to 4.3 billion parameters. With the trigger added, the three content moderation models called unsafe images safe 93% to 100% of the time. The two text-reading models output the attackers' chosen string, "1337", 78% to 100% of the time. Accuracy on normal images moved by 0.02 or less. The edits touched between 0.0003% and 0.023% of each model's weights, and the authors put the cost at under $30 per model in API fees. The paper says Anthropic's safety filter stopped a Mythos 5.2 run and let the rest through.

So this is a backdoor without data poisoning. Nobody touched a training set, so defenses aimed at training data would not notice. The obvious route to victims would be a model hub: download a popular model, edit it, upload it under a similar name. Hugging Face disabled five malicious GGUF models by November 28 that arrived the same way, though those files hid malware and rigged chat templates and left the weights alone.

The code is not out. The repository README promises the harness later and says "We will not be releasing the backdoored models."

How to defend against data poisoning

There is no single fix. NIST says filtering can remove some poisoned samples, but finding them in a large training set may be very hard.

For training data, NIST and OWASP both start with tracking where it came from. Dataset publishers can post cryptographic hashes so that anyone downloading the data can check it hasn't changed since it was indexed, which closes the swapped-URL trick from the Carlini paper.

For downloaded models, NIST says ordinary supply-chain scanning is not enough to catch a poisoned model, and points to interpretability research, which looks inside a model for backdoor features. The TrojanMaxxing authors tested two defenses. Quantization, which compresses a model's weights to 4 or 8 bits, broke some backdoors and left others intact. Having a second AI agent inspect the weights without running the model did better: it flagged every edited model and no clean ones. That was a small test by the attack's own authors, so treat it as a lead.

NIST's last piece of advice is the one to keep: treat a model as an untrusted component, and design the application so a misbehaving model can't do much damage. Until others repeat the TrojanMaxxing audit result, downloading weights only from the original publisher's account is the cheapest defense there is.

Frequently asked questions

What is a data poisoning attack in AI?

It is an attack in which someone inserts or alters samples in the data a model is trained on, so the finished model behaves the way the attacker wants. NIST sorts these attacks into availability poisoning, which makes the model worse at everything, targeted poisoning, which changes its behavior on chosen inputs, and backdoor poisoning, which adds a hidden trigger.

What is data poisoning in an LLM?

It is the same attack aimed at the text a language model learns from during pre-training or fine-tuning, or at the documents it retrieves. In an Anthropic study published on October 9, 2025, 250 poisoned documents were enough to make models of up to 13 billion parameters output gibberish whenever a trigger phrase appeared.

What is the difference between data poisoning and prompt injection?

Data poisoning happens during training and changes the model itself, so every copy carries the flaw until it is retrained. Prompt injection happens while the model is in use: malicious text in a prompt, web page or file changes what the model does in that session, and the model's weights stay the same.

What is data contamination?

Data contamination is usually an accident, not an attack. It means benchmark test questions ended up in a model's training data, so the model scores higher on that benchmark than its real ability justifies. Data poisoning is deliberate and aims to change how the model behaves.

Sources

  1. LLM04:2025 Data and Model PoisoningOWASP GenAI Security Project
  2. Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations (NIST AI 100-2 E2025)NIST
  3. A small number of samples can poison LLMs of any sizeAnthropic
  4. Poisoning Attacks on LLMs Require a Near-constant Number of Poison SamplesarXiv
  5. TrojanMaxxing: One-shotting VLM Backdoors with Weight-Space ProgrammingarXiv
  6. theboxahaan/trojanmaxxingGitHub
  7. Poisoning Web-Scale Training Datasets is PracticalarXiv
  8. Nightshade: Prompt-Specific Poisoning Attacks on Text-to-Image Generative ModelsarXiv
  9. LLM01:2025 Prompt InjectionOWASP GenAI Security Project
  10. Benchmark Data Contamination of Large Language Models: A SurveyarXiv

Add ClaudeGPT Si as a preferred source on Google