Threat Modelling (STRIDE)
Finding design flaws before writing code
Threat modelling is a structured way to ask "what could go wrong?" while a feature is still being designed, when fixes are cheapest. You draw how data flows, mark where trust changes, walk each flow through the STRIDE categories, and turn the answers into concrete requirements and tests. STRIDE is the most widely used method; PASTA (risk-centric), LINDDUN (privacy) and attack trees (attack paths) are covered in their own modules.
Beginner · 5 steps
| Four questions | What are we building? What can go wrong? What will we do? Did we do a good job? |
|---|---|
| Model | Data flow diagram + trust boundaries |
| Threat categories | STRIDE |
| Other methods | PASTA, LINDDUN, attack trees, OCTAVE, VAST, Trike |
| Free tools | OWASP Threat Dragon, Microsoft TM Tool |
| Relates to | OWASP A04 Insecure Design |
Step by step
What are we building? Draw the data flows
The team is designing checkout for a food-delivery app. In a short session they draw who talks to whom: the customer's phone calls the API gateway, which calls the orders service, which stores orders and talks to an external payment provider. They mark trust boundaries wherever data crosses from one level of trust to another.
Spoofing and Tampering S and T of STRIDE
Walking the customer → gateway flow: could someone pretend to be another customer (Spoofing)? Could they change data in transit or in the request, such as the price (Tampering)? Both are realistic, because the phone is fully under the user's control.
Repudiation and Information disclosure R and I of STRIDE
Could a customer or staff member deny doing something, with no way to prove it (Repudiation)? Could data leak to someone who shouldn't see it (Information disclosure)? The team realises refunds aren't logged and that card numbers would sit in the orders database.
Denial of service and Elevation of privilege D and E of STRIDE
Could someone make the service unavailable (Denial of service), for example by flooding it with fake orders? Could a normal customer reach a function meant for staff (Elevation of privilege), like the refund endpoint?
What will we do? Did we do a good job? From threats to tickets and tests
Each threat gets a decision: mitigate, accept, transfer or avoid. Mitigations become requirements in the backlog, many of them taken straight from OWASP ASVS, and each gets a test. Before release the team checks the mitigations actually shipped and updates the model.
Best practices
- Model each new feature or big change during design, not after release
- Keep the diagram simple: processes, data stores, external entities, flows and trust boundaries
- Focus on flows that cross a trust boundary; that's where most threats live
- Turn every accepted threat into a requirement, a ticket and a test
- Revisit the model when the design changes, and check that the mitigations shipped
More in Secure Development.
Packets
| No. | Time | Source | Destination | Protocol | Info | Size |
|---|