PRACTITIONERCHAPTER 05

Threat modelling

Draw the system, find the trust boundaries, ask what can go wrong at each one, and leave with owned tickets rather than a document nobody opens

45 MINSECURITYUPDATED 2026-11-05
PREDICT

You have a data-flow diagram of a new feature with eleven elements. Where do you look first for threats?

A threat model is a structured look at a design to find what can go wrong before it is built, and to decide what to do about each thing you find. Its output is not a document. It is a set of design changes and tickets, each with an owner, plus a short record of the risks the business has chosen to carry. The document is the evidence that the conversation happened.

As a Security Engineer or AppSec Engineer you will run more of these than any other kind of review. You are judged on what gets fixed, not on what gets filed, so the craft is in running a session engineers find useful, keeping the scope small enough to finish, and leaving with work that lands in the team’s own backlog.

The four questions

Adam Shostack reduced threat modelling to four questions, and the Threat Modeling Manifesto, written by a working group of practitioners in 2020, adopted them as its core:

  1. What are we working on? A model of the system, usually a data-flow diagram.
  2. What can go wrong? Threats, found systematically with a method such as STRIDE.
  3. What are we going to do about it? A response to each threat.
  4. Did we do a good enough job? A check on the model, the threats and the follow-through.

Every method you will meet, from Microsoft’s Security Development Lifecycle to PASTA to a whiteboard session in a startup, is an answer to these four. The questions are the stable part. Techniques vary by what you are modelling.

The manifesto adds values worth holding on to: a culture of finding and fixing design issues over checklist compliance, people and collaboration over tools, a journey of understanding over a one-time snapshot, doing threat modelling over talking about it. The anti-patterns it names are the ones you will see: the hero threat modeller who does it alone, admiration for the problem without moving to fixes, overfocus on one area while others go unexamined, and perfect representation, where the team spends the session arguing about the diagram.

What are we working on: the data-flow diagram

You need a model of the system that everyone in the room agrees with. The most common is a data-flow diagram, DFD, which has five element types:

Element What it is Examples
External entity Something outside your control that sends or receives data A user’s browser, a mobile app, a card processor, a partner’s webhook
Process Code you run that transforms data An API service, a worker, a Lambda function
Data store Where data rests A database, a queue, an object bucket, a log
Data flow Data moving between two elements An HTTPS request, a message, a file transfer
Trust boundary A line where privilege or ownership changes Internet to your edge, your network to a vendor, app tier to the card vault

Trust boundaries are the point of the exercise. A flow that crosses one is a place where the receiving side has to decide whether to believe the sending side: who it says it is, what it says it wants, whether the data was altered on the way. Most of the threats you will write down sit on those crossings.

Here is a DFD in text, the form that fits in a design doc and a pull request. Pochard, a fictional card-issuing fintech, is adding transaction notifications: when a cardholder’s card is used, the card processor tells Pochard, and Pochard pushes a notification to the app.

[Card processor] --F1 webhook (HTTPS)--> ||TB1|| (Webhook receiver) --F2--> [[Event queue]]
                                                                              |
                                                                             F3
                                                                              v
[Cardholder app] <--F5 push-- [Push provider] <--F4-- ||TB1|| (Notifier) --F6--> [[Transactions DB]]

[ ] external entity   ( ) process   [[ ]] data store   ||TB1|| internet / Pochard boundary

Keep the diagram at the level of the change. A context diagram of the whole company is not useful in a feature review, and a diagram of every function is too much. If the session is arguing about whether a box is one process or two, pick one and move on: that is the perfect-representation trap.

What can go wrong: STRIDE

STRIDE was devised by Loren Kohnfelder and Praerit Garg at Microsoft in 1999. Each letter is a class of threat that violates a security property, which is why it works as a prompt: you walk each element and ask each question.

Threat Property violated Question to ask at the boundary Standard mitigations
Spoofing Authentication Can someone pretend to be this sender? Signed requests (secrets, rotation and replay), OAuth tokens, mutual TLS
Tampering Integrity Can the data be changed on the way or at rest? MACs and signatures (hashing, MACs and signatures), parameterised queries (SQL injection), CSRF tokens
Repudiation Accountability Could an actor deny doing this, and could you prove otherwise? Append-only audit logs, signed records, request ids
Information disclosure Confidentiality Who can read this who should not? Encryption in transit, authorisation on every read, output encoding against XSS
Denial of service Availability Can someone make this unavailable or expensive? Rate limiting, quotas, timeouts, back-pressure
Elevation of privilege Authorisation Can someone do more than they are allowed to? Authorisation checks at the resource, least privilege, injection fixes

