JustujuAI, layer by layer.Open in the interactive map

Model supply chain

Everything you didn't build yourself (model files, datasets, libraries, tool packages) can carry an attack; checking where it came from and loading it safely is supply-chain security.

Layer 6 · Inference & Optimization · Build and run time · Pending expert review, written 2026-11-02

Read first: Open vs closed weights, Local inference runtimes.

SimpleA plain explanation, one diagram and an analogy, with where the analogy breaks.

Guess first: can simply opening a downloaded model file run a program?

Show the answerWith some older formats, yes. That is why formats that hold only numbers exist.

Most AI products are built from parts made by others: a model downloaded from a hub, datasets, code libraries, plugins.

Any of those parts can be poisoned. Some old model file formats can run a hidden program the moment you load them.

A model can also carry a hidden backdoor from its training that tests won't reveal, or a fake copy can sit under a name that looks right.

So check where each part comes from. Prefer file formats that only hold numbers and cannot run code. Pin exact versions and check their fingerprints (hashes) or signatures.

Keep a list of every part you use, so when one turns out to be bad you know where it is.

Sourcereal publisher?1Formatcan't run code2Verifyhash orsignature3Isolateload untrustedones apart4Recordlist every part5
Checks before a model runs
  1. Source: real publisher?
  2. Format: can't run code
  3. Verify: hash or signature
  4. Isolate: load untrusted ones apart
  5. Record: list every part

Like: Buying food for a restaurant: know your suppliers, check the seals, and keep the delivery notes.
Where it breaks: Spoiled food often smells. A poisoned model file or backdoored model can look and score perfectly normal.

How it worksAn interactive demo first, then the mechanism: light maths, pseudo-code and trade-offs.

Code-executing formats. Python's pickle serialisation can call any function during loading, so a pickle-based checkpoint can run commands. Weight-only formats store tensors and metadata only. Hub scanners look for dangerous imports but can be evaded, for example by unusual compression.

Name and namespace trust. Pipelines often fetch models by owner/name. If an owner deletes or renames an account, someone else can register the old name and serve a different model to everyone still using it.

Dependencies. Model code pulls in libraries; a malicious package on a public index once shadowed a framework's nightly dependency and stole data from machines that installed it.

Controls. Weight-only formats, pinning by commit hash, signature verification of model files, an AI bill of materials, internal mirrors, and loading anything unverified in an isolated environment.

# Risky: name only, code-executing format
model = torch.load(download("owner/name/model.bin"))

# Safer: pinned revision, weight-only format, verified hash
path = download("owner/name", revision="<commit-sha>", file="model.safetensors")
assert sha256(path) == EXPECTED_SHA256
weights = load_safetensors(path)

Trade-offs

ResearchWhere the simple picture breaks, open problems and primary sources.

In the wild. Models with packed pickle payloads carried reverse shells and evaded a hub's scanner (ReversingLabs, 2025); a malicious dependency hit a framework's nightly builds over five days (PyTorch, 2022).

Namespace reuse. Re-registered model names led cloud model catalogues and open-source projects to deploy attacker models (Unit 42, 2025).

Beyond files. Backdoors trained into weights can survive safety training (Sleeper Agents, 2024), so provenance of training matters as much as the file format.

Signing. Open tooling now signs model files so users can verify integrity and origin (model-transparency); adoption across hubs is still uneven.

Security on this concept: 1 threat Pending expert review

Model files that run code when you load them Pending expert review

Exposed
  • Machines that download and load third-party model files
  • The credentials and data on those machines
Attacks
  • Hiding commands in pickle-based model files that run on load
  • Compressing or breaking the file in unusual ways so model-hub scanners miss the payload
Real case
Incident: Malicious models on Hugging Face (nullifAI) (2025-02)
Controls
  • Load weights only in formats that cannot run code, such as safetensors
  • Pin models by hash or signature, not by name alone
  • Load untrusted models in an isolated environment
Owner
ML engineering, with AppSec
Reference
LLM04:2026 Supply Chain
AML.T0011.000 Unsafe AI Artifacts
AML.T0010.003 Model Repository

All layers in the security view

Examples as of 2026-11-10

Sources

  1. OWASP Top 10 for LLM Applications: LLM03:2025 Supply Chain (2025)
  2. Pickle Scanning (Hugging Face Hub documentation) (ongoing)
  3. Safetensors (Hugging Face documentation) (ongoing)
  4. model-transparency: supply chain security for ML (Sigstore project) (ongoing)
  5. Malicious ML models discovered on Hugging Face platform (ReversingLabs) (2025)
  6. Compromised PyTorch-nightly dependency chain between December 25th and December 30th, 2022 (PyTorch) (2022-12-31)
  7. Model Namespace Reuse: An AI Supply-Chain Attack Exploiting Model Name Trust (Unit 42) (2025-09-03)
  8. Sleeper Agents: Training Deceptive LLMs that Persist Through Safety Training (2024-01-10)
  9. OWASP GenAI Security Project unveils the 2026 Top 10 for LLM Applications (OWASP) (2026-09-01)

More in Layer 6 · Inference & Optimization