Software Securityhome
Fix a findingSearch
Phase 2 · Design

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

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. 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 check

Common 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.

STRIDE's six categories: table
ThreatProperty violatedExampleTypical control
SpoofingAuthenticationA stolen session token is used to act as its ownerStrong authentication, short-lived tokens, verified callers
TamperingIntegrityA request sets status=approved, or data is changed in transitServer-owned fields, input allowlists, TLS, signatures
RepudiationNon-repudiationA manager denies approving a payment, and the log can be editedAppend-only audit events with actor, object and time
Information disclosureConfidentialityAny user reads any claim by changing its IDObject-level authorization, minimal responses, encryption
Denial of serviceAvailabilityRepeated failed sign-ins lock a user out; a huge file exhausts a parserPer-actor limits, quotas, timeouts, isolated parsers
Elevation of privilegeAuthorizationA user edits a token claim or a field to gain an admin roleDeny-by-default authorization, server-side role checks

Tools and guides

Standards

NIST SSDF 1.1
PW.1 Design Software to Meet Security Requirements and Mitigate Security Risks
OWASP SAMM 2
Threat Assessment

Sources

  1. Threat Modeling Manifesto
  2. OWASP Threat Modeling Cheat Sheet
  3. Microsoft Threat Modeling Tool: threats and the STRIDE model
  4. Microsoft: Uncover Security Design Flaws Using the STRIDE Approach (MSDN Magazine). November 2006.
  5. OWASP SAMM: Threat Assessment, stream B (Threat Modeling)
  6. LINDDUN privacy threat types
  7. OWASP Threat Dragon
  8. OWASP pytm
  9. NIST SP 800-218: Secure Software Development Framework (SSDF) Version 1.1. February 2022.
  10. OWASP Top 10:2025 A06 Insecure Design

Find your next answer

Type to search. Search runs in your browser.

Searches run in your browser, but the host can infer them from the index files they load. The address shows your search so you can bookmark or share it.