Skip to content
Pwnversity
DSO-THREATMODELintermediate · 6 min · upd. 2026-10

Threat modeling in design

Threat modeling in AppSec analyzes a feature or application at the design stage to find flaws before writing code. It’s the highest-return practice of the Secure SDLC: fixing a design flaw on a diagram takes minutes; in production, an incident. (For the general theory see Threat modeling.)

Automated tools (SAST, DAST, SCA) find implementation flaws: an eval, a concatenated query, a vulnerable dependency. They don’t find design flaws: a feature that trusts a client parameter to set the price, a password-recovery flow that doesn’t validate email ownership, a microservice that assumes the caller already authenticated. Threat modeling is the only practice that catches them systematically.

Adam Shostack sums up the whole exercise in four questions. They’re the skeleton of any session:

  1. What are we building? — Architecture diagram, data flows, trust boundaries.
  2. What can go wrong? — Enumerate threats (this is where STRIDE comes in).
  3. What are we going to do about it? — Mitigations per threat.
  4. Did we do a good job? — Validate that mitigations cover the threats, and repeat when the design changes.

The central artifact is the DFD: processes, data stores, external entities, and above all the trust boundaries the data crosses. Every boundary crossing is where you must validate, authenticate, or authorize.

flowchart LR
    U[User] -->|HTTPS| FE["Frontend (SPA)"]
    FE -->|REST API| API["API / Backend"]
    API --> DB[(Database)]
    API -->|queue| W["Async worker"]
    API -->|token| EXT["External payment service"]
    subgraph TB1["Boundary: Internet ↔ DMZ"]
        FE
    end
    subgraph TB2["Boundary: DMZ ↔ internal network"]
        API
        DB
        W
    end

The value is in drawing it with the team: almost always a flow appears that nobody had made explicit (the worker reading straight from the DB, the unauthenticated admin route).

STRIDE is Microsoft’s threat-enumeration method. For each DFD element, you walk six categories; each is the violation of a security property:

Threat Property violated Example
Spoofing Authentication Impersonate another user or service
Tampering Integrity Modify data in transit or at rest
Repudiation Non-repudiation Deny an action with no trace
Information disclosure Confidentiality Leak PII or secrets
Denial of service Availability Exhaust resources
Elevation of privilege Authorization Go from user to admin

Applied to each DFD boundary crossing, STRIDE forces you to think of threats you’d otherwise miss. Alternatives: LINDDUN (privacy-focused) and PASTA (business-risk-centric).

Not all threats are treated the same. They’re prioritized by impact × likelihood. Methods:

  • DREAD (Damage, Reproducibility, Exploitability, Affected users, Discoverability): classic but subjective.
  • CVSS: useful when the threat is already a concrete vulnerability.
  • Simple risk matrix (high/medium/low on two axes): often enough, and more honest than a falsely precise number.

For each prioritized threat you decide: mitigate (add a control), eliminate (remove the feature), transfer (insurance, third party), or accept (documented and signed off by the risk owner).

Threat modeling is also an offensive tool: the attacker builds their own mental model of the target.

  • Map trust boundaries: the attacker looks for where a system trusts an input they can control (a header, a JWT with unverified signature, an X-Forwarded-For).
  • Forgotten flows: admin routes, exposed internal endpoints, unauthenticated queues. What wasn’t drawn in the DFD is usually what wasn’t protected.
  • Implicit assumptions: “only the frontend calls this service” is exactly the kind of assumption an attacker breaks by hitting the service directly.
  • Abuse cases: for every legitimate use case, the attacker writes the matching abuse case.
  • Do it early and cheap: a whiteboard and 60 minutes with the design team beat an expensive tool at the end.
  • Version the model: keep the DFD and threat list in the repo (threat modeling as code with tools like pytm or Threagile). That way it’s reviewed on every architecture change.
  • Connect to controls: every mitigation should trace to an ASVS requirement or a test.
  • Don’t turn it into bureaucracy: the goal is to find flaws, not fill in a template. A one-page model that gets used beats a forty-page one nobody reads.
  • DFD of the feature with explicit trust boundaries.
  • STRIDE applied to each element and boundary crossing.
  • Threats prioritized by impact × likelihood.
  • Documented decision per threat (mitigate / eliminate / transfer / accept).
  • Mitigations traced to requirements (ASVS) or tests.
  • Model versioned in the repo.
  • Model reviewed when the architecture changes.
  • Abuse cases written alongside use cases.