Join our Newsletter — 33% off our NHI Course
Home› Guides› AI Data Poisoning and Backdoors Guide
Guide AI Security

AI Data Poisoning and Backdoors Guide

← All guides
By Lalit Choda, NHI Mgmt Group Updated 17 October 2026 15 min read
On this page

A model is only as trustworthy as the data and artefacts it was built from, and an attacker who can influence either can plant behaviour that ordinary testing will not find. Data poisoning corrupts training, fine-tuning or retrieval data; backdoors (also called trojans) make a model behave normally until a trigger appears; and model supply chain attacks deliver poisoned or malicious model files through hubs and registries. This guide explains how these attacks work at each stage of the AI lifecycle, why backdoors survive safety training, and which controls (provenance, curation, signing, scanning, evaluation and monitoring) reduce the risk. It is written for ML platform owners, AI security engineers and the security architects who approve AI data pipelines. It describes attacks only at the level needed to defend against them.

Key takeaways

  • Poisoning is an integrity attack on the data supply chain. NIST, OWASP and MITRE ATLAS all treat it as such, and ATLAS marks Training Data Poisoning (AML.T0020) as "Realized", meaning it has been seen in real systems.
  • The number of poisoned samples needed can be small. Research by Anthropic, the UK AI Security Institute and the Alan Turing Institute found that as few as 250 malicious documents produced a backdoor in models from 600M to 13B parameters.
  • Backdoors can survive safety training. The Sleeper Agents research showed backdoored behaviour persisting through standard safety techniques, with adversarial training sometimes teaching the model to hide its trigger better.
  • Model files can be malware. Pickle-based formats run code when loaded, so a downloaded model is executable content until proven otherwise. Prefer safetensors, scan files and verify signatures.
  • Provenance beats detection. Detection research has real limits, so the strongest controls are knowing where every dataset and model came from, who could change it, and whether it is the version you approved.

How poisoning and backdoors work

NIST AI 100-2 E2025 defines poisoning attacks as "adversarial attacks during the training stage" and separates data poisoning, where "an adversary controls a subset of the training data", from model poisoning, where "the adversary controls the model and its parameters". The attacker's goal decides the type:

Attack typeAttacker's goalWhat the attacker controlsWhy it is hard to spot
Availability poisoningDegrade the model on all inputs (NIST: "indiscriminate degradation")A share of training samples or labels; label flipping is the classic formUsually visible as lower accuracy, so it is the easiest to catch
Targeted poisoningChange predictions for a small set of chosen inputsTraining samples close to the targetOverall accuracy is unchanged; NIST calls it "notoriously challenging to defend against"
Backdoor (trojan) poisoningMake the model misbehave only when a trigger is presentSamples carrying a trigger pattern, phrase or featureClean test sets never contain the trigger
Clean-label poisoningAny of the above while keeping correct labelsTraining examples but "not their labels"Human label review finds nothing wrong
Model poisoningInsert malicious functionality directlyWeights, updates (for example in federated learning) or the model fileTraining data is clean; the problem is in the artefact

OWASP LLM04:2025 Data and Model Poisoning extends this to large language models: "Data poisoning occurs when pre-training, fine-tuning, or embedding data is manipulated" to add vulnerabilities, backdoors or biases. It notes that backdoors "may leave the model's behavior untouched until a certain trigger causes it to change", which is why they are hard to test for. The consequences OWASP lists for a triggered backdoor include authentication bypass, data exfiltration and hidden command execution when the model drives downstream actions.

Where poisoning enters the AI lifecycle

