Threat modeling
Thinking through how a system could be attacked before building it.
Threat modeling asks what we are building, what can go wrong, and what we will do about it. A short session during design catches problems that are expensive to fix later. It scales from a whiteboard sketch to a formal review.
Why it matters for a product engineer
Security problems found in design cost minutes; found in production they cost incidents, trust and weekends. Threat modeling is a short, structured conversation about how a feature could be attacked or misused. A product engineer is often the one who knows the data flows well enough to lead it.
How to do it
- Draw what you are building: the parts, the data, who talks to whom, and where trust changes, such as between the browser and the server.
- Ask what can go wrong at each crossing. STRIDE is a useful checklist: spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege.
- Think about misuse by real users too, not only attackers.
- Decide what you will do about each threat: fix, reduce, accept or transfer it.
- Turn the decisions into tasks and tests, with an owner.
- Ask whether you did a good enough job, and repeat when the design changes.
Common mistakes
- Doing it once, at the end, as a document for an audit.
- A long list of threats with no decisions.
- Only thinking about outside attackers, not about users, partners or insiders.
- Missing the data flows to third parties, such as analytics or AI providers.
Example
Papermark’s buyers share documents they cannot afford to leak. Its protections read like the answers to a threat model. A forwarded link: email verification. A copied page: screenshot protection. A leak with no trace: dynamic watermarks with the viewer’s details. Someone reading without a legal duty: an NDA before access. A stolen session that takes everything: one-time codes for bulk downloads. (Papermark in In practice)
The four questions of a threat model
- 1What are we working on?A diagram of the parts and data flows.
- 2What can go wrong?STRIDE at each trust boundary.
- 3What will we do about it?Fix, reduce, accept or transfer.
- 4Did we do a good enough job?Check, then go round again.
The questions are simple on purpose, so a team can ask them in a design review, not only in an audit.
The Threat Modeling Manifesto, as summarised by OWASP
Resources
1- docsStart here
Threat modeling cheat sheet ↗
OWASP · 13 minA lightweight way to ask what could go wrong with a design, using the STRIDE categories.
Tools
1- ToolFreemium
Semgrep
Static analysis for security bugs and code patterns, with an open-source core engine.