Courses3 levels
Level 1 · Foundations11 courses
Level 2 · Core5 courses
Level 3 · Advanced5 courses
Labs8 topics
Library Practice exams AI Range Pricing Start free

Lesson 04 · 40 minutes

Describe an attack with a shared vocabulary

After this lesson you can
  • Explain the difference between a tactic and a technique
  • Write an ordered attack path for an AI system with a control for each step
  • Check with a script that no step of the path lacks a control
Lab files of this lesson (14)

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

Last week a customer of KR Books saw another customer's order data in a chat. The incident ticket says "the bot got hacked". The detection team cannot search for that, and the manager cannot compare it with the incident of last year. Your lead asks you to write the attack as numbered steps in the shared vocabulary of the field, and to name a control for each step. Then the clinic team asks for the same on their assistant.

Recall

Lesson 1: which assets of the KR Books map hold text that customers wrote?

A1, the help documents with customer reviews, and A6, the orders database with delivery notes. The assistant reads both, so both can carry an attack.

Lesson 3: name the three families of attack in the NIST report, and say which one acts at query time and changes the input.

Evasion, poisoning and privacy. Evasion acts at query time: it changes the input so that the model gets it wrong.

The idea

MITRE ATLAS is a public knowledge base of how adversaries attack AI systems. It is built like MITRE ATT&CK, the knowledge base for attacks on ordinary systems, and it uses the same two levels.

LevelQuestion it answersExample
TacticWhy: what is the attacker trying to do at this step?Initial Access, Execution, Exfiltration
TechniqueHow: by which method?LLM Prompt Injection

ATLAS shares many tactics with ATT&CK, such as Reconnaissance, Initial Access, Execution, Collection, Exfiltration and Impact. It adds tactics that are specific to machine learning, such as AI Model Access and AI Attack Adaptation (the release of July 2026 called the second one AI Attack Staging, and older releases wrote ML instead of AI, so older reports say ML Model Access and ML Attack Staging; the checker below accepts all of these names). Under each tactic it lists techniques, and it records case studies of real incidents. Each technique has an identifier in the ATLAS matrix. This lesson uses tactic names and a few technique names, and no identifiers. The list of tactics changes over time. The list in this lesson is a copy of the matrix of September 2026 (release 2026.09), which has 16 tactics, so take the current names from the ATLAS matrix itself before you write them in a report.

Seven public resources appear in this course. They answer different questions, and they do not replace each other.

DocumentThe question it answers
OWASP Top 10 for LLM ApplicationsWhich risks must the builder of an LLM application check? (lesson 5)
NIST AI 100-2What are the families of attacks, and what are they called? (lesson 3)
MITRE ATLASHow do adversaries act, step by step, and what has happened in practice? (this lesson)
NIST AI Risk Management FrameworkHow does an organisation manage AI risk? It has four functions: Govern, Map, Measure and Manage. (lessons 6, 8 and 10)
OWASP Machine Learning Security Top 10Which risks threaten a model that you train yourself? Its project page calls it a draft. (lesson 9)
MIT AI Risk RepositoryWhich kinds of AI risk exist, also the ones that are not attacks, such as users who trust answers too much? It sorts risks into domains. (lesson 9)
CVE Program (CVE stands for Common Vulnerabilities and Exposures), with its AI Working GroupWhich flaws in the software that you run are public, and under which identifier? The working group decides what counts as a CVE-able flaw in AI technology. (lesson 9)

A threat model draws prompts from most of them. A practitioner uses ATLAS to describe an attack, OWASP and MIT to check that no kind of risk is missing, and CVE to learn that a component of the system has a known flaw.

An attack path is the ordered list of steps that an attacker takes from the first probe to the goal. For each step you write the tactic, the technique in plain words, the asset that it touches and the control that stops it or limits it. A path with a step that has no control shows you the next piece of work. In the path that you write below, only "LLM Prompt Injection" is a technique name from the matrix. The other techniques are plain words, so look up the real name before you report them.

An attack path through a review
InternetYour companyProviderOrder serviceVictimAttackerChat appHelp documentsReview formLanguage modelOrder tool12345678InternetYour companyProviderOrder serviceVictimAttackerChat appHelp documentsReview formLanguage modelOrder tool12345678
  1. Attacker → Review form: a review that hides an instruction
  2. Review form → Help documents: the review is indexed
  3. Victim → Chat app: asks about delivery
  4. Help documents → Chat app: the review joins the victim's prompt
  5. Chat app → Language model: the prompt carries the hidden instruction
  6. Language model → Order tool: asks for another customer's order
  7. Language model → Chat app: answer with the order data in a link
  8. Victim → Attacker: the browser loads the link, data leaves