The lessons linked in the table teach the mechanisms. Your job in a threat model is to recognise which one applies, not to reinvent it.

Not every letter applies to every element. Shostack’s STRIDE-per-element chart narrows the questions:

Element S T R I D E
External entity yes yes
Process yes yes yes yes yes yes
Data store yes yes, if it is a log yes yes
Data flow yes yes yes

Walk the Pochard diagram with it. F1 crosses TB1 from the processor: can someone other than the processor post to the webhook endpoint (spoofing)? Yes, unless each request is signed with a shared secret and checked. Can a captured, correctly signed request be sent again (tampering, in the form of replay)? Yes, unless the signature covers a timestamp and the receiver rejects stale ones; the replay lesson shows why a valid signature is not enough. The processor also retries on timeout, so the receiver will see genuine duplicates and must handle them with idempotency keys, or cardholders get two notifications and the transactions table gets two rows. Can someone flood the endpoint (denial of service)? Rate limit by source and keep the receiver’s work small: verify, enqueue, return. F5 to the push provider: does the notification body contain the full merchant name and amount on a lock screen (information disclosure)? That is a product decision as much as a security one, which is why the PM is in the room.

Each threat you write down names an actor, an action and an impact. “Spoofing on F1” is a category. “An attacker who finds the webhook URL posts fake transactions, and cardholders receive fraudulent ‘your card was used’ notifications that phish them into calling a fake support number” is a threat a team can fix.

STRIDE is not the only method. The OWASP Threat Modeling Cheat Sheet lists the main alternatives and when each fits: attack trees for a high-value attacker goal (“move money out of a customer account”), misuse cases for abuse of a legitimate workflow, LINDDUN for privacy threats, PASTA for tying threats to business impact. Its advice is to pick the technique that fits the question and say what it does not cover, rather than stacking methods to look thorough. For most feature reviews, STRIDE on the boundary-crossing flows, plus a few minutes asking “how would a fraudster abuse this?”, is enough.

What are we going to do about it

Every threat gets one of four responses. They are the four risk treatments from security philosophies under the names threat modellers use: mitigate is reduce and eliminate is avoid.

  • Mitigate. Add a control that makes the threat harder or less damaging: a signature check, an authorisation check, a rate limit. This is most of them.
  • Eliminate. Remove the feature, the data or the flow. The cheapest secure system is the one that does not store the card number. If a flow exists only for convenience, deleting it is a legitimate answer.
  • Transfer. Move the risk to a party better placed to carry it: a vendor’s tokenisation service, an identity provider, insurance. Transfer moves the work, not the accountability; you still own checking that they do it.
  • Accept. Decide to carry the risk. Acceptance is a business decision, so it needs a named owner who has the authority to make it, a reason, and a date to look again. A security engineer does not accept risk on the business’s behalf, and does not refuse to let the business accept it either.

Prefer standard mitigations to bespoke ones. The team should reach for the company’s existing auth middleware, the shared webhook verification library, the platform rate limiter. A bespoke control is new code that needs its own threat model. At Lead level these shared controls become paved roads, and a threat model can cite one instead of describing it.

Rank threats coarsely. A high, medium or low for likelihood and for impact, agreed in the room, is enough to order the work. Numeric schemes such as DREAD look rigorous, but different reviewers give the same threat different numbers, and the arithmetic hides the disagreement. CVSS is for scoring vulnerabilities in shipped software, which vulnerability management covers; it does not fit a threat in a design that does not exist yet.

The output of this step is tickets in the team’s own tracker, tagged so you can find them, each linked to its threat id. A mitigation that lives only in the threat-model document has not been agreed to.

Did we do a good enough job

