# What Are Model Supply-Chain Risks?

> What model supply-chain risks are, where they get into an AI app, and how teams reduce them, explained simply for your AI interview.

**In short:** Model supply-chain risks are the dangers from every outside part an AI app uses, such as downloaded models, adapters, datasets, packages and conversion tools. A tampered file can hide code or a backdoor, so teams check where each part came from and load it safely.

AI and LLM interview question Q216, Guardrails and AI safety. Intermediate, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-are-model-supply-chain-risks

## Say it in 30 seconds

A model supply chain is every outside part my AI system depends on: downloaded models, add-on adapters, datasets, Python packages and the tools that convert model files. Any of them can be tampered with. Some older model file formats run code the moment you load them. So I use trusted sources, safer file formats, exact version pins with checksums, and I test the exact file I ship.

## Say it in 2 minutes

An AI app is built from parts other people made. There is a base model, often downloaded from a public hub. There are adapters, which are small add-on files that tune a model for one job. There are datasets, Python packages, and the tools that convert a model into a smaller format. Each one is a supplier, and any of them can be swapped for a tampered copy. I would only notice if I checked where it came from.

The sharpest risk sits in the model file. Pickle is widely used for model files, and the Python docs warn that it is not secure, because a crafted file can run code when it loads. A safer format such as safetensors is built for storing tensors safely, as opposed to pickle. Even then, a backdoor can hide in a model's structure, so a safe format is no guarantee.

Other risks come from the process. An AI coding assistant can invent a package name that an attacker has already registered. An account name on a hub can be taken over after the original owner deletes it. A conversion step can change a model with no review. OWASP lists this as LLM04 in its 2026 Top 10 for LLM apps, and as LLM03 in 2025.

So I work in layers. I pin exact versions and file hashes, use signed files from sources I can verify, load unknown models in an isolated sandbox, keep an inventory of every model and dataset, and test the file that actually ships. I tell the interviewer that a signature proves where a file came from, not that it is safe.

## What is a model supply chain, in plain words?

A supply chain is everything a maker takes in from others before the product reaches the customer. An AI app works the same way. Its base model may come from a public hub, its add-on adapters from a partner team, and its libraries from an open package index.

A hospital pharmacy is a good picture. It buys medicine from wholesalers and checks the seal and batch number on each delivery, because a fake box can arrive at the loading dock. The AI version is the same: a tampered model, a bad adapter or a look-alike package can arrive through a normal download.

A real case from OWASP's list: in December 2022 a malicious torchtriton package on PyPI, the public Python package index, shadowed the legitimate PyTorch-nightly dependency and exfiltrated data.

- **Pre-trained model:** A model someone else trained, which you download and use or tune.
- **Adapter:** A small add-on file, such as LoRA (a cheap way to tune a model), that changes how a model behaves for one job.
- **Serialization:** Saving a model into a file so it can be shared and loaded again.
- **Provenance:** Proof of where a file came from and who made it.
- **Pinning:** Locking a component to one exact file, by its hash (a fingerprint of its bytes).

## Where do the risks come from?

OWASP's 2026 entry says the weak points cover the integrity of training data, models, adapters, conversion pipelines and the platforms that deploy them. In ML the risk reaches past code flaws into third-party models and datasets.

I group the risks into three kinds: the model file itself, the process that moves and changes it, and the packages around it. OWASP gives an example of each.

