Threat Modeling
Intro
A threat model is a structured analysis of how a system could be
attacked. STRIDE walks each component and data flow through six
threat categories, producing a prioritized list of risks and
mitigations.
Overview
STRIDE categories
| Category |
Threat |
Property violated |
| Spoofing |
Pretending to be someone else |
Authentication |
| Tampering |
Modifying data or code |
Integrity |
| Repudiation |
Denying an action occurred |
Non-repudiation |
| Information Disclosure |
Exposing data |
Confidentiality |
| Denial of Service |
Making the system unavailable |
Availability |
| Elevation of Privilege |
Gaining unauthorized access |
Authorization |
Step 1 — Draw a data flow diagram
Map processes, data stores, data flows, and external entities. Mark
trust boundaries where data crosses between trust levels.
Trust Boundary
+---------------------------------+
[User Browser] ---|---> [Web Server] ---> [App Server] ---> [Database]
| | |
| v v
| [Static Files] [Cache (Redis)]
+---------------------------------+
|
v
[External Auth Provider]
- Processes — web server, app server, background workers.
- Data stores — database, cache, file system, message queue.
- Data flows — HTTP requests, database queries, API calls.
- External entities — users, third-party services, admins.
- Trust boundaries — network segments, process boundaries,
privilege levels.
Step 2 — Identify trust boundaries
Each crossing is a potential attack point:
- Internet to DMZ.
- DMZ to internal network.
- Application to database.
- Service to service in a microservice mesh.
- Regular user vs admin privilege levels.
Step 3 — Apply STRIDE to each element
For every process, data store, and data flow, ask:
- Spoofing — can an attacker impersonate a legitimate entity?
- Tampering — can data be modified in transit or at rest?
- Repudiation — can a user deny performing an action?
- Information disclosure — can sensitive data leak?
- Denial of service — can this component be overwhelmed?
- Elevation of privilege — can a user gain higher privileges?
Step 4 — Risk assessment
Rate each threat by likelihood and impact:
| Rating |
Likelihood |
Impact |
| High |
Exploitable with public tools |
Data breach, full compromise |
| Medium |
Requires some skill or access |
Partial data exposure, downtime |
| Low |
Requires insider access or luck |
Minor data exposure, degradation |
Risk = Likelihood × Impact
| Likelihood \ Impact |
High |
Medium |
Low |
| High |
Critical |
High |
Medium |
| Medium |
High |
Medium |
Low |
| Low |
Medium |
Low |
Low |
Step 5 — Mitigations
Map each STRIDE category to common mitigations:
| STRIDE category |
Common mitigations |
| Spoofing |
MFA, certificate pinning, mutual TLS |
| Tampering |
Digital signatures, checksums, immutable logs |
| Repudiation |
Audit logging, tamper-evident logs, signatures |
| Information Disclosure |
Encryption (TLS, AES), access controls, masking |
| Denial of Service |
Rate limiting, autoscaling, CDN, circuit breakers |
| Elevation of Privilege |
Least privilege, input validation, sandboxing |
Gotchas
Agent-specific failure modes — provider-neutral pause-and-self-check items:
- Skipping the data flow diagram and jumping straight to a threat list. Without a data flow diagram with trust boundaries, threats are enumerated without knowing where data crosses between trust levels — the points where attackers actually operate. The DFD is not optional; it determines which threats are relevant to which components.
- Threat modeling once at design time and never revisiting. A system that has grown to include new external integrations, new microservices, or new data flows has a different attack surface than it did at initial design. A threat model that is not updated when the architecture changes is a threat model of a system that no longer exists.
- Treating "low likelihood" as "permanently ignore." A threat rated low likelihood because it requires insider access or sophisticated skill is not safe to dismiss forever. Circumstances change: attackers gain new capabilities, insiders become disgruntled, and "low likelihood" events happen. Re-rate risks annually or when the environment changes.
- Mitigations with no owner or ticket. A threat model that lists 15 mitigations in a document with no associated tasks means zero of them will be implemented. Every mitigation must be tracked to a ticket or commit with an owner. A mitigation that is only in the threat model document has not been mitigated.
- Modeling the intended architecture, not the production system. The diagram shows a load balancer in front of the API, but production has a debug port open directly to the application server. The threat model of the intended architecture misses the actual attack surface. Threat model what is deployed, not what was planned.
- Confusing authentication threats with authorization threats. Spoofing (STRIDE-S) is about impersonating an identity — a weak login mechanism. Elevation of privilege (STRIDE-E) is about gaining capabilities beyond what the identity is authorized for — a broken access control check. Fixing authentication does not fix authorization. Apply both categories separately to each component.
- Stopping at the application boundary and ignoring CI/CD and cloud infrastructure. The CI/CD pipeline, container registry, cloud console, and IAM configuration are part of the attack surface — a compromised build pipeline can inject code into every deployment. Include infrastructure, supply chain, and human entry points in the attack surface mapping.
Full reference
Attack surface mapping
Enumerate every entry point an attacker could use:
- Network — open ports, exposed services, public endpoints.
- Application — API endpoints, file upload, search, user input
fields.
- Authentication — login, password reset, session management.
- Data — database access, file storage, backups, logs.
- Infrastructure — cloud console, CI/CD pipeline, container
registry.
- Human — phishing targets, social engineering, insider threats.
Output format
Structure the threat model as a single document:
## Threat Model: [System Name]
### System Description
Brief description of the system and its purpose.
### Data Flow Diagram
ASCII diagram showing components and trust boundaries.
### Assets
List of valuable data and resources to protect.
### Threats
| ID | STRIDE | Component | Threat | Risk | Mitigation |
|----|--------|-----------|--------|------|------------|
| T1 | S | Login API | Credential stuffing | High | Rate limiting, MFA |
| T2 | I | Database | SQL injection leaks PII | Critical | Parameterized queries |
### Recommendations
Prioritized list of security improvements.
When to threat model
- During initial design of any system handling sensitive data.
- Before adding a new external integration or trust boundary.
- After an incident, to find adjacent risks.
- On a periodic schedule for high-value systems (annually or per
major release).
Anti-patterns
- Threat modeling once at design time and never revisiting.
- Skipping the data flow diagram and going straight to a threat list.
- Treating "low likelihood" as "ignore forever".
- Producing a document nobody reads. The output should drive a
prioritized punch list of work, not sit in a wiki.
- Modeling abstract systems instead of the actual architecture in
production.
Tips for sharper models
- Walk the diagram with someone who didn't build the system; gaps
surface fast.
- Track every mitigation back to a ticket or commit. A mitigation
with no owner is a mitigation that won't happen.
- Re-rate risks after mitigations land — residual risk is what
matters for prioritization.
1---2name: threat-modeling3description: Threat modeling with STRIDE — data flow diagrams, trust boundaries, risk. Use when designing a new system, reviewing architecture for security, conducting a security review, or prioritizing security work by risk.4---56# Threat Modeling78## Intro910A threat model is a structured analysis of how a system could be11attacked. STRIDE walks each component and data flow through six12threat categories, producing a prioritized list of risks and13mitigations.1415## Overview1617### STRIDE categories1819| Category | Threat | Property violated |20|----------------------------|-------------------------------|-------------------|21| **S**poofing | Pretending to be someone else | Authentication |22| **T**ampering | Modifying data or code | Integrity |23| **R**epudiation | Denying an action occurred | Non-repudiation |24| **I**nformation Disclosure | Exposing data | Confidentiality |25| **D**enial of Service | Making the system unavailable | Availability |26| **E**levation of Privilege | Gaining unauthorized access | Authorization |2728### Step 1 — Draw a data flow diagram2930Map processes, data stores, data flows, and external entities. Mark31trust boundaries where data crosses between trust levels.3233```34 Trust Boundary35 +---------------------------------+36 [User Browser] ---|---> [Web Server] ---> [App Server] ---> [Database]37 | | |38 | v v39 | [Static Files] [Cache (Redis)]40 +---------------------------------+41 |42 v43 [External Auth Provider]44```4546- **Processes** — web server, app server, background workers.47- **Data stores** — database, cache, file system, message queue.48- **Data flows** — HTTP requests, database queries, API calls.49- **External entities** — users, third-party services, admins.50- **Trust boundaries** — network segments, process boundaries,51 privilege levels.5253### Step 2 — Identify trust boundaries5455Each crossing is a potential attack point:5657- Internet to DMZ.58- DMZ to internal network.59- Application to database.60- Service to service in a microservice mesh.61- Regular user vs admin privilege levels.6263### Step 3 — Apply STRIDE to each element6465For every process, data store, and data flow, ask:6667- **Spoofing** — can an attacker impersonate a legitimate entity?68- **Tampering** — can data be modified in transit or at rest?69- **Repudiation** — can a user deny performing an action?70- **Information disclosure** — can sensitive data leak?71- **Denial of service** — can this component be overwhelmed?72- **Elevation of privilege** — can a user gain higher privileges?7374### Step 4 — Risk assessment7576Rate each threat by likelihood and impact:7778| Rating | Likelihood | Impact |79|--------|---------------------------------|----------------------------------|80| High | Exploitable with public tools | Data breach, full compromise |81| Medium | Requires some skill or access | Partial data exposure, downtime |82| Low | Requires insider access or luck | Minor data exposure, degradation |8384**Risk = Likelihood × Impact**8586| Likelihood \ Impact | High | Medium | Low |87|---------------------|----------|--------|--------|88| High | Critical | High | Medium |89| Medium | High | Medium | Low |90| Low | Medium | Low | Low |9192### Step 5 — Mitigations9394Map each STRIDE category to common mitigations:9596| STRIDE category | Common mitigations |97|------------------------|---------------------------------------------------|98| Spoofing | MFA, certificate pinning, mutual TLS |99| Tampering | Digital signatures, checksums, immutable logs |100| Repudiation | Audit logging, tamper-evident logs, signatures |101| Information Disclosure | Encryption (TLS, AES), access controls, masking |102| Denial of Service | Rate limiting, autoscaling, CDN, circuit breakers |103| Elevation of Privilege | Least privilege, input validation, sandboxing |104105## Gotchas106107Agent-specific failure modes — provider-neutral pause-and-self-check items:108109- **Skipping the data flow diagram and jumping straight to a threat list.** Without a data flow diagram with trust boundaries, threats are enumerated without knowing where data crosses between trust levels — the points where attackers actually operate. The DFD is not optional; it determines which threats are relevant to which components.110- **Threat modeling once at design time and never revisiting.** A system that has grown to include new external integrations, new microservices, or new data flows has a different attack surface than it did at initial design. A threat model that is not updated when the architecture changes is a threat model of a system that no longer exists.111- **Treating "low likelihood" as "permanently ignore."** A threat rated low likelihood because it requires insider access or sophisticated skill is not safe to dismiss forever. Circumstances change: attackers gain new capabilities, insiders become disgruntled, and "low likelihood" events happen. Re-rate risks annually or when the environment changes.112- **Mitigations with no owner or ticket.** A threat model that lists 15 mitigations in a document with no associated tasks means zero of them will be implemented. Every mitigation must be tracked to a ticket or commit with an owner. A mitigation that is only in the threat model document has not been mitigated.113- **Modeling the intended architecture, not the production system.** The diagram shows a load balancer in front of the API, but production has a debug port open directly to the application server. The threat model of the intended architecture misses the actual attack surface. Threat model what is deployed, not what was planned.114- **Confusing authentication threats with authorization threats.** Spoofing (STRIDE-S) is about impersonating an identity — a weak login mechanism. Elevation of privilege (STRIDE-E) is about gaining capabilities beyond what the identity is authorized for — a broken access control check. Fixing authentication does not fix authorization. Apply both categories separately to each component.115- **Stopping at the application boundary and ignoring CI/CD and cloud infrastructure.** The CI/CD pipeline, container registry, cloud console, and IAM configuration are part of the attack surface — a compromised build pipeline can inject code into every deployment. Include infrastructure, supply chain, and human entry points in the attack surface mapping.116117## Full reference118119### Attack surface mapping120121Enumerate every entry point an attacker could use:122123- **Network** — open ports, exposed services, public endpoints.124- **Application** — API endpoints, file upload, search, user input125 fields.126- **Authentication** — login, password reset, session management.127- **Data** — database access, file storage, backups, logs.128- **Infrastructure** — cloud console, CI/CD pipeline, container129 registry.130- **Human** — phishing targets, social engineering, insider threats.131132### Output format133134Structure the threat model as a single document:135136```137## Threat Model: [System Name]138139### System Description140Brief description of the system and its purpose.141142### Data Flow Diagram143ASCII diagram showing components and trust boundaries.144145### Assets146List of valuable data and resources to protect.147148### Threats149| ID | STRIDE | Component | Threat | Risk | Mitigation |150|----|--------|-----------|--------|------|------------|151| T1 | S | Login API | Credential stuffing | High | Rate limiting, MFA |152| T2 | I | Database | SQL injection leaks PII | Critical | Parameterized queries |153154### Recommendations155Prioritized list of security improvements.156```157158### When to threat model159160- During initial design of any system handling sensitive data.161- Before adding a new external integration or trust boundary.162- After an incident, to find adjacent risks.163- On a periodic schedule for high-value systems (annually or per164 major release).165166### Anti-patterns167168- Threat modeling once at design time and never revisiting.169- Skipping the data flow diagram and going straight to a threat list.170- Treating "low likelihood" as "ignore forever".171- Producing a document nobody reads. The output should drive a172 prioritized punch list of work, not sit in a wiki.173- Modeling abstract systems instead of the actual architecture in174 production.175176### Tips for sharper models177178- Walk the diagram with someone who didn't build the system; gaps179 surface fast.180- Track every mitigation back to a ticket or commit. A mitigation181 with no owner is a mitigation that won't happen.182- Re-rate risks after mitigations land — residual risk is what183 matters for prioritization.