The fourth question is the one most teams skip. Check four things:

  • The model matches the system. Ask the engineer who will build it whether the diagram is right. After launch, compare it with what was built.
  • Every boundary-crossing flow was examined. A threat table with ten rows on the database and none on the vendor integration missed the vendor integration.
  • Every threat has a response, every mitigation a ticket, every acceptance an owner.
  • The mitigations are verified. Each one has a test or a check. This is where the threat model meets the QA engineer’s risk-based test strategy: your threat list is a risk list, and the riskiest rows deserve negative tests (“a webhook with a valid signature and a ten-minute-old timestamp is rejected”).

Then write down what would make the model out of date: a new external entity, a new data store with sensitive data, a change in who can call an endpoint. That is the trigger for the next session.

Where practitioners disagree

Question One view The other view
Who models The security team, for consistency and expertise The development team, because they know the system and security does not scale; the manifesto warns against the hero modeller
What to model Everything, so nothing is missed Only changes that add or move a trust boundary, or touch the crown jewels
Method Systematic, element by element (STRIDE) Attacker-centric: attack trees, abuse cases, MITRE ATT&CK techniques
Output A durable document, versioned with the design A conversation, with a short record; the manifesto values dialogue, with documents recording it
Tooling A diagramming tool such as the Microsoft Threat Modeling Tool or OWASP Threat Dragon, or threat models as code A whiteboard and a table in the design doc

Most mature programmes land in the middle: developers run the first pass with a template, security facilitates the high-risk ones, STRIDE for coverage plus an attacker-goal pass for the crown jewels, and the record lives beside the design doc where engineers will find it. Where you sit depends on how many of you there are, which is the decision at the end of this chapter.

Where threat models go wrong

The shelf document. Forty pages, beautifully diagrammed, written by security, read by nobody. The fix is a short model whose threats became tickets in the team’s backlog.

Too big a scope. “Threat model the platform” never finishes. Model the change, or one flow, in one session.

Threats with no actor. “Attacker compromises AWS” is not actionable. Name who, through which flow, to what effect.

Too late. A model run the week before launch can only produce exceptions. The time to model is when the design doc is in review and changing a flow costs an afternoon.

Security fills in the table alone. You will find threats faster on your own, and the team will own none of them. Ask the questions and let the engineers answer; the threats they find are the ones they fix.

Never revisited. The system drifts and the model describes a design that no longer exists. Tie the refresh to the triggers you wrote down, not to the calendar.

Day to day

Threat modelling is a weekly rhythm, not an annual exercise.

Intake, a few hours a week. Design docs arrive with a security section: data touched, new external parties, new endpoints, changes to who can do what. You read each one and triage it in ten or fifteen minutes. Slack’s open-source goSDL is a public example: a short questionnaire produces a risk ranking that decides how much security involvement a feature gets. Low-risk changes get a checklist. Changes that add or move a trust boundary get a session.

The session, 60 to 90 minutes. Book it while the design is still changing. Invite the tech lead, the engineers who will build it, and the PM, who owns the product trade-offs and some of the acceptances; add an SRE if availability is in play. Ask the team to bring the DFD, or draw it together in the first twenty minutes. Then walk the boundary-crossing flows with STRIDE. You facilitate, ask the questions, and supply the standard mitigation when the team reaches for a bespoke one. End by reading back the threats and responses and agreeing owners.

Write-up, within two working days. Turn the notes into the template, file tickets in the team’s tracker, and link the model from the design doc. As a rule of thumb, if the write-up takes longer than the session, the scope was too big.

Follow-through, at launch readiness. Before launch, check the tickets: which mitigations shipped, which were deferred and by whose decision. Deferred mitigations become accepted risks with an owner, or they block.

Refresh, on trigger. The crown-jewel systems, such as authentication, money movement and the card vault, get their model revisited when their design changes, and reviewed at least once a year as a rule of thumb. Feature models are refreshed only when a trigger fires.

The meetings that matter: the design review or architecture forum, where you see changes early; your security office hours, where engineers bring half-formed designs; and the launch readiness review, where you check the follow-through. In a typical week you might triage eight design docs, run two sessions, and chase the tickets from last month’s.

BY ORG SIZE
STARTUPunder 30 people