Worked example

1. Write the attack path

You work on the KR Books assistant of lesson 1. The attacker is a customer who wants the order data of other customers. The path uses a review as the carrier. A heredoc (cat > file <<'EOF') writes every line up to the line EOF into a file. This file is a CSV (comma-separated values): one line per step, and a comma starts a new column, so do not put a comma inside a field. Create attack-path.csv in the same folder as assets.json.

cd ~/krlab/ai-security-fundamentals/kr-books
cat > attack-path.csv <<'EOF'
step,attacker_does,tactic,technique,asset,control
1,Asks the public chat what tools and sources it has,Reconnaissance,Probe the assistant with questions,A5,rate-limit
2,Writes a review that hides an instruction for the assistant,Resource Development,Prepare poisoned content,A1,doc-review
3,Waits until the review is indexed and a victim asks about delivery,Initial Access,Poisoned document reaches the model,A3,untrusted-delimit
4,The model reads the review and follows the hidden instruction,Execution,LLM Prompt Injection,A2,untrusted-delimit
5,The model calls the order tool for the order of another customer,Collection,Misuse of a connected tool,A4,tool-auth
6,The model puts the order data in a link that the browser loads,Exfiltration,Data leaves in model output,A5,output-filter
7,The attacker repeats the review trick for many victims,Impact,Scaled loss of customer data,A1,kill-switch
EOF
Step 5 of attack-path.csv
5step numberThe model calls the order tool...what the attacker doesCollectiontactic: whyMisuse of a connected tooltechnique: howA4asset touchedtool-authcontrol5step numberThe model calls the order tool...what the attacker doesCollectiontactic: whyMisuse of a connected tooltechnique: howA4asset touchedtool-authcontrol

Read it as a story. The attacker never breaks into a server. Every step uses a feature that works as designed: a review form, retrieval, a tool, a chat page. The controls are names that lesson 7 defines. The control untrusted-delimit stands at steps 3 and 4. In lesson 5 you will measure how well such a control works, so do not assume that a name in a table is a control that works.

2. Write the checker

Create check_path.py. For each step it checks three facts: the tactic is a name from the list, the asset exists in assets.json, and the control is not empty. Four points help you to read it:

  • csv.DictReader reads a CSV file and gives each line as a dictionary whose keys are the names in the first line.
  • The folder is an optional word after the script name, so that the same script can check another system.
  • As in lesson 1, the script ends with sys.exit(1) when a step has a problem, so that a build can stop on it.
  • The names in TACTICS are the ones that this lesson uses: compare them with the current ATLAS matrix before you use the script in real work.

kr-books/check_path.py

import csv
import json
import sys

TACTICS = {
    "Reconnaissance", "Resource Development", "Initial Access", "Execution",
    "Persistence", "Privilege Escalation", "Defense Evasion", "Credential Access",
    "Discovery", "Lateral Movement", "Collection", "AI Model Access", "AI Attack Adaptation",
    "Command and Control", "Exfiltration", "Impact",
    "AI Attack Staging", "ML Model Access", "ML Attack Staging",  # older names, kept so that old reports pass
}

folder = sys.argv[1] if len(sys.argv) > 1 else "."
assets = {a["id"] for a in json.load(open(f"{folder}/assets.json"))["assets"]}
rows = list(csv.DictReader(open(f"{folder}/attack-path.csv")))

bad = 0
for row in rows:
    problems = []
    if row["tactic"] not in TACTICS:
        problems.append("unknown tactic")
    if row["asset"] not in assets:
        problems.append("unknown asset")
    if not row["control"].strip():
        problems.append("NO CONTROL")
    status = "; ".join(problems) or "ok"
    bad += bool(problems)
    print(f'step {row["step"]}  {row["tactic"]:<21} {row["asset"]}  {row["control"] or "-":<17} {status}')

print(f"{len(rows)} steps, {bad} with a problem")
sys.exit(1 if bad else 0)

3. Run it

python3 check_path.py
step 1  Reconnaissance        A5  rate-limit        ok
step 2  Resource Development  A1  doc-review        ok
step 3  Initial Access        A3  untrusted-delimit ok
step 4  Execution             A2  untrusted-delimit ok
step 5  Collection            A4  tool-auth         ok
step 6  Exfiltration          A5  output-filter     ok
step 7  Impact                A1  kill-switch       ok
7 steps, 0 with a problem

