Skip to content
aiqbenchAI & Quantum Intelligence
NewsInsightsBenchmarksSkillsAsk AILearnAbout
...Loading your session
NewsInsightsBenchmarksSkillsAsk AILearnAbout
  1. Future Jobs
  2. ›
  3. AI Security Engineer
  4. ›
  5. Lesson 3 of 8

Data Poisoning, Backdoors and the AI Supply Chain

Intermediate¶ Read · 4 min⚑ Mission · 30 min◆ Quiz · 4 questions

You'll be able to:

You can explain how a backdoor is planted through training data and why it survives into deployment, estimate what it takes to poison a web-scale dataset, and audit a model download for the three supply-chain risks that matter most: serialization format, provenance, and licence of the data behind it.

Poisoning: attacking the model before it exists

Most of application security assumes the code was written by people you trust. Machine learning adds a second author: the data. A model is whatever its training set made it, and anyone who can influence the training set gets a vote in the model's behaviour. That is data poisoning, and it comes in two flavours with different goals.

Availability poisoning versus backdoors

Availability poisoning degrades the model for everyone — mislabelled examples that push accuracy down. It is noisy, usually visible in validation metrics, and rarely the real threat.

Backdoor poisoning is the serious one. The attacker adds examples that teach the model a conditional behaviour: behave normally, except when a specific trigger is present. The BadNets paper (Gu, Dolan-Gavitt and Garg, 2017) demonstrated it with a traffic-sign classifier that read stop signs correctly unless a small sticker was present, in which case it read them as speed limits. The crucial properties: the model's accuracy on clean data is unchanged, so standard evaluation does not detect it; the trigger is arbitrary and known only to the attacker; and the backdoor survives into deployment and, worryingly, can survive fine-tuning for a different task.

For language models the trigger is a phrase, a rare token or a formatting pattern, and the behaviour can be anything from a sentiment flip to "when you see this string in a code comment, suggest this dependency". The 2024 "Sleeper Agents" work showed that deliberately backdoored behaviours can persist through the standard safety-training pipeline. Whether such backdoors arise accidentally at scale is unresolved; that they can be planted deliberately is not.

Poisoning at web scale is cheaper than it sounds

The intuition "nobody can control a meaningful fraction of the internet" is wrong in two specific ways, documented by Carlini and colleagues in 2023.

First, large open datasets are mostly lists of URLs, not snapshots. Domains expire. Whoever buys an expired domain that appears in a popular dataset now controls what every future downloader fetches from it. The paper priced this at a few tens of dollars per dataset for a non-trivial fraction of some well-known sets.

Second, crowd-sourced sources such as wikis are snapshotted on a schedule. An edit timed just before the snapshot persists in the dataset even if moderators revert it minutes later on the live site.

The defensive lesson is not "avoid web data" — it is that a dataset is a supply-chain artefact and needs the same treatment as a dependency: pinned content hashes rather than URLs, provenance records, and a check that what you trained on is what you think you trained on.

The model file itself can attack you

The most immediate supply-chain risk has nothing to do with learning. For years the default serialisation for PyTorch models was Python's pickle format, and loading a pickle executes arbitrary code embedded in it. A "model" downloaded from a public hub can run anything on your machine the moment you load it, before a single inference. Hugging Face's pickle-scanning documentation explains both the mechanism and the mitigation: the safetensors format stores tensors as plain data with no executable component, and the Hub scans uploads and labels unsafe files. Policy that follows: prefer safetensors, load untrusted pickles only in a sandbox if at all, and treat a pickle from an unknown account as you would an unsigned binary.

A model-intake procedure

Treat every external model or dataset as you would a third-party package.

  1. Provenance. Who published it, under what account, and does that account match the organisation claimed? Typosquatted model names exist for the same reason typosquatted packages do.
  2. Integrity. Record the content hash at intake. Re-download later and compare; a hub listing can change under the same name.
  3. Format. safetensors or another non-executable format. A pickle gets a sandbox and a reason.
  4. Data lineage. What was it trained on, and does the licence of that data allow your use? "Unknown" is an answer, and it is a finding.
  5. Behavioural check. Evaluate on a held-out set you own, including a small set of inputs with unusual tokens and formatting, and compare against the publisher's claims. This will not reliably catch a backdoor — nothing cheap does — but it catches substitution and gross tampering.
  6. Registry. Record the model, hash, evaluation results and approver in a model registry so that a production incident can be traced to an artefact in minutes.