There is no security engineer. The CTO or the most security-minded engineer runs the four questions on a whiteboard for anything touching authentication, money or customer data, in forty-five minutes. The output is a photo of the diagram and a list of tickets pasted into the design doc. That is enough. The biggest wins are eliminations: do not store the card number, use the identity provider, do not build an admin panel with its own login. Enterprise customers’ security questionnaires will start asking how you review designs; a folder of these short models is the honest answer.

SCALE-UP30 to 300

You are the first AppSec engineer and you are the bottleneck. Build an intake: a security section in the design-doc template and a triage questionnaire that routes boundary-changing work to you. Run those sessions yourself and train two or three engineers to co-facilitate, so the next sessions do not need you. Keep a template short enough that teams use it. Auditors for SOC 2 or PCI DSS may ask for evidence of design review, so store models where you can find them. Your measure is whether the risky changes were modelled before build.

ENTERPRISE300 and up

Threat modelling is a programme with a standard: which tiers of system need a model, a template, tooling, and a review path. Security champions in each team do the first pass and security architects review the high-risk ones. The problems are consistency across hundreds of services, models that go stale, and politics when a model blocks a launch: you need a risk-acceptance path with a named executive who can sign. Measure coverage of the crown-jewel systems and the age of their models, not the number of documents produced.

ARTEFACT Write the threat model ~75 MIN
YOU PRODUCEThreat model: data-flow diagram, STRIDE table, mitigations

Template

# Threat model: <system or change>
Author · Facilitated with: <tech lead, engineers, PM> · Date · Design doc: <link>
Status: draft | reviewed | mitigations in progress | closed

## 1. What are we working on
**In scope:** <the change, the flows>
**Out of scope:** <and where those are covered>
**Assets:** <what an attacker wants: data, money, access, availability>
**Actors:** <legitimate users, operators, external attackers, malicious insiders>

### Data-flow diagram
<ASCII diagram, or a link to one>

| ID | Element | Type (external entity / process / data store) | Owner |
|---|---|---|---|

| ID | Flow | From → To | Data carried | Crosses boundary |
|---|---|---|---|---|

**Trust boundaries:** TB1 <name: what is on each side> · TB2 ...

## 2. What can go wrong
| ID | Element / flow | STRIDE | Threat (actor, action, impact) | Likelihood H/M/L | Impact H/M/L |
|---|---|---|---|---|---|

## 3. What are we going to do about it
| Threat | Response (mitigate / eliminate / transfer / accept) | Control | Ticket | Owner | Verified by |
|---|---|---|---|---|---|

### Accepted risks
| Threat | Why we accept it | Accepted by | Review date |
|---|---|---|---|

## 4. Did we do a good enough job
- [ ] Builders confirm the DFD matches the design
- [ ] Every boundary-crossing flow has rows or a stated reason
- [ ] Every mitigation has a ticket and a test
- [ ] Launch readiness: deferred mitigations converted to acceptances or blockers

**Revisit when:** <new external entity, new sensitive store, change to who can call what>

## Open questions
| # | Question | Owner | By |
|---|---|---|---|
WORKED EXAMPLE

Pochard is a fictional card-issuing fintech: 140 people, 600,000 cardholders, debit cards issued through a card processor, card numbers held in Pochard’s own vault inside its PCI DSS cardholder data environment (CDE). The cards team wants a “show card details” button so customers can use a new virtual card before the plastic arrives. The AppSec engineer ran a 75-minute session with the tech lead, two engineers and the PM.

Scope. In: revealing the card number (PAN), expiry and CVV in the app. Out: the support console (separate model, ticket SEC-88). Assets: PAN and CVV; the cardholder’s session. Actors: cardholders, an attacker holding a stolen session token, malware on a customer’s phone.

DFD. E1 cardholder app. P1 API gateway. P2 card service. P3 vault reveal endpoint, inside the CDE. DS1 vault card store. DS2 audit log. F1 app → gateway, reveal request with session token, crosses TB1 (internet / Pochard). F2 gateway → card service. F3 card service → vault, mint a single-use reveal token, crosses TB2 (app tier / CDE). F4 app → vault reveal endpoint, redeem token, receive PAN and CVV, crosses TB1 and TB2. F5 vault → audit log.

The first draft sent the PAN back through the gateway and card service. The session changed that to F4, so the PAN never touches the app tier and those systems stay out of PCI scope: an elimination.

