04.6.3 · Skill in Security and privacy engineering

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.

Your status · Threat modeling

Saved in this browser. Sign in to keep it on every device.It colours this skill's tile on your map.

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

  1. 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.
  2. Ask what can go wrong at each crossing. STRIDE is a useful checklist: spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege.
  3. Think about misuse by real users too, not only attackers.
  4. Decide what you will do about each threat: fix, reduce, accept or transfer it.
  5. Turn the decisions into tasks and tests, with an owner.
  6. 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)

Loop

The four questions of a threat model

1234Threat modelEach time the design changes
  1. 1What are we working on?A diagram of the parts and data flows.
  2. 2What can go wrong?STRIDE at each trust boundary.
  3. 3What will we do about it?Fix, reduce, accept or transfer.
  4. 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

Sources: Threat modeling cheat sheet (OWASP) ↗

Resources

1

Tools

1
Tools for Security and privacy engineering
  • ToolFreemium
    Semgrep

    Static analysis for security bugs and code patterns, with an open-source core engine.