AI Model and Data Attacks Explained: Poisoning, Backdoors, Theft and Defences

✨ AI Summary
By Updated

Most AI security writing is about tricking a model with words. This guide covers the other half: attacks on the model itself and on the data it learns from. They include corrupting training data, hiding a backdoor in a model, copying a model through its API, pulling private data back out of it, fooling it with crafted inputs, and compromising the files and libraries it is built from.

These attacks matter most to teams that train, fine-tune or host models, and to anyone who downloads a model someone else trained. Each section explains the attack in principle, what published research has shown, and the control that reduces it.

The six attacks at a glance

AttackWhat the attacker doesWhen it happensMain control
Data poisoningPlants bad examples in training or fine-tuning dataBefore or during trainingKnow and control where data comes from
BackdoorsMakes the model misbehave only when a hidden trigger appearsDuring training, or in a model you downloadUse trusted sources; test behaviour before release
Model extractionQueries a model many times to copy how it behavesAfter deploymentRate limits, monitoring, limited output detail
Privacy attacksRecovers training data, or learns whether a record was usedAfter deploymentKeep sensitive data out of training; filter output
Adversarial inputsCrafts an input that looks normal to a person and fools the modelAt useDo not rely on one model for a security decision
Supply chainTampers with a model file, dataset or library you depend onBefore you ever run itVerify sources, pin versions, scan and sandbox

OWASP’s 2026 list groups these under LLM04: Supply Chain and LLM05: Data and Model Poisoning.

Data poisoning

A model learns whatever its data teaches. If an attacker can place examples in that data, they can shift what the model believes or how it behaves. The uncomfortable finding from research is how little is needed. A 2025 study by Anthropic, the UK AI Security Institute and the Alan Turing Institute found that about 250 poisoned documents were enough to backdoor models of several sizes, regardless of how much clean data they were trained on. Earlier work in 2023 showed that buying control of a small share of the web pages behind large public image datasets was practical and cheap.

Fine-tuning is exposed in the same way. The 2023 Shadow Alignment study showed that a small set of crafted examples could weaken a model’s safety training.

Read more: training data poisoning.

Backdoors

A backdoored model behaves normally until it sees a trigger, such as a particular phrase, and then does what the attacker wanted. The idea dates from the 2017 BadNets research on image classifiers. Backdoors are hard to find because ordinary testing never uses the trigger, so accuracy scores look fine.

The realistic exposure for most teams is a downloaded model or a poisoned code-suggestion model. Read more: backdoors in AI code assistants.

Model extraction

A model offered through an API can be studied by anyone who can send it questions. With enough queries, an attacker can train a copy that behaves similarly, or recover specific details of the original. Researchers showed this for simple prediction services in 2016, and in 2024 a team demonstrated recovering part of a production language model’s internals through its public API at low cost. Extraction costs the owner their investment and gives the attacker a private copy to probe for other weaknesses.

Read more: model theft and extraction.

Privacy attacks

Models memorise some of what they are trained on. In 2021, researchers showed that a large language model could be prompted into reproducing individual training examples word for word, including personal details. Related techniques try to tell whether a particular record was in the training set, or to reconstruct typical examples of a class. The strongest defence is the plainest one: do not train on data you could not afford to have repeated.

Read more: model inversion attacks.

Adversarial inputs

A small, deliberate change to an input can flip a model’s decision while a person sees nothing wrong: an image with altered pixels, a document with reworded phrases, audio with added noise. This has been studied for over a decade, and no general fix exists. It matters most where a model is the gatekeeper, such as a malware classifier, a content filter or a fraud check.

Read more: adversarial machine learning.

Supply chain

Few teams train from nothing. They download a base model, datasets and libraries, and each is a way in. Some model file formats can run code when loaded, so opening a model from an untrusted source can be the same as running an untrusted program. Security researchers have repeatedly found malicious models uploaded to public model hubs. Safer formats that hold only weights, version pinning and scanning reduce this risk.

Read more: AI supply chain attacks.

How to assess your exposure

Test only systems you own or have written permission to test. For most teams this is a review more than an attack exercise:

  1. List every external input to training. Datasets, scraped sources, user feedback, fine-tuning files. For each, write down who can change it.
  2. List every downloaded component. Base models, adapters, libraries. Record the source, the version and the file format.
  3. Check for sensitive data in training sets. Personal data, secrets and customer content should be removed before training, not filtered after.
  4. Review what the API reveals. Rate limits, per-account monitoring, and whether detailed scores are returned when only an answer is needed.
  5. Test behaviour, not only accuracy. Keep a fixed set of checks for behaviour that must never appear, and run it on every new model version.
  6. Plan for rollback. Keep earlier model versions and the data they were trained on, so a poisoned release can be withdrawn.

Our AI red teaming guide explains how this fits into a full engagement, and the RAG security guide covers poisoning of a knowledge base, which is a different problem from poisoning a model.

Defences that hold up

DefenceWhat it doesIts limit
Data provenanceEvery training source is recorded, reviewed and versionedHard for very large scraped datasets
Trusted model sources and safe file formatsRemoves code execution on load; limits tamperingDoes not detect a backdoor in the weights
Pinning and scanning dependenciesStops silent changes to models and librariesNeeds upkeep
Behavioural test suite per releaseCatches regressions and some planted behaviourCannot test for an unknown trigger
Data minimisationWhat was never trained on cannot be extractedMay reduce model quality
Rate limiting and query monitoringMakes extraction slower, costlier and visibleA patient attacker can stay under limits
Layered decisionsA second check backs up any model used as a gatekeeperAdds cost and complexity

Frequently asked questions

Do these attacks matter if I only use a hosted model through an API?

Less, but not zero. You inherit the provider’s training choices, and fine-tuning or feedback data you send is still a poisoning route. Supply chain risk applies to every library you install.

Is data poisoning the same as RAG poisoning?

No. Data poisoning changes the model during training. RAG poisoning changes the documents a finished model reads at answer time, and is easier to carry out and to undo.

Can a backdoor be detected?

Sometimes, with specialised analysis, but there is no reliable general test. Controlling where models and data come from is more dependable than trying to find a backdoor afterwards.

Is it safe to download open models?

From well-known publishers, in weight-only file formats, with versions pinned, the risk is manageable. Treat an unknown uploader’s model like an unknown program.

Where can I learn this hands-on?

The SecurityElites labs let you practise against live AI systems in a safe range, and the SE-ARTCP certification tests the skill.

⚡
Join free to earn XP for reading this article Track your progress, build streaks and compete on the leaderboard.
Join Free
Lokesh N. Singh aka Mr Elite
Lokesh N. Singh aka Mr Elite
Founder, Securityelites · AI Red Team Educator
Founder of Securityelites and creator of the SE-ARTCP credential. Working penetration tester focused on AI red team, prompt injection research, and LLM security education.
About Lokesh ->

Leave a Comment