CCyberwiki

Threat modelling

Threat modelling is the analysis of a model of a system, usually a diagram, to find what could go wrong with its security and privacy and to decide what to do about each problem.1 The process is meant to be structured and repeatable, and it looks at the system from an attacker's side. It starts early, ideally while the system is being designed, and the model is kept up to date as the system changes.2

The four questions

Most current methods follow the Four Question Framework set out by the security author Adam Shostack:3

  1. What are we working on?
  2. What can go wrong?
  3. What are we going to do about it?
  4. Did we do a good enough job?

The Threat Modeling Manifesto, written by a working group of fifteen practitioners and published under a Creative Commons licence, uses the same questions and prescribes no method.1 No industry standard defines the process.2

Modelling the system

The first question is most often answered with a data flow diagram (DFD). A DFD shows external entities such as users and outside services, the processes that run the application's code, the data stores, and the flows of data between them. Trust boundaries are drawn across the flows where the level of trust changes.2 Untrusted data sits on one side of the line and trusted data on the other, and validation is what lets data cross safely; mixing the two without it is a weakness listed in the Common Weakness Enumeration catalogue.4

External entityBrowserbooking requestProcessAPI routeSQL queryData storeDatabasetrust boundarytrust boundaryEach element and each flow is checked against the six STRIDE classes.
Figure 1. A data flow diagram of a small booking site. Requests from the browser cross one trust boundary into the application, and queries cross a second one into the database.

The model can also list entry points, the interfaces through which an attacker can send data in, and exit points, where data leaves. Entry points are layered: a site served over HTTPS is one entry point, and each page in it is another. Exit points carry their own threats. A login page that answers "username not found" tells an attacker which accounts exist, and a page that shows raw database errors helps SQL injection.5

Finding threats

For the second question, a common aid is STRIDE, a mnemonic first developed by Microsoft employees. Each letter names a class of threat and the security property that class breaks. The team asks how each class could occur at each element, flow and trust boundary in the diagram.2

Table 1. The STRIDE classes, with examples
ThreatProperty brokenExample
SpoofingAuthenticationA stolen authentication token used to act as another user
TamperingIntegrityThe application made to update database rows it should not
RepudiationAccountingLogs edited to hide what an attacker did
Information disclosureConfidentialityUser account records read out of the database
Denial of serviceAvailabilityRepeated failed logins that lock a real user out
Elevation of privilegeAuthorizationA JSON Web Token edited to change the user's role

Microsoft's Threat Modeling Tool, part of its Security Development Lifecycle, turns the classes into pointed questions, for example "How can an attacker change the authentication data?"6

Other techniques suit other scopes, though piling them on to make a model look complete is a mistake.2 An attack tree, described by Bruce Schneier in 1999, puts one attacker goal at the root. The ways to reach it hang below as OR nodes, which are alternatives, and AND nodes, which are steps that must all succeed. Values such as cost are given to the leaves and carried upward: an OR node takes the value of its cheapest child and an AND node the sum of its children, which exposes the cheapest route to the goal.7 Misuse or abuse cases test a valid workflow run out of order, repeatedly or concurrently; LINDDUN covers privacy harms; PASTA links threats to business objectives.2 Systems already running are often modelled with kill chains such as ATT&CK.5

On paper a threat is ranked by multiplying its likelihood by its impact. Both numbers are hard to estimate, and the product leaves out the work needed to fix the problem.2

Responses and review

Every threat gets one of four responses, a list that goes back to Shostack: mitigate it by lowering its likelihood, eliminate it by removing the feature that causes it, transfer contractual or financial responsibility for it to another party, or accept it. A transfer does not lower the likelihood or the harm, so the owner of the remaining risk is written down. Agreed mitigations become security requirements, as practice PW.1.2 of NIST SP 800-218 recommends.2

The fourth question is a review by everyone with a stake in the system: whether the diagram matches what was built, whether threats were missed, whether the model is documented, and whether each mitigation can be tested.2 The 2025 edition of the OWASP Top 10 asks for more threat modelling under A06 Insecure Design, along with unit and integration tests showing that critical flows resist the threat model.8

Design flaws and implementation defects

A06 separates design flaws from implementation defects: they have different causes, appear at different stages and need different fixes. A secure design can still be built with bugs, but "an insecure design cannot be fixed by a perfect implementation", because the control that would stop the attack was never designed. Its example is a cinema chain that allows group bookings of up to fifteen people without a deposit, where an attacker who models that flow books six hundred seats across every cinema in a few requests.8 Threat modelling works on design; Static application security testing, Dynamic application security testing, Security code review and Penetration testing examine what was built. The threats it finds feed later design, development, testing and post-deployment decisions.1

Tools

OWASP Threat Dragon is a free, open-source application under the Apache 2.0 licence, started by Mike Goodwin in October 2015. It draws threat model diagrams, records threats and mitigations for each element, supports STRIDE, LINDDUN and CIA among other schemes, and has a rule engine that proposes threats. It runs as a desktop application or a self-hosted web application.9

Limits

Many developers lack the security knowledge to apply the methods, and the work competes with delivery deadlines. Models stay incomplete when development and security teams do not talk.2 The manifesto warns against relying on one "hero" threat modeller, analysing a problem without reaching a fix, attending too closely to adversaries, assets or techniques, and searching for one perfect representation when several views show different problems.1

See also

References

  1. a b c d Threat Modeling Manifesto working group. "Threat Modeling Manifesto". threatmodelingmanifesto.org.
  2. a b c d e f g h i j OWASP Foundation. "Threat Modeling Cheat Sheet". OWASP Cheat Sheet Series.
  3. back Shostack + Associates. "Threat Modeling". shostack.org.
  4. back "CWE-501: Trust Boundary Violation". Common Weakness Enumeration. MITRE.
  5. a b OWASP community. "Threat Modeling Process". owasp.org.
  6. back Microsoft (25 August 2022). "Microsoft Threat Modeling Tool threats". Microsoft Learn.
  7. back Schneier, Bruce (December 1999). "Attack Trees". Dr. Dobb's Journal.
  8. a b "A06:2025 Insecure Design". OWASP Top 10:2025. OWASP Foundation.
  9. back OWASP Foundation. "OWASP Threat Dragon". owasp.org.