StagePoisoning routeATLAS techniqueFirst control
Pre-training on web-scale dataSplit-view poisoning (content behind a dataset URL changes after curation) and frontrunning (editing crowd-sourced pages just before a snapshot)AML.T0020 Training Data Poisoning; AML.T0010.002 DataHash-verified downloads; snapshot provenance
Public datasets and modelsPoisoned datasets or models published on hubs for victims to reuseAML.T0115 Publish Poisoned AI Artifacts (.000 Datasets)Approved sources; AI-BOM entry before use
Fine-tuning, instruction tuning and adaptersPoisoned task data, or a third-party adapter (for example LoRA) carrying a backdoorAML.T0020; AML.T0018.000 Poison AI ModelCurated, versioned fine-tuning sets; evaluate adapters as new models
Federated learningMalicious client updatesAML.T0018.000Robust aggregation, update clipping
Model files and registriesMalicious serialised code, modified weights or architecture, malicious templatesAML.T0018.002 Embed Malware; AML.T0010.003 Model; AML.T0011.000 Unsafe AI ArtifactsSafe formats, scanning, signature verification
RAG and knowledge basesPlanted documents in indexed sourcesAML.T0070 RAG Poisoning; AML.T0071 False RAG Entry InjectionWrite control on sources; retrieval provenance
Agent tools and feedback loopsPoisoned tool outputs, or user feedback fed back into trainingAML.T0099 AI Agent Tool Data Poisoning; AML.T0059 Erode Dataset IntegrityTreat tool output and feedback as untrusted data
  • Web-scale data: Carlini and colleagues showed split-view and frontrunning poisoning were practical, estimating they could have poisoned 0.01% of LAION-400M or COYO-700M for about USD 60, and that the attacks could affect 10 popular datasets. MITRE records this as case study AML.CS0025 "Web-Scale Data Poisoning: Split-View Attack".
  • Online learning: systems that learn from users are exposed by design. OWASP cites MITRE ATLAS case study AML.CS0009 Tay Poisoning, where a chatbot learned from coordinated abusive input.
  • RAG is not training, but behaves like it: a planted document changes answers without touching weights. Mechanics and controls for retrieval poisoning are covered in the Prompt Injection Guide and the AI Agent Memory Security Guide.

Sleeper agents: why backdoors survive testing

The Sleeper Agents paper (Hubinger et al., January 2024) built proof-of-concept language models that wrote secure code when the prompt said the year was 2023 and inserted vulnerabilities when it said 2024. The authors found that "such backdoor behavior can be made persistent, so that it is not removed by standard safety training techniques", that persistence was greatest in the largest models, and that adversarial training "can teach models to better recognize their backdoor triggers, effectively hiding the unsafe behavior". Their conclusion was that standard techniques could "create a false impression of safety".

The October 2025 study by Anthropic with the UK AI Security Institute and the Alan Turing Institute adds a second point: the number of poisoned documents needed did not grow with model or dataset size in their experiments. As few as 250 documents installed a backdoor that made models output gibberish on a trigger phrase. The authors stress that this was a narrow, low-harm backdoor and that "it remains unclear how far this trend will hold" for larger models.

What this means for defenders:

  • A model passing your safety and accuracy evaluation is not evidence that it has no backdoor.
  • Percentage-based thinking ("an attacker would need to control a large share of our data") is unsafe; a small absolute number of samples may be enough.
  • Third-party models, including fine-tunes of reputable base models, need provenance controls as well as testing.

Model supply chain: serialisation and model hubs

Hugging Face's documentation states that pickle "allows more flexibility by giving the ability to users to run python code at de-serialization time", through opcodes such as GLOBAL, STACK_GLOBAL and REDUCE. Loading a pickled checkpoint from an untrusted source is therefore equivalent to running untrusted code with the loader's privileges, which on a training node often means cloud credentials and dataset access.

ControlWhat it gives youLimits
safetensors or other non-executable weight formatsWeights load without running codeDoes not detect poisoned weights or backdoors; custom model code may still be needed
Restricted loading (for example PyTorch torch.load with weights_only=True; no trust_remote_code for unreviewed repositories)Blocks arbitrary object construction at load timeDevelopers can override it; enforce in shared tooling
Hub and registry scanningHugging Face runs a pickle import scan on uploads and highlights suspicious importsHugging Face says it is "not 100% foolproof"; ClamAV "doesn't cover pickle exploits"
Model signing (OpenSSF model signing, Sigstore)Proves who produced a model and that no file changed after signingProves origin, not safety; a signed backdoored model is still backdoored
Pinned revisions and private mirrorsStops silent upstream changes and namespace reuseMirror must itself be access controlled
  • Model signing in practice: the OpenSSF model signing project (v1.0 released April 2025, pip package model-signing) hashes every file in a model into a manifest and signs it as an in-toto statement in a DSSE envelope. Sigstore keyless signing is the default; public keys, certificates and PKCS #11 devices are also supported. The CLI is model_signing sign and model_signing verify, with the expected signer identity passed at verification. The Sigstore transparency log means "a rogue insider cannot release new models as if they are signed by the company".
  • Hub-specific attacks: ATLAS release 2026.07 added case studies AML.CS0064 "Poisoned GGUF Templates: Inference-Time Supply Chain Attack" and AML.CS0065 "Model Namespace Reuse Supply Chain Attack", where a deleted or transferred publisher namespace is re-registered by someone else. Pin to a commit or digest, not a repository name.
  • Signed commits on hubs help, but in Hugging Face's words this "does not guarantee that your file is safe, but it does guarantee the origin of the file". Use origin as an input to trust decisions, not as the decision.

