Notes
Four questions
Adam Shostack reduced threat modeling to four questions, and they are all you really need to remember. What are we building? Draw it. What can go wrong? Apply STRIDE to the drawing. What are we going to do about it? Choose mitigations. And did we do a good job? Review. Everything else, the diagrams, the categories, the tools, is detail in service of those four questions. A team that asks them honestly for an hour has done real threat modeling.
- 1. What are we building? (draw the system)
- 2. What can go wrong? (STRIDE against the diagram)
- 3. What are we going to do about it? (mitigations)
- 4. Did we do a good job? (review it)
- everything else is detail
Draw it
To answer what can go wrong, you first draw what you are building, as a data flow diagram. It has four kinds of element: external entities like users, processes like your services, data stores like databases, and the data flows between them. The crucial addition is trust boundaries: lines where data crosses from less trusted to more trusted, such as the internet reaching your server, or your app reaching the database. Threats cluster on those boundaries, so that is where you look hardest.
- elements: external entities, processes, data stores, data flows
- trust boundaries: lines where data crosses from less to more trusted (internet to server, app to database)
- threats concentrate on the boundaries
- keep it to one page, at the right level of detail
S: Spoofing
STRIDE is six categories, each the opposite of a security property. S is spoofing: pretending to be someone or something you are not, which attacks authentication. An attacker uses a stolen session or a forged token to act as another user, or a fake service impersonates a real one. The mitigations are the authentication tools from later episodes: strong login, multi-factor, mutual TLS between services, and tokens that are signed and properly verified. Every arrow crossing into trust is a spoofing question.
- threat: an attacker claims to be another user, or a fake service claims to be yours
- examples: stolen session, forged token, phishing, a spoofed API caller
- mitigate: strong authn, MFA, mutual TLS between services, signed and verified tokens
T: Tampering
T is tampering: changing data or code without permission, which attacks integrity. An attacker edits a price in a request the client controls, modifies a token, alters a stored file, or poisons a dependency in the build. The mitigations are TLS for data in transit, input validation and server-side authorization on every write so the client cannot be trusted, integrity checks and HMACs, and signed build artifacts. Never trust that data arrived unchanged just because you sent it a certain way.
- threat: data changed in transit, in storage, or in a request the user controls
- examples: edit a price in a request, modify a JWT, alter a file, poison a dependency
- mitigate: TLS, input validation, integrity checks, signed artifacts, authz on every write
R: Repudiation
R is repudiation: being able to deny you did something because nothing reliably recorded it, which attacks accountability. There is no audit log, the logs can be edited, or everyone shares one admin account so you cannot tell who acted. The mitigations are tamper-evident audit logs, individual identities rather than shared accounts, synchronised time, and signed log entries. It is easy to forget, because it is not about stopping an action but about proving who took it.
- threat: a user or attacker performs an action and there is no reliable record
- examples: no audit log, logs that can be edited, shared accounts so you cannot tell who acted
- mitigate: tamper-evident audit logs, per-user identity, time sync, signed log entries
I: Disclosure
I is information disclosure: exposing data to someone who should not see it, which attacks confidentiality. Verbose error messages leak internals, one user reads another's records through a changed identifier, secrets end up in logs, a storage bucket is left open, or an API returns far more fields than the screen needs. The mitigations are access control, encryption, returning the minimum data, and careful handling of errors and logs. This is one of the most common categories you will find in real reviews.
- threat: data exposed to an unauthorised party
- examples: verbose errors, one user reading another's records, secrets in logs, an open bucket, too much in an API response
- mitigate: access control, encryption, minimal responses, careful errors and logging
D: Denial of service
D is denial of service: making the system unavailable or too slow, which attacks availability. A flood of requests, a single very expensive query, a huge upload, or an algorithm that becomes slow on crafted input, like the regular-expression denial of service we measured in Part three. The mitigations are rate limiting, quotas, timeouts, input size limits, autoscaling, and upstream protection such as a content delivery network. Availability is a security property too, not only an operations concern.
- threat: the system is made unavailable or too slow
- examples: flood of requests, one expensive query, a huge upload, an algorithm that is slow on bad input (ReDoS)
- mitigate: rate limiting, quotas, timeouts, input size limits, autoscaling, a CDN or DoS protection
E: Elevation
E is elevation of privilege: gaining rights you were never meant to have, which attacks authorization. A normal user reaches an administrator function because the check was only in the user interface, an injection flaw runs code on the server, or a container escapes to the host. The mitigations are least privilege everywhere, server-side authorization checks on every action rather than hiding buttons, patching, and strong isolation. This is often the final step that turns a small foothold into a full compromise.
- threat: a user gains higher privileges than intended
- examples: a normal user reaching admin functions, a container breakout, an injection that runs code, a missing server-side authz check
- mitigate: least privilege, server-side authz on every action, patching, isolation
Make it a habit
The failure mode of threat modeling is turning it into a heavy document nobody repeats. Keep it light. Model new features and significant changes, not every small ticket. One page, one hour, with the people who actually know the system in the room. Use a tool if it helps, such as OWASP Threat Dragon, or just a whiteboard. The output is a short list of threats and the mitigations you chose, tracked like any other work, and revisited when the design changes. Light and regular beats thorough and never.
- model new features and major changes, not every ticket
- one page, one hour, the people who know the system
- tools: OWASP Threat Dragon, pytm, or just a whiteboard
- output: a short list of threats and chosen mitigations, tracked
- revisit when the design changes
Common mistakes
Mistakes. A diagram with no trust boundaries, which hides exactly where threats live. Skipping the less obvious categories, especially repudiation and denial of service. The security team modeling alone without the people who built the system, who know where the real weak points are. Finding threats and never tracking or fixing them. Modeling once at the start and never again. And chasing completeness so hard that the exercise never finishes and so never ships value.
- a diagram with no trust boundaries
- skipping repudiation and DoS
- security team models alone, without the builders
- threats found but never tracked or fixed
- modeling once, never again
- aiming for completeness and so never finishing
Say it like this
In the interview: I use the four questions, what are we building, what can go wrong, what are we going to do, and did we do a good job. I draw a data flow diagram with trust boundaries, then apply STRIDE, spoofing, tampering, repudiation, information disclosure, denial of service and elevation of privilege, at each boundary. For each real threat I pick a mitigation and track it like any other work. I keep sessions to about an hour with the engineers who know the system, and I revisit when the design changes.
- "Four questions: what are we
- building, what can go wrong, what do we do, did we do
- well. I draw a data flow
- diagram with trust
- boundaries, apply STRIDE at each boundary, pick
- mitigations per threat, and track them. I keep it to an hour and repeat on changes."