BlogSecurity

Threat Modeling for Developers: A Practical Framework

Threat modeling is the practice of identifying potential security threats to a system before writing code — so you can design defenses into the architecture rather than bolting them on later. Most developers skip it because traditional threat modeling feels academic and slow. This guide makes it practical, lightweight, and actionable.

16 min readUpdated June 2026

Why Developers Should Threat Model

A vulnerability found during design costs 10x less to fix than one found in code review, and 100x less than one found in production. Threat modeling is the most cost-effective security activity you can do — because you are making architectural decisions that prevent entire categories of vulnerabilities rather than finding individual bugs.

Prevent, Not Detect

Design security into the architecture instead of scanning for bugs afterward. Prevents entire vulnerability categories.

Shared Understanding

The team discusses security together, building a shared mental model of threats and trust boundaries.

Prioritized Defense

Focus engineering effort on the highest-risk areas rather than applying security uniformly everywhere.

The STRIDE Framework

STRIDE is a mnemonic for six categories of security threats. For each component in your system, ask: “Can an attacker do any of these six things?”

S

Spoofing

Pretending to be someone or something else.

Example: Forging authentication tokens, email spoofing, IP spoofing
Mitigate: Strong authentication, mTLS, signed tokens
T

Tampering

Modifying data or code without authorization.

Example: SQL injection, man-in-the-middle attacks, modifying config files
Mitigate: Input validation, integrity checks, TLS, code signing
R

Repudiation

Denying having performed an action.

Example: Deleting audit logs, performing transactions without logging
Mitigate: Audit logging, non-repudiation, tamper-evident logs
I

Info Disclosure

Exposing information to unauthorized users.

Example: Leaking PII in error messages, exposed API keys, verbose logging
Mitigate: Encryption, access controls, data classification, redaction
D

Denial of Service

Making a service unavailable.

Example: Resource exhaustion, algorithmic complexity attacks, DDoS
Mitigate: Rate limiting, resource quotas, CDN, auto-scaling
E

Elevation of Privilege

Gaining higher access than authorized.

Example: IDOR, BOLA, container escape, kernel exploits
Mitigate: Least privilege, RBAC, input validation, sandboxing

The 4-Step Threat Modeling Process

1

Diagram the System

Draw a data flow diagram showing components, data stores, external entities, and trust boundaries. You cannot threat model what you cannot see. Keep it simple — boxes, arrows, and boundary lines.

2

Identify Threats

Walk through each component and data flow. Apply STRIDE to each one: Can this be spoofed? Can data here be tampered with? Is there adequate logging? Can information leak? Can this be DoS'd? Can privileges be escalated?

3

Rate Risks

Use a simple risk rating: likelihood × impact. High likelihood + high impact = address now. Low likelihood + low impact = accept the risk. Focus on the top 5–10 threats that represent real danger.

4

Plan Mitigations

For each high-priority threat, define a concrete mitigation. Assign it to a sprint. Mitigations should be specific engineering tasks: 'add rate limiting to /api/login' not 'improve security'.

Lightweight Threat Modeling for Agile Teams

Full threat modeling sessions can take hours. For agile teams, here is a lightweight approach that fits into sprint planning:

Add a 15-minute 'security check' to sprint planning for any feature that touches authentication, authorization, data storage, or external APIs
Use a simple template: 'What are we building? What data does it handle? What could go wrong? What are we doing about it?'
Focus on new features and architecture changes — do not re-model stable systems every sprint
Document threats as tickets in your backlog, not in separate security documents nobody reads
Use automated scanning (SAST, DAST, CSPM) to catch the vulnerabilities that threat modeling misses
Run a full threat model annually or when major architectural changes occur

A Worked Example: Threat Modeling a File Upload Feature

Abstract frameworks click when you see them applied, so let us threat model a feature almost every team ships eventually: user file uploads. The design is simple — a React frontend posts a file to an API endpoint, the API stores it in an S3 bucket, and a background worker generates thumbnails. Three components, two trust boundaries (browser-to-API and API-to-worker), one data store.

Walking STRIDE across each element surfaces concrete threats in minutes:

  • Spoofing: can an unauthenticated user hit the upload endpoint directly with curl? Mitigation: enforce the same auth middleware on the API route, never rely on the frontend hiding the button.
  • Tampering: the file name and content type come from the client and cannot be trusted. A “photo.jpg” may be a PHP web shell or an SVG with embedded JavaScript. Mitigation: validate magic bytes server-side, re-encode images, generate your own object keys.
  • Repudiation: if a user uploads illegal content, can you prove who did it and when? Mitigation: log user ID, IP, timestamp, and content hash on every upload.
  • Information disclosure: are object URLs guessable or is the bucket public? Mitigation: private bucket, randomized keys, short-lived presigned URLs.
  • Denial of service: a 10 GB upload or a decompression bomb can exhaust the worker. Mitigation: size limits at the load balancer, streaming parsing, resource limits on the thumbnail process.
  • Elevation of privilege: image processing libraries like ImageMagick have a history of RCE bugs (ImageTragick, CVE-2016-3714). Mitigation: run the worker in a sandboxed, non-root container with no cloud credentials beyond the one bucket it needs.

