Lesson 09 · 45 minutes
Use public AI risk resources in a threat model
- Link the threats of a system to the MIT AI Risk Repository and the OWASP Machine Learning Security Top 10
- Say what a CVE record must hold and name who watches the CVE List for each component
- Check the links and the watch list with a script
The lab folder as it stands after this lesson. Unzip it in ~/krlab.
More
The zip holds every file that the course has printed up to here. To start this lesson with the files of the earlier lessons only, take the zip of the lesson before. Type the code yourself first: you learn more.
Scenario
The auditor of a KR Books customer reads your threat table and asks two questions. "Which public risk lists did you check it against?" and "Who watches for new vulnerability records of the parts that you run?" The table has the ids T1 to T13 and nothing else. You add a file of links to the public lists and a file with a watcher for each component, and a script that checks both. Then the clinic team asks you to do the same for its assistant.
Recall
Lesson 3: which family of attack does a membership inference test measure?
Privacy. The attacker asks questions and uses the gap in confidence between examples that the model saw in training and examples that it did not see.
Lesson 6: what is the rule for the threat table?
Every flow that crosses a boundary has at least one threat, and every threat has at least one control. A flow with no threat has not been examined.
The idea
Question 2 of the threat model, "what can go wrong?", needs prompts, so that you do not miss a kind of risk. Lessons 4 and 5 gave you MITRE ATLAS and the OWASP list for LLM applications. Three more public resources do the same job. Each has a state, and a report must name it.
- Threat table → Sources file: the ids T1 and T5
- MIT AI Risk Repository → Sources file: the domain of a threat
- OWASP ML Top 10 → Sources file: the entry of a model threat
- Asset map → Watch list: each part that runs code
- CVE Program → Watch list: new records name a component
The MIT AI Risk Repository is a living database of AI risks that were collected from earlier frameworks. The MIT AI Risk Initiative at MIT FutureTech publishes it. Its Causal Taxonomy says how, when and why a risk occurs: the entity (AI, human or other), the intent and the timing (before or after deployment). Its Domain Taxonomy sorts the risks into seven domains and 24 subdomains. A practitioner asks of it: is there a kind of risk that my threat model has no row for? Many of its risks are not attacks. The table is a copy from November 2026, so take the current names from the repository before you write them in a report.
| Domain | Name | Subdomains | Used in this lesson |
|---|---|---|---|
| 1 | Discrimination & Toxicity | 3 | |
| 2 | Privacy & Security | 2 | 2.1 Compromise of privacy by obtaining, leaking or correctly inferring sensitive information; 2.2 AI system security vulnerabilities and attacks |
| 3 | Misinformation | 2 | |
| 4 | Malicious Actors & Misuse | 3 | |
| 5 | Human-Computer Interaction | 2 | 5.1 Overreliance and unsafe use |
| 6 | Socioeconomic & Environmental | 6 | |
| 7 | AI System Safety, Failures, & Limitations | 6 |
The OWASP Machine Learning Security Top 10 is a list of ten risks of machine-learning systems. It is the list for a model that your team trains, as the LLM list of lesson 5 is for an application that calls a language model. Its project page on owasp.org shows it as a lab project and says: "The current version of this work is in draft and is being modified frequently." The entries carry the label 2023. This lesson uses ML01 and ML02 in the steps and ML04 in Your turn.
| Entry | Name | Entry | Name |
|---|---|---|---|
| ML01 | Input Manipulation Attack | ML06 | AI Supply Chain Attacks |
| ML02 | Data Poisoning Attack | ML07 | Transfer Learning Attack |
| ML03 | Model Inversion Attack | ML08 | Model Skewing |
| ML04 | Membership Inference Attack | ML09 | Output Integrity Attack |
| ML05 | Model Theft | ML10 | Model Poisoning |
The CVE Program (CVE stands for Common Vulnerabilities and Exposures) gives each publicly known flaw in a product an identifier, a CVE ID, and a record. A CVE ID is the year and a number, as in CVE-2014-0160: the record of the Heartbleed flaw in OpenSSL, a library that many web servers use. A CNA (CVE Numbering Authority) is an organisation that may assign IDs and write records. The CNA Operational Rules, version 4.2.1 when this lesson was written, say what a record must hold.
A CWE (Common Weakness Enumeration) is a numbered name for a type of weakness, such as a missing check on input. The community list of CWE names is kept at cwe.mitre.org. A record must say the type or cause of the flaw, and it should use a CWE for that, so that readers can tell what kind of flaw it is.
The CVE AI Working Group (CVEAI) was formed in 2024, and its charter went to the CVE Board in October 2024. Its charter says that it works out what counts as a CVE-able vulnerability in AI technology, and that not every AI issue suits a CVE ID. The rules add (4.2.3) that the type of technology, AI included, is never the only basis for deciding whether to assign an ID. So a CVE is about a flaw in a product that you run, such as a web framework or a retrieval library, and not about a bad answer of a model. A practitioner uses it for one duty: a named person looks for new CVE records of every component that runs code. Take the current rules and charter from cve.org.
Worked example
1. Start from the files of lessons 1 to 7
cd ~/krlab/ai-security-fundamentals/kr-books
lsassets.json assets.py attack-path.csv check_controls.py check_path.py check_threats.py check_usecase.py controls.csv flows.csv threats.csv use-case.jsonYou need assets.json and threats.csv.
2. Look up two risks in the MIT AI Risk Repository
Take T1 (a customer message tells the assistant to ignore its rules) and T5 (the provider keeps prompts that hold customer data). T1 is an attack on the system: subdomain 2.2. T5 is a leak of personal data: subdomain 2.1. Create sources.csv. Each row has the id, a few words, the source and the entry. The subdomain is written as a number: 2.2 is subdomain 2 of domain 2.
cat > sources.csv <<'EOF'
id,what,source,entry
T1,A customer message tells the assistant to ignore its rules,MIT AI Risk Repository,2.2
T5,The provider keeps prompts that hold customer data,MIT AI Risk Repository,2.1
EOFA domain with no threat is a question, not a gap. The table has nothing in domain 3, Misinformation, though lesson 5 names the risk that the assistant invents a refund rule.
3. Map two model-side threats to the OWASP ML Top 10
The assistant uses a hosted model. But KR Books also trains the order-fraud model of lessons 2 and 3, and its threats are not on a chat flow. Give them their own ids. M1 is the label flip of lesson 2: ML02 Data Poisoning Attack. M2 is the small change to an input of lesson 3, which flips the label: ML01 Input Manipulation Attack. >> adds lines to the end of a file.
cat >> sources.csv <<'EOF'
M1,Flipped labels in the weekly retraining data,OWASP ML Top 10,ML02
M2,A small change to an input flips the label,OWASP ML Top 10,ML01
EOF4. Name who watches the CVE List
Create watch.csv: for each asset that runs code, the component and the person who looks for its CVE records. The provider patches its own stack (lesson 8), so the hosted model is not on the list. The checker looks at three layers only. A database engine or a vector store in the data layer runs code too: add a row for it when you have one. The file lacks one asset on purpose.
cat > watch.csv <<'EOF'
asset,component,watcher
A3,retrieval library and chat code,lead developer
A5,web server and its framework,platform team
EOF5. Write the checker and run it
Create check_sources.py. It checks that each entry exists in its list, that an id that starts with T is in threats.csv, and that each asset of the layers application, agent and infrastructure has a watcher. The new Python parts are:
partition(".")gives three values: the part before the first dot, the dot, and the part after it. The linedomain, _, sub = ...keeps the first and the last.a <= x <= bis true whenxis betweenaandb.startswith("T")is true for a text that begins with T.isdigit()is true for a text of digits.{k: v for ...}builds a dictionary the way a set comprehension builds a set.dict.get(key, "")gives the value of a key, or an empty text.f"ML{n:02d}"writesnwith two digits, so 1 becomesML01.
The folder is an optional word, as in lesson 4.
kr-books/check_sources.py
import csv
import json
import sys
DOMAINS = {1: 3, 2: 2, 3: 2, 4: 3, 5: 2, 6: 6, 7: 6} # MIT domain -> number of subdomains
ML = {f"ML{n:02d}" for n in range(1, 11)}
RUNS_CODE = {"application", "agent", "infrastructure"}
folder = sys.argv[1] if len(sys.argv) > 1 else "."
threats = {t["id"] for t in csv.DictReader(open(f"{folder}/threats.csv"))}
assets = json.load(open(f"{folder}/assets.json"))["assets"]
links = list(csv.DictReader(open(f"{folder}/sources.csv")))
watchers = {w["asset"]: w["watcher"] for w in csv.DictReader(open(f"{folder}/watch.csv"))}
def entry_ok(source, entry):
if source == "OWASP ML Top 10":
return entry in ML
if source == "MIT AI Risk Repository":
domain, _, sub = entry.partition(".")
return domain.isdigit() and sub.isdigit() and 1 <= int(sub) <= DOMAINS.get(int(domain), 0)
return False
bad = 0
for row in links:
problems = []
if not entry_ok(row["source"], row["entry"]):
problems.append("unknown entry")
if row["id"].startswith("T") and row["id"] not in threats:
problems.append("unknown threat")
bad += bool(problems)
print(f'{row["id"]:<4}{row["source"]:<24}{row["entry"]:<6}{"; ".join(problems) or "ok"}')
print(f"{len(links)} links, {bad} with a problem")
unwatched = [a["id"] for a in assets if a["layer"] in RUNS_CODE and not watchers.get(a["id"], "").strip()]
print("assets that run code and have no CVE watcher:", unwatched or "none")
sys.exit(1 if bad or unwatched else 0)python3 check_sources.pyT1 MIT AI Risk Repository 2.2 ok
T5 MIT AI Risk Repository 2.1 ok
M1 OWASP ML Top 10 ML02 ok
M2 OWASP ML Top 10 ML01 ok
4 links, 0 with a problem
assets that run code and have no CVE watcher: ['A4']The checker knows two sources only: a row with another list, such as MITRE ATLAS, gets "unknown entry", and a third list needs a new branch in entry_ok. The links hold, but the order-status tool (A4) has no watcher. A checker that passes does not prove that a link is right: it proves that the entry exists. You decide whether ML02 fits M1.
6. Add the missing watcher
echo 'A4,order-status tool and its libraries,lead developer' >> watch.csv
python3 check_sources.py
echo "exit code $?"T1 MIT AI Risk Repository 2.2 ok
T5 MIT AI Risk Repository 2.1 ok
M1 OWASP ML Top 10 ML02 ok
M2 OWASP ML Top 10 ML01 ok
4 links, 0 with a problem
assets that run code and have no CVE watcher: none
exit code 07. The finished files
sources.csv and watch.csv grew by appended lines. These are the whole files. The lab files of the course hold them.
The finished files: sources.csv and watch.csv
kr-books/sources.csv
id,what,source,entry
T1,A customer message tells the assistant to ignore its rules,MIT AI Risk Repository,2.2
T5,The provider keeps prompts that hold customer data,MIT AI Risk Repository,2.1
M1,Flipped labels in the weekly retraining data,OWASP ML Top 10,ML02
M2,A small change to an input flips the label,OWASP ML Top 10,ML01kr-books/watch.csv
asset,component,watcher
A3,retrieval library and chat code,lead developer
A4,order-status tool and its libraries,lead developer
A5,web server and its framework,platform teamYour turn
The clinic also trains a no-show model on its booking history. A colleague linked some threats of the clinic table to the public lists and started the watch list. In the clinic folder of lesson 1, save the two files.
clinic/sources.csv
id,what,source,entry
T1,A patient message tells the assistant to ignore its rules,MIT AI Risk Repository,2.2
T4,The provider keeps prompts that hold patient data,MIT AI Risk Repository,2.9
T12,A link in an answer leaks data,MIT AI Risk Repository,2.2
M1,A stranger copies the no-show model with many queries,OWASP ML Top 10,ML11
M2,A stranger learns that a named patient was in the training data,OWASP ML Top 10,ML03clinic/watch.csv
asset,component,watcher
C5,chat code and its libraries,lead developer
C7,web server and its framework,platform teamRun python3 ../kr-books/check_sources.py . from the clinic folder, and repair both files. Use the threats.csv that you repaired in lesson 6. A row can pass the checker and still be wrong, so read each entry against its list.
Last, write one sentence for the clinic director: which component of the booking tool would you watch first, and why?
Check yourself
The KR Books table has no threat in domain 5 of the MIT AI Risk Repository. Is that a gap, and what would you add?
It is a question, not an error. Domain 5 covers overreliance, so ask whether customers could act on a wrong answer of the assistant without a check. A threat such as "a customer follows an invented refund rule" fits flow F9, with a control such as a person who decides every money matter.
A prompt injection in the chat of the assistant: will a CVE record exist for it?
Not by that fact. A CVE record is about a flaw in a product, with an affected product, versions and a public reference. The charter of the CVE AI Working Group says that not every AI issue suits a CVE ID. A flaw in the library that handles the chat can have a record.
Why does the checker pass ML01 for any threat, even a wrong one?
It checks only that the entry exists in the list. Whether the entry describes the threat is a judgement. Write the reason in the what column and have a second person read it.
You cite the OWASP ML Top 10 in a report to a customer. What do you write besides the entry?
The state and the edition: a draft, with entries labelled 2023, read on a date. Say that the list can change. The same rule holds for the MIT repository, which is a living database.
Field notes
- Use the Causal Taxonomy to sort your threats too: is the cause an AI decision or a human one, and does it act before or after deployment? A table with only post-deployment threats has not looked at the training pipeline.
- The index of the OWASP ML Top 10 calls ML06 "AI Supply Chain Attacks", while the page of that entry is titled "ML Supply Chain Attacks". When two names differ, cite the id and the date.
- A watcher is a role with a routine, not a name in a file. Run a search of the CVE List for the products and versions of the asset map each week, and record who answered each hit and how fast.
- Not every flaw of an AI system gets a CVE record. Keep your own list of issues for the rest, such as prompt injection in your own prompt, and track them in the threat table.
- Keep
use-case.json,sources.csvandwatch.csvbeside the other files of the security file (lesson 10). The rules of its checker do not read them yet: the next rules to add are one for the use case and one for the watch list.