For AI-BOMs, model registries and dependency controls, see the AI Supply Chain and AI-BOM Guide.

Defences: provenance, curation, evaluation and monitoring

The May 2025 joint guidance "AI Data Security: Best Practices for Securing Data Used to Train & Operate AI Systems" from NSA, CISA, FBI, ASD's ACSC, NCSC-NZ and NCSC-UK names three data risks: the data supply chain, maliciously modified data and data drift. Its headline recommendations are digital signatures to verify trusted data revisions, provenance tracking and trusted infrastructure.

Data provenance and curation

  • Record origin and transformations for every dataset (source, licence, collection date, hash, every filter and transformation), using CycloneDX ML-BOM or an equivalent, as OWASP recommends. This is ATLAS mitigation AML.M0025 Maintain AI Dataset Provenance.
  • Version datasets with content hashes (OWASP names DVC as one option) so any change between approval and training is detectable, and sign approved versions.
  • Sanitise training data (AML.M0007): deduplicate, filter outliers and near-duplicates, check label consistency, and quarantine new sources until reviewed. NIST warns sanitisation "is not as effective against stealthy poisoning attacks", so treat it as one layer.
  • Control write access to raw data buckets, labelling tools, feature stores and RAG sources. Most poisoning in enterprises needs write access to something you own.

Model evaluation and backdoor detection

  • Validate models (AML.M0008) against held-out data you control, and compare behaviour with the base model on sensitive tasks.
  • Backdoor detection techniques from NIST's taxonomy include trigger reconstruction (Neural Cleanse "used optimization to determine the most likely backdoor pattern"), model inspection followed by pruning or fine-tuning, and poison forensics to trace a backdoor to its training samples. NIST notes these "generally assume fixed backdoor patterns", which newer triggers evade.
  • Red team for triggered behaviour (AML.M0035 AI Red Team): probe for outputs that change with dates, rare tokens, names or formatting, and for code generation that differs by context. See Red Teaming AI Agents for Identity Abuse.
  • Robust training options where you train: ensembles, robust aggregation for federated learning, and differential privacy, accepting NIST's caution that clipping and differential privacy "usually decrease accuracy and do not provide complete mitigation".

Choosing controls by how you use AI

Your positionMain exposurePriority controls
Consume models through a provider APIRAG sources, agent tools, feedback dataWrite control on knowledge bases, retrieval provenance, provider assurance on training data
Download open-weight modelsMalicious files, backdoored weights, namespace reuseSafe formats, scanning, signature verification, pinned digests, private mirror, behavioural evaluation
Fine-tune or train adaptersPoisoned task data, third-party adaptersCurated versioned datasets, provenance records, evaluation against base model, red teaming
Pre-train or train from scratchWeb-scale and crowd-sourced dataHash-verified collection, snapshot provenance, large-scale filtering, poison forensics capability

Smaller organisations usually sit in the first two rows: put effort into knowledge base write controls and model intake. Larger organisations that train should fund a data security function with the same rigour as source code management.

Implementation roadmap

  1. Inventory (weeks 1 to 4): list every model, dataset, adapter and RAG source in use, where it came from and who can write to it. Record it in an AI-BOM.
  2. Model intake gate: require a non-executable format or a sandboxed load, a scan and, where available, signature verification before a model reaches a shared registry. Run the gate in report-only mode for two to four weeks, review what it would have blocked, then enforce.
  3. Dataset controls: move approved datasets to versioned, hashed, access-controlled storage; block training jobs from reading unregistered sources.
  4. Sign your own artefacts: sign models and datasets your teams produce, and verify at deployment.
  5. Evaluation baseline: build behavioural tests for each production model, including trigger probes, and run them on every new model or fine-tune.
  6. Monitoring: add the signals below and route them to the SOC.
  7. Rollback: keep the previous signed model and dataset versions deployable, so a suspected poisoning can be answered by reverting rather than retraining under pressure.

Where identity fits