What is still unsettled

Detecting a backdoor in a finished model is an open research problem. Techniques exist — spectral signatures, neural cleanse-style trigger reconstruction, activation clustering — and each works against some attacks and not others. Robust training methods trade accuracy for resistance. A security engineer should therefore invest in provenance (preventing the poisoned artefact from entering) and blast-radius control (what the model is allowed to do if it is wrong) more than in detection, which today is best-effort.

What to remember

  • Backdoors leave clean-data accuracy intact, so your evaluation will not catch them.
  • Web-scale datasets are URL lists; expired domains and snapshot timing make poisoning affordable. Pin hashes, not URLs.
  • A pickle file is a program. Prefer safetensors; sandbox anything else.
  • Build an intake procedure (provenance, hash, format, lineage, evaluation, registry) and rely on it more than on backdoor detection.

Check Yourself

Loading the questions…

Module Mission

25–35 min

Decision 3 of the case file. Write a one-page model intake checklist for Halden: what must be verified before a model or dataset from a public hub touches a training run or a production server (format, hash, source, dataset lineage, licence, evaluation on held-out data). Then apply it to the embedding model in the case file, which is a pickle, and say what you would do this week. Check your list against the Hugging Face pickle-scanning documentation.

Open Case file: Halden Assist →

Good looks like

  • The checklist covers file format, integrity (a pinned hash or revision), who published it, and licence.
  • It asks where the training data came from, and says what to do when nobody knows.
  • It requires an evaluation on Halden's own held-out data before use, with a number that would block the model.
  • It is specific about pickle, explaining that loading one can run code, and names a safer format.
  • It ends with a dated action for the embedding model already in production.

Loading your work…

Curated Materials

1.7h

The deep work happens here — the lesson is your briefing.

  • Gu, Dolan-Gavitt, Garg: BadNets — Identifying Vulnerabilities in the Machine Learning Model Supply ChainPaper· 40 min
  • Carlini et al.: Poisoning Web-Scale Training Datasets is PracticalPaper· 40 min
  • Hugging Face Hub docs: Pickle Scanning (why pickle is unsafe and what safetensors changes)Docs· 20 min

Live on aiqbench

This lesson's subject on the rest of the site, today.

In the news, last 30 days

  • Hackers Hide Password-Stealing Malware in GitHub Code, Putting Software Downloads at RiskCybersecurity News · Nov 26
  • Silver Fox Hackers Use Fake Software Downloads to Spread Gh0stRAT Malware That Can Spy on PCsCybersecurity News · Nov 26
  • MINE: A Training-Free Defense against Indirect Prompt Injection via Mutual Information and Embedding VariancearXiv · Nov 26
More news on this subject →

Go further

  • How the leaderboards workHow scores are combined, and what a rank cannot tell you.
  • Ask AI about this lessonOpens Ask AI with a question about this lesson, answered from the news archive with sources.
  • Agent skills for this workReady-made skills for AI coding agents, checked and rated.
← Previous lesson2. Prompt Injection — Direct, Indirect, and Why Prompting Cannot Fix ItNext lesson →4. Model Extraction, Membership Inference and Privacy
aiqbench
AI & Quantum Intelligence© aiqbench. All rights reserved.

Feeds:RSS·JSON Feed

LanguageEnglish·Românăbeta
NewsAI & TechQuantumInsights
ExploreBenchmarksLearn
CompanyAboutTrustLegal noticeTerms of ServicePrivacy PolicyCopyright noticesData erasureReport content

The aiqbench take, the insights, the daily digest and Ask answers are written by AI models from the sources shown, without editorial review before publication. They may contain errors — check the source. How the model is used →

  • News
  • Insights
  • Ask AI
  • Benchmarks
  • Account