4. Remove one control and run it again

Take the control away from step 5 in a copy of the file and read the result. cp copies a file. sed 's/old/new/' prints its input with the text replaced, and $ in the pattern means "at the end of the line". > writes the output into a file. This lesson reads the backup and writes the changed file, so it does not use sed -i, which works differently on Linux and macOS. sed -n 5,8p prints only lines 5 to 8. mv moves (renames) a file: here it puts the backup over the changed file, which restores the original.

cp attack-path.csv attack-path.bak
sed 's/,A4,tool-auth$/,A4,/' attack-path.bak > attack-path.csv
python3 check_path.py | sed -n 5,8p
mv attack-path.bak attack-path.csv
step 5  Collection            A4  -                 NO CONTROL
step 6  Exfiltration          A5  output-filter     ok
step 7  Impact                A1  kill-switch       ok
7 steps, 1 with a problem

If the control of step 5 is missing, a poisoned review reaches the model and the model can read any order. This one line shows why one missing control can matter more than the other six.

Your turn

The clinic team gives you the attack on their assistant. The attacker is a patient who wants to read the visit of another patient. In six steps: the patient (1) asks the chat which tools it has; (2) books a visit and types an instruction as the "reason for visit"; (3) asks the assistant about the visit; (4) the model follows the instruction that it reads in the reason; (5) the model asks the booking tool for the visit of another patient; (6) the answer, with the details of the other patient, is shown on the page.

A colleague started the file, and it has errors. In the clinic folder you made in lesson 1 (do lesson 1 first: the checker needs its assets.json), save this as attack-path.csv.

clinic/attack-path.csv

step,attacker_does,tactic,technique,asset,control
1,Asks the chat which tools it has,Reconnaissance,Probe the assistant with questions,C7,rate-limit
2,Books a visit and types an instruction as the reason,Resource Development,Prepare hostile content,C3,input-review
3,Asks the assistant about the visit,Initial Entry,Hostile text reaches the model,C5,untrusted-delimit
4,The model follows the instruction in the reason,Execution,LLM Prompt Injection,C9,untrusted-delimit
5,The model asks the booking tool for the visit of another patient,Collection,Misuse of a connected tool,C6,

Run the checker on the folder, find the errors and read the story again. Fix each error, and add step 6 with a tactic, an asset and a control that fit.

Last, ask yourself which step has the control that you trust least, and why.

Check yourself

What is the difference between a tactic and a technique?

A tactic is the goal of a step: why the attacker acts, for example to gain Initial Access. A technique is the method: how the attacker does it, for example LLM Prompt Injection. One tactic holds many techniques, and one technique can serve more than one tactic.

Why write an attack path as ordered steps and not as a list of threats?

The order shows where you can stop the attack early and where one control protects several later steps. It also shows if a late control is the only barrier, which is a weak design.

Your checker prints "ok" for every step. Does the system resist the attack?

No. The checker proves that each step has a named control. It does not prove that the control exists or that it works. Lesson 10 checks that the control is in the control matrix and has a test.

Which resource of the table answers each question: (a) a library in your chat server has a known flaw, what is its identifier? (b) the threat model has no risk of users trusting answers too much, where do you look? (c) which tactics did the attacker use?

(a) The CVE Program: a CVE record carries the identifier. (b) The MIT AI Risk Repository, whose domains also hold risks that are not attacks, such as overreliance. (c) MITRE ATLAS.

Why does this lesson give no identifiers for techniques?

A wrong identifier is worse than none, because readers trust it. Look up the identifier in the ATLAS matrix when you write a report, and note which version of the matrix you used.

Field notes

  • ATLAS case studies are the best source for a realistic path. Choose a case that matches your system and replay its steps against your own map. Note the steps that your detection would miss.
  • Write the path from the attacker's side first, with no controls, and add the controls afterwards. If you write the controls at the same time, you will describe the attack that you can already stop.
  • Map your detection to the same names. A rule that says "alert on Exfiltration through model output" can be shared with other teams, tested, and counted over time.
  • Join the path to your ordinary ATT&CK-based detection work. Many attacks on AI systems end in ordinary harm: a leaked database, a stolen credential, a fraudulent order.
  • The attack path and the tactics are inputs to a threat model (lesson 6) and to red-team plans. Keep the file in the same repository as the system, and review it when the system changes.