- **The model file: It can carry code or false answers.** A pickle file can run code when it loads. A model with edited weights (the numbers inside it) can pass the usual benchmarks and still spread misinformation.
- **The process: A swap in the middle.** A conversion step (changing a model's file format) or a merge step (combining an adapter into a model) can change it with no review. A stolen build credential can ship a poisoned release, and because the company's own pipeline signs it, it passes the provenance checks.
- **The packages: A look-alike name gets installed.** AI coding assistants can suggest package names that do not exist. Attackers register those names first, so an install line pulls in their code.

*Diagram, Where a supply-chain risk gets in: Outside parts enter our pipeline and then reach the running app. Arrows 1 to 5 are the places a file can be swapped. Only the green box, after hashes, tests and sign-off, should go live.*
1. The downloaded model goes into our conversion step.
2. The partner's adapter is merged in the same step.
3. The package is installed by name during the build.
4. The converted model reaches the running app.
5. The signed build ships to the app's servers.
6. The app only goes live after the checks pass.

Adapters need the same care. OWASP describes an attacker who alters a partner's LoRA adapter, which is later merged into a deployed model through a model-merge workflow. The adapter then gives a hidden way into the system.

Shrinking a model, called quantising (storing each number with fewer bits), can change it too. OWASP notes that weights can be crafted so the full-precision model looks fine while the quantised version misbehaves. So test the file you ship, not the original.

## Why is loading a model file dangerous?

Hugging Face's own docs say pickle is widely used in ML and is the default format for PyTorch model weights. Pickle stores instructions for rebuilding an object, and those instructions can import and run any code the file's author chose. The Python docs put the risk plainly:

> "It is possible to construct malicious pickle data which will execute arbitrary code during unpickling." (Python documentation, pickle)

The demo below is harmless: its payload only prints a line. It shows the mechanism. A real payload could do far more, because it runs with the same rights as the app that loads it. The hash check is the part that protects you.

```python
# Made-up demo: a model file is swapped on the way in. A pinned hash catches it before loading.
import hashlib
import pickle

class TamperedCheckpoint:
    def __reduce__(self):
        # pickle calls this to rebuild the object, so a file can name any function to run.
        return (print, ("payload ran while the model file was loading",))

release = pickle.dumps({"weights": [0.1, 0.7]})  # what the publisher shipped
PINNED = hashlib.sha256(release).hexdigest()  # stands in for the digest published with the signed release (computed here for the demo)
swapped = pickle.dumps(TamperedCheckpoint())  # what the mirror serves instead

for name, blob in [("publisher copy", release), ("mirror copy", swapped)]:
    if hashlib.sha256(blob).hexdigest() != PINNED:
        print(name, "refused: hash does not match the pin")
        continue
    print(name, "passed, loading")
    pickle.loads(blob)
```

Output:

```text
publisher copy passed, loading
mirror copy refused: hash does not match the pin
```

A matching hash shows the file is byte-for-byte the copy you pinned. It does not show the file is safe. That is why the pinned hash and the sandbox work together. A sandbox is a sealed test space, cut off from real systems.

Safer formats cut the risk. Safetensors is described as a format for storing tensors, the numbers a model learns, safely and as an alternative to pickle. Moving format still does not end the risk. OWASP warns that a backdoor can be embedded in a model's computational graph and persist in formats widely considered safe, such as ONNX.

*Diagram, Two ways to load the same model: Two ways to load a model file. A pickle file can run code hidden inside it while it loads. Safetensors is built for storing tensors safely, but neither format makes a model safe on its own.*
1. A pickle file can run code while it loads.
2. A safetensors file is built for storing tensors safely.

Here is a made-up case I would bring to an interview. An insurer's platform team pulls an open model by name, and the pipeline takes whatever file sits under that name today. The original account is deleted, an attacker registers the same name, and publishes a model that runs code on load. Nothing in the pipeline checks a hash, so the file reaches the claims servers in the overnight release.

The fix: pin the exact file by its digest from the signed release, load it first in an isolated sandbox, check the hash, and only then move it into production. The cost is a slower update, since each new model needs a manual hash change and a test run.

> **Tip:** Asked how you'd load a third-party model? Say: from a verified source, in a safer format where possible, pinned by hash, and loaded first in an isolated sandbox. Never unpickle a file from an uploader you cannot verify.

## How do teams reduce these risks?

Teams rely on a checklist more than on one trick. Most steps below follow OWASP's prevention advice. The sandbox step is our own practice, not OWASP's:

1. **Know every part:** Keep a signed inventory of every model, adapter, dataset and package: a software bill of materials, which is a list of every part in the build. OWASP suggests extending it to models with AI BOMs.
2. **Trust, then verify:** Only use models from verifiable sources, and add checks: integrity checks, signing and file hashes.
3. **Pin the exact file:** A name like latest can move to a new file without warning. Pin the digest, a fingerprint of one exact file.
4. **Check packages before install:** Confirm that any package an assistant suggests exists and is the one you meant, before you install it.
5. **Load in isolation:** Load unknown model files in a sandbox first. Treat scanners and safe-loader flags as one layer, not a guarantee.
6. **Test the shipped file:** A quantised or converted file needs its own tests, because a passing original says nothing certain about it.

> "Signing proves integrity and origin, not safety" (OWASP, LLM04:2026)

Signing gives you origin and integrity. It does not tell you the model is safe, so behaviour tests still matter.

### How would you secure a team that pulls open models?

A made-up team at a mid-size bank wants an open model for a support assistant. The developers pull it by name in a script, and nobody records which file arrived. A new upload under that name could land in the next build without anyone noticing.

- **Today: Pulled by name.** The build grabs whatever sits under the name. Nobody records the file, and the server loads it when the app starts.
- **Target: Pinned, checked, tested.** The release names one hash, the file is checked and loaded in a sandbox, and the same tests run on the exact file that ships.

I would add a rule: each new model needs a named owner, a source on the team's verified list, and a test report before it reaches the bank's servers. Each update is slower.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain definition: every outside part an AI app takes in can carry a risk.
- [ ] The parts: models, adapters, datasets, packages and build or conversion steps.
- [ ] Why a model file can run code: pickle, and why safer formats help.
- [ ] Pin by hash, check the source, keep an inventory, and sign what ships.
- [ ] Test the exact file you deploy, after any conversion or quantisation.
- [ ] Signing proves origin, not safety. Said honestly.

**Common traps**

- Trap: "Our model came from a big lab, so it is safe." Better: Origin helps, but it proves only where a file came from. Check the hash and test its behaviour.
- Trap: "A safe format like ONNX means no risk." Better: OWASP says a backdoor can persist in formats considered safe. Formats cut the risk; they do not end it.
- Trap: "Just use the newest version of the model." Better: The newest version can change under you. Pin an exact file and its hash.

## Can you spot the safe step?

**Spot the safe step:** Which line is the safest way to bring a third-party model into the build?

A. model = 'fraud-base:latest'  # always the newest upload
B. pickle.load(open('fraud_base.pkl', 'rb'))  # file from a hub, no check
C. model = 'fraud-base@sha256:a16a86e8941f966f7a2515e75493ff691930de3d24bdf6d7f65ca49431252d4d'  # digest from the signed release
D. cp teammate_laptop/fraud_base.safetensors ./models/  # it worked there

**Answer:** C. A digest pins one exact file, so the build gets the bytes you checked. The latest tag can move, the pickle load can run code from the file, and a laptop copy has no known source.

**Quick check:** An agent merges a partner's LoRA adapter into your production model. Which change cuts this risk the most?

A. A longer system prompt
B. Check the adapter's hash and signature, then re-test the merged model before release
C. A bigger base model
D. A lower temperature setting

**Answer:** B. A checked adapter from a verifiable source, plus a test on the merged model, narrows the tampering path. Prompt length, model size and temperature don't show where a file came from.

## Can you answer these from memory?

**Flash cards**

- **What is a model supply chain?** Every outside part an AI app uses: models, adapters, datasets, packages and build steps.
- **Why is a pickle model file risky?** Loading it can run code hidden in the file.
- **What does safetensors store?** Tensors, the numbers a model learns, stored in a safer way than pickle.
- **Where does OWASP rank it?** LLM04 in the 2026 Top 10 for LLM apps. LLM03 in 2025.
- **What does a signature prove?** Where a file came from and that it was not changed. Not that it is safe.
- **Why pin a digest, not a tag?** A tag like latest can point to a new file. A digest names one exact file.

## Likely follow-up questions

- Q215 What is data and model poisoning? https://designervenkat.online/interview/ai/what-is-data-and-model-poisoning
- Q206 Name the OWASP LLM Top 10 (2026). https://designervenkat.online/interview/ai/name-the-owasp-llm-top-10-2026
- Q207 What changed from the 2025 list to the 2026 list? https://designervenkat.online/interview/ai/what-changed-from-the-2025-list-to-the-2026-list
- Q222 Automated vs human red teaming? https://designervenkat.online/interview/ai/automated-vs-human-red-teaming
- Q213 What is sensitive information disclosure? https://designervenkat.online/interview/ai/what-is-sensitive-information-disclosure
- Q223 Guardrail tools (Llama Guard, NeMo Guardrails, cloud filters)? https://designervenkat.online/interview/ai/guardrail-tools-llama-guard-nemo-guardrails

## Learn it in depth

- [Insecure model files](https://designervenkat.online/learn/ai-guardrails/insecure-deserialization)