ID Where STRIDE Threat Response and control Ticket
T1 F1 S Attacker with a stolen session token reveals the card from their own device Mitigate: step-up with device biometric and a device-bound key before minting CARD-301
T2 P2 E Customer requests reveal for a card id that is not theirs Mitigate: card service checks card owner against session customer; negative test CARD-302
T3 F4 T Captured reveal token is redeemed again Mitigate: single use, 60-second expiry, bound to device key (replay) CARD-303
T4 F4 I PAN logged by gateway or CDN Eliminate: PAN goes vault → app only, over TLS CARD-304
T5 P3 E Card frozen between minting and redemption still reveals Mitigate: check freeze status at redemption, not only at minting (TOCTOU) CARD-305
T6 P3 D Scripted reveals hammer the vault Mitigate: 5 reveals per card per hour (rate limiting); limit chosen by the PM from app analytics CARD-306
T7 DS2 R Customer disputes revealing the card before fraud Mitigate: append-only audit entry per reveal, with device id CARD-307
T8 E1 I Malware on a rooted phone reads the screen Accept n/a

Accepted risk. T8: Pochard cannot control a compromised device; the app hides card details in the app switcher and blocks screenshots on Android. Accepted by the Head of Fraud; review in six months, or sooner if fraud on revealed cards rises above the rate on plastic cards.

Revisit when the support console gains reveal, or the vault moves to a vendor.

Now you

You are the AppSec engineer at Wigeon, a fictional group-chat app with 3 million monthly users and 45 engineers. The platform team plans to launch bots in five weeks with 40 partners. A group admin adds a bot; the bot gets an OAuth token scoped to that group, receives messages through a webhook URL the partner registers, and posts replies that can include rich cards with links and images. The design doc has a diagram but no security section. Complications: the largest launch partner wants read access to every group the bot is in, including message history from before it was added, “for analytics”; group admins today are recorded nowhere, so nobody can say who added a bot; and the PM has said that a security review must not move the date. Write the threat model: the DFD with its trust boundaries, a STRIDE table covering at least the token, the webhook, the rich cards and the partner’s history request, the responses, and the accepted risks with who should accept them.

Self-check

DECIDE

You are the only AppSec engineer at Pochard, 140 people, 14 product teams. Last quarter the teams wrote 38 design docs. A full threat-model session and write-up costs you about a day, and you also own code review and the vulnerability backlog. The CTO asks you to commit to a threat-modelling policy for next quarter. What do you commit to?

READING
  1. BOOK
    Threat Modeling: Designing for Security Adam Shostack, 2014

    The standard text, by an author who worked on threat modelling in Microsoft's Security Development Lifecycle team. The first three chapters are enough to run your first session; the rest is a reference for the cases this chapter skips. Read: Chapter 1 runs a whole model end to end; chapter 2 for diagrams and trust boundaries; chapter 3 for STRIDE and STRIDE-per-element.

  2. DOC
    Threat Modeling Manifesto 2020

    One page from a working group of practitioners: the four questions, the values, and the anti-patterns. Read it before you design a programme, and reread the anti-patterns after your first month.

  3. DOC
    The Four Question Framework Adam Shostack

    The current wording of the four questions, how it has changed since the book, and which organisations use it. Short; useful when you are writing your own template.

  4. DOC
    OWASP Threat Modeling Cheat Sheet OWASP

    A practical walk through the four phases with STRIDE, and the clearest short guide to choosing between STRIDE, attack trees, LINDDUN and PASTA.

  5. DOC
    Threats: Microsoft Threat Modeling Tool Microsoft

    Microsoft's own definitions of the six STRIDE categories, from the organisation that created them. Useful as a shared vocabulary for a team new to the method.

  6. POST
    Moving Fast and Securing Things Slack Engineering

    How Slack's goSDL triages features by risk so product security spends time where it matters. A public model for the intake step and for the decision in this chapter.

  7. DOC
    LINDDUN privacy threat modelling DistriNet, KU Leuven

    The privacy counterpart to STRIDE: linking, identifying, non-repudiation, detecting, data disclosure, unawareness, non-compliance. Reach for it when the asset is personal data rather than money or access.

All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.
NEXT: Secure code review and AppSec →