Threat Modeling
The cheapest security control ever invented is a whiteboard session held before the system exists. Once code is written, network rules are set and data is copied into a warehouse, every correction costs a sprint; a threat model spent at design time costs an afternoon. The discipline is often misread as a brainstorming exercise that produces a list of scary words, but a usable threat model is narrower than that: it names the assets worth attacking, describes how data actually moves, enumerates specific abuse cases against specific elements, and terminates in work that appears on a roadmap with an owner attached.
What a threat model decides, and what it does not
A model answers three questions â what can go wrong, how bad is it, and what are we doing about it â for a bounded system. It does not certify security, replace penetration testing, or produce a defensible number that stays true after the architecture changes. Treat it as a photograph with an expiry date, not a property of the system.
| Activity | Output | Best timing |
|---|---|---|
| Threat modeling | Abuse cases, controls, residual risk | Before build, and after major change |
| Penetration testing | Evidence of exploitable flaws | After the model's controls ship |
| Security review | Compliance against a checklist | At design freeze |
| Risk assessment | Prioritized risk register across systems | Quarterly or on strategy change |
Confusing these produces familiar waste: penetration tests run on systems nobody modeled, so they find injection flaws while the actual problem â an unauthenticated internal API with customer data â never appears on anyone's list.
Scoping: four questions before drawing anything
Start with the boundaries. Which system is in scope, including the third-party services it calls? What data classes flow through it? Who can act on it â users, operators, service accounts, an administrator at 2am? What is explicitly out of scope, recorded in writing so the conversation does not expand indefinitely? Scope that fits on one line gets modeled; scope that fills a paragraph gets postponed, and postponed models never happen.
Next, decide the level of abstraction. Model at the level where decisions are still reversible: components and trust boundaries, not individual functions and not the entire corporate network. A useful test is whether each box in your diagram could plausibly be compromised independently. If two boxes always fail together, they are one element; if they hold different credentials or sit in different accounts, they are two, regardless of how tightly the team believes they are coupled.
Data flow diagrams: draw the system you actually run
A data flow diagram is four symbols and one rule. External entities, processes, data stores and data flows, with trust boundaries drawn where authentication or ownership changes. The rule is that every element gets examined: threats are attached to elements and flows, which is what makes STRIDE systematic rather than a list of opinions.
STUDENT PORTAL - data flow and trust boundaries
[ Student ] --(1. HTTPS, session cookie)--> ( Web app : public tier )
|
BOUNDARY: campus network + VPN |
v
[ Student DB ] <--(3. SQL, service account)--- ( API : private tier )
^
|
(4. queue, signed) |
v
[ Analytics store ] <-- ( Export job )
Trust boundary A: internet -> public tier (untrusted input)
Trust boundary B: public tier -> private tier (service identity)
Trust boundary C: private tier -> analytics (read replica, delayed data)
Flows to examine: 1, 2, 3, 4 (2 = response carrying personal data)
Two mistakes dominate here. Diagrams drawn from documentation show the architecture the team intends rather than the one running in production, so validate against traffic, cloud inventory and deployment manifests. And flows that carry data out of the diagram â exports, webhooks, backups â are frequently omitted, yet they are where most real disclosures happen.
STRIDE applied element by element
STRIDE is a mnemonic for six ways an element can be violated. The productive move is to walk each diagram element through all six categories and ask the question in concrete terms, rather than listing threats that occur to the room.
| Category | Property destroyed | Question to ask of each element | Typical control |
|---|---|---|---|
| Spoofing | Identity | Can something pretend to be this actor? | Strong authentication, mutual TLS |
| Tampering | Integrity | Can this be modified in transit or at rest? | Signatures, hashing, access control |
| Repudiation | Non-repudiation | Can an actor deny performing this action? | Immutable audit logs with identity |
| Information disclosure | Confidentiality | Can data be read by someone unauthorized? | Encryption, field-level masking |
| Denial of service | Availability | Can this be made unavailable cheaply? | Rate limits, redundancy, quotas |
| Elevation of privilege | Authorization | Can this gain rights it should not hold? | Least privilege, authorization checks |
Run the walk on a login form and the categories become concrete: spoofing is credential guessing, tampering is a password reset token that can be edited, repudiation is a login with no log entry, disclosure is user enumeration in error messages, denial is an unthrottled endpoint, and elevation is an open redirect that lands on an admin route. The value is in the completeness of the sweep, not in the vocabulary.
Attack trees for threats worth arguing about
When a single goal matters â customer records leaving the system â an attack tree forces explicit alternatives instead of vague worry. Each node is a goal or a step, children are ways to achieve the parent, and OR nodes are joined by default while AND nodes mark paths that need several conditions simultaneously. The tree is also a communication device: it shows stakeholders exactly which leaf, if defended, removes a whole branch.
GOAL: Exfiltrate customer records (OR)
|-- A. Read from production database (OR)
| |-- A1. Steal DB credentials from code or CI [cost: low]
| |-- A2. Exploit SQL injection in reporting [cost: medium]
| `-- A3. Use a legitimate analyst account [cost: low]
|-- B. Pull from a replica or backup (OR)
| |-- B1. Access snapshot storage [cost: low]
| `-- B2. Buy a leaked copy from a broker [cost: very low]
|-- C. Intercept in transit (AND + OR)
| |-- C1. Position on the same network AND
| `-- C2. TLS disabled or certificate not validated
`-- D. Convince an insider to export (OR)
|-- D1. Phishing with a fake approval request
`-- D2. Bribery or coercion of a privileged user
Cheapest credible path today: B1, if snapshot buckets inherit
default credentials. Highest-value control: A3, because analyst
accounts are numerous, monitored least, and can satisfy the goal
without ever triggering an exploit signature.
Notice the surprise the tree produces: the dramatic injection branch is not the cheapest path, and the mundane backup path is. Attack trees earn their keep when they overturn the team's intuition about where to spend.
DREAD, and why teams game it
Scoring turns the model into a backlog order. DREAD asks for damage, reproducibility, exploitability, affected users and discoverability, each rated on a scale, then summed or averaged. The scheme is useful when the team agrees on anchors â what exactly does a seven mean? â and dangerous when the number becomes a target, because scores drift upward until every finding is critical.
DREAD = ["damage", "reproducibility", "exploitability",
"affected_users", "discoverability"]
ANCHORS = {
1: "negligible, theoretical in this environment",
3: "minor, requires unusual conditions",
5: "moderate, affects a single tenant or role",
7: "serious, affects many users, no special skill",
9: "severe, trivial to trigger, wide blast radius",
}
def dread_score(answers, weights=None):
weights = weights or {k: 1.0 for k in DREAD}
total_w = sum(weights.values())
score = sum(answers[k] * weights[k] for k in DREAD) / total_w
if score >= 8:
band = "high - fix now"
elif score >= 5:
band = "medium - fix this quarter"
else:
band = "low - accept or schedule"
return round(score, 1), band
threats = {
"stolen analyst credential": dict(damage=9, reproducibility=9,
exploitability=7, affected_users=9, discoverability=5),
"unthrottled search endpoint": dict(damage=3, reproducibility=9,
exploitability=9, affected_users=5, discoverability=9),
}
for name, ans in threats.items():
s, b = dread_score(ans)
print(f"{name:32} {s:>4} {b}")
Two disciplines keep this honest. Fix the anchors in writing so ratings are comparable across teams and years, and cap the weighting of exploitability so a theoretical issue cannot outrank a demonstrated one. If nobody can explain a score out loud without looking at the spreadsheet, the model has stopped reflecting engineering reality.
Turning findings into scheduled work
A finding without an owner and a date is a wish. For each modeled threat record the chosen disposition â mitigate, accept, transfer or avoid â the control that implements it, the backlog item, and the residual risk someone senior explicitly accepted. Revisit the model when the architecture changes materially or annually, whichever comes first, because a stale model is worse than none: it is evidence that the organization believed it was covered.
đĄTimebox the session
Common Mistakes
Modeling the architecture from design documents instead of production reality
Fix: Validate every element and flow against live traffic, cloud inventory and deployment manifests before drawing.
Listing threats as a group brainstorm without attaching them to diagram elements
Fix: Walk each element through all six STRIDE categories so completeness comes from a method, not from memory.
Treating a DREAD score as an objective measurement
Fix: Publish rating anchors, keep weights fixed, and require a spoken justification for any score of eight or above.
Recording findings with no owner, date or disposition
Fix: Assign mitigate, accept, transfer or avoid with a named owner and a backlog entry, and review residuals quarterly.
Running a model once and treating it as a permanent property of the system
Fix: Revisit after every major architectural change and at least annually, and mark the document with its expiry.
Best Practices
- Scope in a single sentence, including what is explicitly out of scope, before any diagramming
- Model at the level of components and trust boundaries where decisions are still reversible
- Use attack trees when intuition about the cheapest path is likely to be wrong
- Record accepted risk with the name of the person who accepted it, not a team label
- Feed penetration-test scope from the model so tests verify what design work flagged as important
Key Takeaways
- Threat modeling is a bounded, dated photograph of abuse cases, not a certification
- Data flow diagrams work only when drawn from production reality and when outbound flows are included
- STRIDE is systematic only if every element is walked through all six categories
- Attack trees frequently reveal that the cheapest path is mundane rather than dramatic
- Findings must convert into owned, scheduled work with an explicit disposition to be worth the session