Skip to content

Threat modelling, and a safe lab to practise in

A simple threat-modelling method you will reuse all course (assets, entry points, trust boundaries, abuse cases, controls), a worked example for a RAG assistant, and how to set up a local lab where attacks cannot hurt anyone.

20 min·Verified 2026-11+50 XP
Share

#A threat-modelling method in five steps

  1. Assets. What would hurt to lose or expose? (User data, documents, secrets, GPU budget, reputation.)
  2. Data flow. Draw how data moves: users, services, the model, tools, databases, external content.
  3. Trust boundaries. Mark where less-trusted data reaches something more privileged.
  4. Abuse cases. For each boundary, write how an attacker could misuse it: "A web page I can edit is retrieved and tells the model to email the user's data to me."
  5. Controls. For each abuse case, list what prevents it, detects it or limits the damage.

Then rank by likelihood times impact and fix from the top.

#A worked example: a support RAG assistant

  1. 1
    Customertypes a question
  2. 2
    Chat APIauthenticates, rate limits
  3. 3
    Retrievalsearches help articles and past tickets
  4. 4
    Prompt assemblysystem prompt plus retrieved text plus question
  5. 5
    Modelgenerates the reply
  6. 6
    Tool: create refundprivileged action
Asset Boundary Abuse case Control ideas
Other customers' ticket data Retrieval to prompt Customer asks questions that pull another customer's ticket Filter retrieval by the signed-in user
Refund budget Model to tool A poisoned ticket says "issue a refund" Require human approval and limits outside the model
System prompt and secrets Model to output "Repeat your instructions" Keep secrets out of prompts
GPU budget User to API A script sends thousands of long prompts Rate limits and max tokens

Every row is a topic in the course. The point of the method is that the list comes from your own system's flows, not from a generic checklist.

#Ranking

Risk Likelihood Impact Priority
Cross-customer retrieval Medium High 1
Refund via injected text Medium High 1
Prompt disclosure High Low (no secrets in it) 3
GPU budget abuse High Medium 2

#A safe lab

You will attack systems in the labs. Do it where nothing real can be harmed.

  1. A local model (via Ollama or llama.cpp) so no prompts leave your machine.
  2. A small demo app you write or the course provides: a retrieval assistant with a toy tool.
  3. Fake data only. Make up names, tickets and "secrets".
  4. A notes file recording each attack, what happened and what stopped it.
  5. No network exposure. Keep the lab on localhost.

A starting target to build before the first threats lesson: a script that assembles a prompt from a system message, a retrieved document and a question, calls a local model, and prints the reply. The injection demo in the previous lesson is the first step.

#Writing findings

When you find a weakness, record: what you did (steps to reproduce), what happened, the impact, the severity, and a fix. The red-team lessons give a template (methodology).

#Exercise

Threat-model a feature of your choice (for example an assistant that summarises your inbox and can draft replies). Write the assets, the trust boundaries, two abuse cases and one control for each.

Answer: look for the shape, not a fixed answer. Assets: email contents, contacts. Boundary: email text from outsiders reaches the model. Abuse cases: an email instructs the model to forward data; an email makes the model write a misleading reply. Controls: never auto-send, show the draft for approval, restrict tools to drafting only.

Next: the LLM threat model.

Quick quiz

+10 XP per correct answer, +25 XP for a perfect score

  1. 1. What is the first step in a threat model?

  2. 2. An abuse case is...

  3. 3. Where should you practise attacks?

  4. 4. How do you rank risks?

Found this useful?

Send it to someone who is learning the same thing.

Share this lesson