Threat modeling
Threat modeling is analyzing a model of a system, usually a data-flow diagram, to find security and privacy problems while they are still cheap to fix. It answers four questions: what are we working on, what can go wrong, what are we going to do about it, and did we do a good enough job?
It finds flaws before there is code for a scanner to read: an approval that does not bind to the amount approved, a webhook nobody verifies, a worker that trusts the tenant named in its job. In the site's worked example, a tool generated 118 candidate threats for an expense-claims API, and none concerned who may approve which version of a claim; the people in the session found that one.
- Who
- The team building the change: developers, a tester, the product owner and a security champion, with AppSec for new systems
- When
- During design and refinement, before the code is written, and again when the design changes
- How often
- For each story that adds a boundary, store, integration, role or sensitive data; a full session for new systems
- You end up with
- A data-flow diagram with trust boundaries, and a threat list with a response, an owner and a test for each threat kept
Do this
Scope one change and check the triggers
Model one feature or change, not the whole estate. Hold a session when a story adds or changes a trust boundary, authentication, authorization or tenant rules, a data store or sensitive data, an external integration, money movement, an admin path or secrets. When you extend an application, OWASP SAMM suggests looking only at the new functions.
Draw the data flow and the trust boundaries
Show external entities, processes, data stores and the flows between them, and mark each trust boundary: internet to API, service to database, your cloud account to a SaaS provider. Every store needs a process that writes it and one that reads it. Add background jobs, admin and support tools and partner callbacks, which teams often forget.
Ask what can go wrong at each element
Walk STRIDE over each element, using its six letters as prompts. Use an attack tree for one high-value goal such as fraud, and LINDDUN when the feature collects, links or shares personal data. The threat pattern library (Threat pattern library for threat modeling) lists the patterns that recur, such as a caller-supplied identity on a boundary flow.
Decide a response for each threat
The OWASP cheat sheet lists four responses: mitigate, eliminate, transfer or accept. Give each threat you act on an owner. Transfer does not reduce the harm itself, so name who still owns the residual controls, and have accepted risks approved by someone with the authority to accept them, with a date to revisit.
Turn mitigations into requirements and tests
Each mitigation becomes a security requirement (Security requirements) and a test named after the threat, such as
T4: an edit after approval returns 409. Track the work in the normal backlog; OWASP SAMM recommends feeding threat modeling output into defect management.Keep the model next to the code
Save the diagram and the threat records where the team can update them, ideally in the repository, so a pull request that changes a flow changes the model too. Tools such as OWASP Threat Dragon, OWASP pytm or the Microsoft Threat Modeling Tool help; a whiteboard photo and a text file also work. Always keep the outcome.
Check you did a good enough job
Compare the diagram with the deployed system, confirm that every flow crossing a boundary was considered and every threat has a response, and run the mitigation tests. Then hand the model to the security design review (Security design review) and re-run the session when a trigger from the first step recurs.
Done when
Each threat has an owner and a decision: mitigate with a named control and test, accept with an expiry date, or change the design.
Mark it in the gap checkCommon mistakes
- Modeling the whole estate at once. The session never finishes; scope it to one change and finish it.
- Treating a tool's generated threat list as the model. Tools produce generic findings and miss business rules such as who may approve what.
- Arguing whether a threat is tampering or elevation of privilege. The category does not change the fix, so use the letters as prompts.
- Relying on one expert. The Threat Modeling Manifesto names this the Hero Threat Modeler anti-pattern: everyone can and should do threat modeling.
- Closing threats without tests. A mitigation that no test checks can disappear in the next refactor without anyone noticing.
- Filing the diagram and never revisiting it. The system drifts from the model, and new boundaries go unexamined.
STRIDE's six categories
Each STRIDE category is the violation of one security property. Ask each one of every element in the diagram, then argue about the threat, not its letter.
| Threat | Property violated | Example | Typical control |
|---|---|---|---|
| Spoofing | Authentication | A stolen session token is used to act as its owner | Strong authentication, short-lived tokens, verified callers |
| Tampering | Integrity | A request sets status=approved, or data is changed in transit | Server-owned fields, input allowlists, TLS, signatures |
| Repudiation | Non-repudiation | A manager denies approving a payment, and the log can be edited | Append-only audit events with actor, object and time |
| Information disclosure | Confidentiality | Any user reads any claim by changing its ID | Object-level authorization, minimal responses, encryption |
| Denial of service | Availability | Repeated failed sign-ins lock a user out; a huge file exhausts a parser | Per-actor limits, quotas, timeouts, isolated parsers |
| Elevation of privilege | Authorization | A user edits a token claim or a field to gain an admin role | Deny-by-default authorization, server-side role checks |
Tools and guides
- Workflow: Review a design
- Choose a threat modeling method and turn its findings into tests
Use the four-question frame to scope a design, pick STRIDE, attack trees, LINDDUN or PASTA by the question you need answered, and leave behind threat records and abuse-case tests the team can run.
- Threat pattern library for threat modeling
Thirty-two recurring threat patterns grouped by identity, authorization, parsers, concurrency, integrations, data exposure, supply chain, availability and AI agents, each with where it shows up on a data-flow diagram, mitigations, a verification step and STRIDE, CWE and CAPEC links, plus a YAML catalog and a script that lists patterns per diagram element.
- Review tenant boundaries before implementation
Trace tenant identity through requests, data stores, caches, jobs, and administration, then turn plausible isolation failures into tests.
- Worked threat model: an LLM agent with tools
A complete worked threat model for an LLM agent with tools: the data-flow diagram, the threats from prompt injection, excessive agency, data exfiltration, confused-deputy and memory poisoning, and the mitigations, mapped to the OWASP Top 10 for LLM Applications 2026 and the OWASP Top 10 for Agentic Applications 2026.
Standards
- NIST SSDF 1.1
- PW.1 Design Software to Meet Security Requirements and Mitigate Security Risks
- OWASP SAMM 2
- Threat Assessment
Sources
- Threat Modeling Manifesto
- OWASP Threat Modeling Cheat Sheet
- Microsoft Threat Modeling Tool: threats and the STRIDE model
- Microsoft: Uncover Security Design Flaws Using the STRIDE Approach (MSDN Magazine). November 2006.
- OWASP SAMM: Threat Assessment, stream B (Threat Modeling)
- LINDDUN privacy threat types
- OWASP Threat Dragon
- OWASP pytm
- NIST SP 800-218: Secure Software Development Framework (SSDF) Version 1.1. February 2022.
- OWASP Top 10:2025 A06 Insecure Design