
Threat Modeling — STRIDE, Trust Boundaries & Attack Trees
Stop guessing where the bugs are. Threat modeling is the structured habit of asking — for every component you ship — what could go wrong, who would do it, and what stops them.
What you will learn
Most security defects are predictable. They follow patterns that have repeated for thirty years across thousands of products. Threat modeling is the discipline that finds them before code is written, when the cheapest fix is still possible: a different design.
Step 1 — Diagram the System
You cannot threat-model what you cannot see. Start with a data flow diagram (DFD) of just enough fidelity to argue about. Four shapes are usually enough.
The four shapes:
- External entity (rectangle) — users, third-party APIs, attackers.
- Process (circle) — your code: a service, a function, a worker.
- Data store (parallel lines) — databases, queues, S3, caches.
- Data flow (arrow) — anything traveling between the above.
And the most important element of all: the trust boundary — a dashed line drawn wherever data crosses from less-trusted to more-trusted (or vice versa). Every trust boundary is a question to answer.
Step 2 — STRIDE, the Threat Catalogue
Microsoft's STRIDE is the most useful enumeration. Six categories, every one mapping to a property of the CIA triad — so you can never write a threat that does not point at something to protect.
| Threat | Property Violated | What it looks like | Mitigations |
|---|---|---|---|
| Spoofing | Authentication | Pretending to be another user / service | Strong AuthN, MFA, mTLS, signed JWTs |
| Tampering | Integrity | Modifying data in transit or at rest | HMAC, TLS, signed updates, file integrity monitoring |
| Repudiation | Non-repudiation | "It wasn't me" — denying an action | Append-only audit logs, signed receipts, digital signatures |
| Information Disclosure | Confidentiality | Leak of secrets, PII, schema, tokens | Encryption, RBAC, masked logs, generic errors |
| Denial of Service | Availability | Crashing or overwhelming the system | Rate limiting, autoscaling, quotas, queue limits |
| Elevation of Privilege | Authorization | Going from user to admin without permission | RBAC, defense in depth, sandboxing, kernel hardening |
- Spoofing → Authentication
- Tampering → Integrity
- Repudiation → Non-repudiation
- Information Disclosure → Confidentiality
- DoS → Availability
- Elevation of Privilege → Authorization
Step 3 — Run STRIDE on Each Element
The technique is mechanical: for every element in your DFD, walk through every relevant STRIDE category. Not every element is vulnerable to every category. The cheat sheet:
| Element | S | T | R | I | D | E |
|---|---|---|---|---|---|---|
| External entity | ✓ | ✓ | ||||
| Process | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Data flow | ✓ | ✓ | ✓ | |||
| Data store | ✓ | ✓partial | ✓ | ✓ |
Step 4 — Worked Example: A Login Endpoint
Step 5 — Risk-Rank with DREAD or Likelihood × Impact
Not every threat justifies an immediate fix. DREAD (Damage, Reproducibility, Exploitability, Affected users, Discoverability) once gave a 1–10 score per axis; the modern simplification is just likelihood × impact, on a 5-point scale each, ranked into a heat map.
- Credential stuffing on /login
- Verbose SQL errors leaked to client
- Public S3 bucket with PII
- Internal admin tool with weak password (no internet exposure)
- Rate limiting bypass on a low-cost endpoint
- Self-XSS that requires the victim to paste into devtools
Attack Trees — When STRIDE Isn't Enough
STRIDE is great for catching known classes. Attack trees are better for thinking like an adversary toward a specific goal. Put the attacker's objective at the root and decompose, AND/OR-style.
Attack trees expose cost asymmetries. Phishing is $0.50 per attempt; insider compromise costs months. Defenders waste budget hardening the expensive paths and ignoring the cheap ones. Always cost the leaves.
Show answer
How Often Should You Threat-Model?
The honest answer: continuously, but not exhaustively. The pragmatic schedule for most teams:
- Per design doc — a threat model section before any new system is approved. 30 minutes is often enough.
- Per major change — a new trust boundary, a new external integration, a new data class.
- Annual review — re-run STRIDE on the top-N most critical systems. Threats evolve; so do dependencies.
- Adam Shostack — Threat Modeling resources (author of the four-question frame)shostack.org
- Threat Modeling Manifestothreatmodelingmanifesto.org
- OWASP Threat Modeling Cheat Sheetowasp.org
- Microsoft — STRIDE threat categories referencelearn.microsoft.com
- MITRE CAPEC — Common Attack Pattern Enumerationcapec.mitre.org
- MITRE ATT&CK — adversary tactics & techniquesattack.mitre.org
Finished reading?