Poisoning usually needs write access, and write access belongs to identities. The service accounts used by data pipelines, labelling vendors' accounts, model hub publishing tokens and CI credentials that push to registries are the practical attack path, more often than clever data crafting. Scope them to specific buckets and repositories, prefer short-lived workload identity over static tokens, and alert on writes from unexpected identities. The LiteLLM PyPI breach showed how a leaked publishing token lets an attacker ship a poisoned release of a widely trusted AI component. See the AI Infrastructure Workload Identity Guide.

Detection and measurement

  • Data pipeline: writes to training, fine-tuning and RAG stores by identity; hash mismatches between approved and consumed datasets; sudden shifts in label or class distribution.
  • Training: anomalous training loss curves (OWASP recommends thresholds on training loss and model behaviour); unexpected gradient norms in federated learning.
  • Model intake: scan findings, signature failures, models loaded from outside the approved registry.
  • Production: output drift against the baseline, clusters of unusual outputs on specific inputs, and user reports, logged with ATLAS mitigation AML.M0024 AI Telemetry Logging in mind.
MetricTarget direction
Share of production models with a complete AI-BOM and dataset provenanceTowards 100%
Share of model files loaded in safe formats or after scanningTowards 100%
Share of internal models and datasets signed and verified at deploymentRising quarter on quarter
Identities with write access to training or RAG stores, and how many are unusedFalling
Time to roll back a model to the last known good versionHours, not weeks

Framework mapping

FrameworkRelevant entries
MITRE ATLASAML.T0020 Training Data Poisoning; AML.T0018 Manipulate AI Model (.000 Poison AI Model, .002 Embed Malware); AML.T0043.004 Insert Backdoor Trigger (2026.04 data); AML.T0115 Publish Poisoned AI Artifacts; AML.T0010.002 and .003; mitigations AML.M0007, M0008, M0013 Code Signing, M0014 Verify AI Artifacts, M0023 AI Bill of Materials, M0025
OWASP Top 10 for LLM Applications 2025LLM04:2025 Data and Model Poisoning; LLM03:2025 Supply Chain
NIST AI 100-2 E2025Section 2.3 poisoning attacks and mitigations; integrity violations and supply chain attacks
NIST SP 800-53 Rev. 5SR-3 Supply Chain Controls and Processes; SR-4 Provenance; SR-11 Component Authenticity; SI-7 Software, Firmware, and Information Integrity; CM-14 Signed Components; CA-8 Penetration Testing
ISO/IEC 27001:2022 and 42001:202327001 A.5.21 Managing information security in the ICT supply chain, A.8.25 Secure development life cycle; 42001 Annex A data for AI systems controls, including data provenance
CIS Controls v8.1Control 3 Data Protection; Control 16 Application Software Security (including third-party components)

Common failure patterns

  • Loading models like data: data scientists pull pickled checkpoints onto credential-rich notebooks. Treat model files as code.
  • Trusting a name instead of a digest: pipelines that fetch "latest" from a hub inherit any upstream change, including namespace takeover.
  • Open write access to knowledge bases: wikis, ticket systems and shared drives indexed for RAG let any user, or any compromised account, shape answers.
  • Treating AI packages as low risk: the Mastra npm supply chain attack backdoored more than 140 AI framework packages through a forgotten contributor account.
  • Relying on evaluation alone: a clean benchmark score says nothing about triggered behaviour, as the sleeper agent research shows.
  • No last known good: without signed, retained prior versions, recovery from suspected poisoning means retraining from data you can no longer trust.

Practitioner checklist

  • Maintain an AI-BOM covering every model, adapter, dataset and RAG source, with provenance.
  • Require safe weight formats or sandboxed loading, and block trust_remote_code for unreviewed repositories.
  • Scan model files and verify signatures at intake; pin models by digest or commit.
  • Sign internally produced models and datasets and verify them at deployment.
  • Store approved datasets versioned and hashed, and block training on unregistered data.
  • Restrict and monitor write access to training data, labelling tools and RAG sources.
  • Run behavioural and trigger-probing evaluations on every new model or fine-tune.
  • Monitor training loss, output drift and data distribution shifts, with alerts to the SOC.
  • Keep last known good models and datasets ready for rollback.

Standards and references

Related NHI Mgmt Group resources: AI Supply Chain and AI-BOM Guide · LLM Security Guide · AI Agent Memory Security Guide · AI Governance Guide

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Written and reviewed by Lalit Choda, NHI Mgmt Group. Last updated 17 October 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org