That is a genuinely useful threat model — six threats, six backlog-ready mitigations — produced in a 20-minute conversation. No specialized tooling, no security team required.

Beyond STRIDE: Other Methodologies Worth Knowing

STRIDE is the best starting point for developers, but it is not the only game in town, and knowing the alternatives helps you pick the right tool for the situation:

  • PASTA (Process for Attack Simulation and Threat Analysis) is a seven-stage, risk-centric methodology that ties threats to business impact. It is heavyweight, but valuable for flagship systems where you need to justify security spend to executives.
  • Attack trees start from an attacker goal (“exfiltrate the customer database”) and decompose it into the paths that achieve it. Excellent for reasoning about one high-value asset in depth.
  • LINDDUN does for privacy what STRIDE does for security — linking, identifying, non-repudiation, detecting, data disclosure, unawareness, and non-compliance. Essential when GDPR or HIPAA data is in scope.
  • MITRE ATT&CK is not a threat modeling method per se, but its catalog of real-world attacker techniques is a great reality check: for each identified threat, ask which ATT&CK techniques an adversary would actually use, and whether you could detect them.
  • Elevation of Privilege card game — Adam Shostack's card deck (free from Microsoft) turns STRIDE into a game, and is genuinely the easiest way to run a first session with a skeptical team.

Whatever methodology you choose, the Threat Modeling Manifesto distills the practice into four questions that never change: What are we working on? What can go wrong? What are we going to do about it? Did we do a good enough job? If your process answers those four questions, the framework label matters very little.

Threat Modeling Tools: From Whiteboard to Automation

The honest answer is that a whiteboard and a curious team beat any tool. But tooling helps with consistency, documentation, and scale once you run threat modeling across dozens of services:

  • OWASP Threat Dragon — free, open source, web-based diagramming with built-in STRIDE threat suggestions per element. The best zero-cost starting point.
  • Microsoft Threat Modeling Tool — mature and free, with template-driven threat generation; Windows-only and showing its age, but still widely used in enterprises.
  • pytm — threat modeling as code: define your system in Python, generate diagrams and threat reports in CI. Ideal for teams that want models to live in the repository and evolve with the architecture.
  • IriusRisk and SD Elements — commercial platforms that generate threat models and countermeasure requirements from questionnaires and architecture imports, useful at enterprise scale where hundreds of applications need consistent coverage.

Tools cannot replace judgment: they will happily generate 200 boilerplate threats for a three-box diagram. Treat generated output as a checklist to prune, and keep the human conversation — the part where someone says “wait, what happens if the webhook secret leaks?” — at the center of the exercise.

Closing the Loop: Verifying Mitigations Actually Ship

The most common failure mode in threat modeling is not bad analysis — it is orphaned mitigations. The team identifies ten threats, files ten tickets, and six of them quietly die in the backlog. A threat model that never gets verified is security theater with better diagrams.

  • Tag mitigation tickets with a label like threat-model and review open ones in every sprint retro — unresolved high-risk items should block the feature's GA, not ship alongside it.
  • Turn mitigations into tests: if the model says “rate limit the login endpoint,” write an integration test that asserts a 429 after N attempts. Mitigations encoded as tests cannot silently regress.
  • Map threats to automated scanners: tampering threats map to SAST injection rules, information disclosure maps to secrets scanning and CSPM public-exposure checks, and elevation of privilege maps to IaC checks for privileged containers and over-broad IAM.
  • Verify at runtime: design-time assumptions drift. If the model assumes the thumbnail worker never makes outbound network calls, eBPF-based runtime monitoring — the kind TigerGate's agent provides — can enforce that assumption and alert the moment reality diverges from the diagram.
  • Revisit on change, not on calendar: re-open the model when a trust boundary moves — a new third-party integration, a service exposed to the internet, a new class of data stored — rather than on an arbitrary annual schedule alone.

Done this way, threat modeling stops being a document and becomes a feedback loop: design predicts the threats, tests and scanners verify the defenses, and runtime telemetry confirms the system still behaves the way the model assumed.

Validate Your Threat Model with TigerGate

Threat modeling identifies risks at design time. TigerGate validates those controls are actually working — SAST catches implementation bugs, CSPM catches cloud misconfigurations, and eBPF catches runtime threats.