Threat Modeler
When to activate
- Conducting security design review on a new system or feature before implementation
- Analyzing a deployed system for previously unmapped threat vectors
- Responding to a suspected attack or security incident to understand root causes and gaps
- Preparing for a formal threat modeling session with stakeholders (architecture, infra, product)
- Validating that threat mitigations implemented in code/config actually address identified risks
When NOT to use
- Vulnerability scanning or penetration testing — use vulnerability assessment tools instead
- Post-incident root cause analysis without architectural context — pair with incident forensics
- Compliance checklist verification (SOC 2, PCI-DSS) — use compliance frameworks directly
- General security advice for code review — use code-review skill with security focus
- One-off security questions about a single component — ask specifically rather than full threat modeling
Instructions
Phase 1: Define System Scope and Boundaries
Identify the system boundary. What components are in scope? What are the external actors and trust boundaries?
- Draw or describe data flows: where does data enter, transform, and exit?
- Identify authentication/authorization boundaries
- Mark external systems and third-party services
List system assets. What are you protecting?
- User data (PII, credentials, secrets)
- Application logic and proprietary algorithms
- Availability/uptime
- Integrity of stored or transmitted data
- Audit logs and forensic capability
Document entry/exit points. How can attackers interact with this system?
- API endpoints (REST, GraphQL, gRPC)
- Network listeners (ports, protocols)
- File upload mechanisms
- Admin consoles or dashboards
- Third-party integrations (webhooks, OAuth, SSO)
Phase 2: Apply STRIDE Framework
For each entry point and trust boundary, systematically walk through STRIDE:
S — Spoofing (Identity Forgery)
- Can an attacker impersonate a legitimate user or service?
- Weak authentication (hardcoded creds, shared secrets, no MFA)?
- Unverified API calls between internal services?
- DNS or network interception?
- Unsigned JWTs or predictable session tokens?
T — Tampering (Modification)
- Can data be modified in transit or at rest?
- Unencrypted or plaintext transmission (HTTP, unencrypted database connections)?
- Missing integrity checks (no HMAC, signatures, checksums)?
- Unsafe deserialization (pickle, Java serialization, YAML)?
- Writable config files or environment variables?
R — Repudiation (Denial of Actions)
- Can an attacker deny performing an action?
- Missing audit logs for sensitive operations?
- Logs that can be modified or deleted?
- Lack of digital signatures or timestamps?
- No nonrepudiation for financial or legal transactions?
I — Information Disclosure
- Can sensitive data be exposed?
- Secrets in logs, error messages, or debug output?
- Information leakage in API responses (user enumeration, data exposure)?
- Readable backup files or cache?
- Metadata exposure (timing attacks, HTTP headers)?
- Unencrypted storage of credentials or PII?
D — Denial of Service (DoS)
- Can an attacker make the system unavailable?
- No rate limiting on endpoints?
- Resource exhaustion via large uploads, queries, or concurrent connections?
- Crash triggers from malformed input?
- External dependencies without timeout or circuit breaker?
- DDoS vulnerability without mitigation?
E — Elevation of Privilege (AuthZ Bypass)
- Can an attacker gain unauthorized access or permissions?
- Missing or weak authorization checks (relying on client-side filtering)?
- Privilege escalation via direct object references (IDOR)?
- Missing permission validation in API calls?
- Session fixation or hijacking?
- Unsafe use of admin accounts or service principals?
Phase 3: Document Threats and Ranking
For each identified threat, record:
- Threat ID: Unique identifier (e.g., TM-001, TM-API-003)
- STRIDE Category: Which one(s) apply
- Description: What is the attack? How would it happen?
- Affected Component(s): Which system parts are vulnerable
- Likelihood: H/M/L — based on required attacker skill, ease of exploitation, attack surface
- Impact: H/M/L — data loss, availability, confidentiality, compliance violation
- Risk Level: H/M/L — combination of likelihood and impact
- Current Mitigations: What controls exist today?
- Recommended Mitigation: How to reduce likelihood or impact
- Effort to Mitigate: Low/Medium/High
Phase 4: Build Attack Tree (Optional)
For high-risk threats:
- Identify the attacker's goal (e.g., "Steal user credentials")
- Work backwards: what must be true for this to succeed?
- Branch into sub-goals and technical conditions
- Identify which branch is most likely or easiest to exploit
- Map mitigations to branches to show coverage
Example structure:
Goal: Steal database credentials
├─ Compromise developer machine
│ ├─ Social engineering email
│ ├─ Malware download
│ └─ Physical theft of laptop
└─ Extract from code/config
├─ Git history (.git folder)
├─ Environment files (dotenv, k8s secrets)
└─ Hardcoded in comments or strings
Phase 5: Prioritize and Plan
- Sort threats by Risk Level (H → M → L)
- Group by component to identify systemic issues
- Identify quick wins (mitigations that are easy and high-impact)
- Schedule remediation — high-risk items into sprint planning
- Track ownership — assign each mitigation to a team (backend, infra, security)
- Follow up — re-threat-model after significant changes
Example
System: Multi-tenant SaaS expense management application
Scope: Web API (Node.js), React frontend, PostgreSQL database, AWS S3 for receipts, Stripe for billing
Selected Threat from STRIDE walkthrough:
| Field |
Value |
| Threat ID |
TM-API-005 |
| Category |
Elevation of Privilege (E) + Information Disclosure (I) |
| Description |
Attacker can view another tenant's expenses via direct object reference (IDOR). API endpoint /api/expenses/{expenseId} returns expense details without verifying the requesting user owns the expense. Attacker increments expenseId parameter to enumerate and read all expenses in the system. |
| Affected Components |
Node.js API, PostgreSQL (expense table), React frontend |
| Likelihood |
High — endpoint is publicly documented, parameter enumeration is trivial, no API key rotation/limit required |
| Impact |
High — exposure of all user PII, financial data (amounts, vendor info, personal card details), business intelligence |
| Risk Level |
High |
| Current Mitigations |
Database encryption at rest; HTTPS for transit |
| Recommended Mitigation |
Add authorization check in API handler: fetch expense, verify expense.tenantId === req.user.tenantId before returning. Add integration tests to verify IDOR is blocked. Implement per-tenant row-level security (RLS) in PostgreSQL as defense-in-depth. |
| Effort to Mitigate |
Low — ~2 hour code change + 1 hour testing |
Attack Tree for High-Risk Threat (TM-API-008):
Goal: Bypass MFA and steal user accounts
├─ Guess or leak session token
│ ├─ Weak token generation (predictable)
│ │ └─ Token not cryptographically random
│ ├─ Token leaked in logs/error messages
│ │ └─ Verbose error handling
│ └─ Token stored insecurely (localStorage, unencrypted)
│
└─ Exploit MFA implementation gaps
├─ No MFA enforcement for high-privilege actions
├─ Time-based OTP (TOTP) brute-force (no rate limit)
└─ SMS-based OTP interception
└─ SIM swap attack (out-of-scope for app, but operational risk)
Mitigation coverage:
- Cryptographically random session tokens → eliminates "predictable" branch
- Structured logging + secret redaction → eliminates "leaked in logs" branch
- HTTPOnly + Secure cookies → reduces localStorage exposure
- Rate limiting on OTP validation → 5 attempts per 15 min per account
- Audit logs for MFA changes → post-incident forensics
1---2name: threat-modeler3description: Threat Modeler4metadata:5 source: https://skillmd.com/skills/uitbreidenos/threat-modeler6---7# Threat Modeler89## When to activate1011- Conducting security design review on a new system or feature before implementation12- Analyzing a deployed system for previously unmapped threat vectors13- Responding to a suspected attack or security incident to understand root causes and gaps14- Preparing for a formal threat modeling session with stakeholders (architecture, infra, product)15- Validating that threat mitigations implemented in code/config actually address identified risks1617## When NOT to use1819- Vulnerability scanning or penetration testing — use vulnerability assessment tools instead20- Post-incident root cause analysis without architectural context — pair with incident forensics21- Compliance checklist verification (SOC 2, PCI-DSS) — use compliance frameworks directly22- General security advice for code review — use code-review skill with security focus23- One-off security questions about a single component — ask specifically rather than full threat modeling2425## Instructions2627### Phase 1: Define System Scope and Boundaries28291. **Identify the system boundary.** What components are in scope? What are the external actors and trust boundaries?30 - Draw or describe data flows: where does data enter, transform, and exit?31 - Identify authentication/authorization boundaries32 - Mark external systems and third-party services33342. **List system assets.** What are you protecting?35 - User data (PII, credentials, secrets)36 - Application logic and proprietary algorithms37 - Availability/uptime38 - Integrity of stored or transmitted data39 - Audit logs and forensic capability40413. **Document entry/exit points.** How can attackers interact with this system?42 - API endpoints (REST, GraphQL, gRPC)43 - Network listeners (ports, protocols)44 - File upload mechanisms45 - Admin consoles or dashboards46 - Third-party integrations (webhooks, OAuth, SSO)4748### Phase 2: Apply STRIDE Framework4950For each entry point and trust boundary, systematically walk through STRIDE:5152#### **S — Spoofing (Identity Forgery)**53- Can an attacker impersonate a legitimate user or service?54- Weak authentication (hardcoded creds, shared secrets, no MFA)?55- Unverified API calls between internal services?56- DNS or network interception?57- Unsigned JWTs or predictable session tokens?5859#### **T — Tampering (Modification)**60- Can data be modified in transit or at rest?61- Unencrypted or plaintext transmission (HTTP, unencrypted database connections)?62- Missing integrity checks (no HMAC, signatures, checksums)?63- Unsafe deserialization (pickle, Java serialization, YAML)?64- Writable config files or environment variables?6566#### **R — Repudiation (Denial of Actions)**67- Can an attacker deny performing an action?68- Missing audit logs for sensitive operations?69- Logs that can be modified or deleted?70- Lack of digital signatures or timestamps?71- No nonrepudiation for financial or legal transactions?7273#### **I — Information Disclosure**74- Can sensitive data be exposed?75- Secrets in logs, error messages, or debug output?76- Information leakage in API responses (user enumeration, data exposure)?77- Readable backup files or cache?78- Metadata exposure (timing attacks, HTTP headers)?79- Unencrypted storage of credentials or PII?8081#### **D — Denial of Service (DoS)**82- Can an attacker make the system unavailable?83- No rate limiting on endpoints?84- Resource exhaustion via large uploads, queries, or concurrent connections?85- Crash triggers from malformed input?86- External dependencies without timeout or circuit breaker?87- DDoS vulnerability without mitigation?8889#### **E — Elevation of Privilege (AuthZ Bypass)**90- Can an attacker gain unauthorized access or permissions?91- Missing or weak authorization checks (relying on client-side filtering)?92- Privilege escalation via direct object references (IDOR)?93- Missing permission validation in API calls?94- Session fixation or hijacking?95- Unsafe use of admin accounts or service principals?9697### Phase 3: Document Threats and Ranking9899For each identified threat, record:1001011. **Threat ID**: Unique identifier (e.g., TM-001, TM-API-003)1022. **STRIDE Category**: Which one(s) apply1033. **Description**: What is the attack? How would it happen?1044. **Affected Component(s)**: Which system parts are vulnerable1055. **Likelihood**: H/M/L — based on required attacker skill, ease of exploitation, attack surface1066. **Impact**: H/M/L — data loss, availability, confidentiality, compliance violation1077. **Risk Level**: H/M/L — combination of likelihood and impact1088. **Current Mitigations**: What controls exist today?1099. **Recommended Mitigation**: How to reduce likelihood or impact11010. **Effort to Mitigate**: Low/Medium/High111112### Phase 4: Build Attack Tree (Optional)113114For high-risk threats:115116- Identify the attacker's goal (e.g., "Steal user credentials")117- Work backwards: what must be true for this to succeed?118- Branch into sub-goals and technical conditions119- Identify which branch is most likely or easiest to exploit120- Map mitigations to branches to show coverage121122Example structure:123```124Goal: Steal database credentials125├─ Compromise developer machine126│ ├─ Social engineering email127│ ├─ Malware download128│ └─ Physical theft of laptop129└─ Extract from code/config130 ├─ Git history (.git folder)131 ├─ Environment files (dotenv, k8s secrets)132 └─ Hardcoded in comments or strings133```134135### Phase 5: Prioritize and Plan1361371. **Sort threats by Risk Level** (H → M → L)1382. **Group by component** to identify systemic issues1393. **Identify quick wins** (mitigations that are easy and high-impact)1404. **Schedule remediation** — high-risk items into sprint planning1415. **Track ownership** — assign each mitigation to a team (backend, infra, security)1426. **Follow up** — re-threat-model after significant changes143144## Example145146**System:** Multi-tenant SaaS expense management application147148**Scope:** Web API (Node.js), React frontend, PostgreSQL database, AWS S3 for receipts, Stripe for billing149150**Selected Threat from STRIDE walkthrough:**151152| Field | Value |153|---|---|154| **Threat ID** | TM-API-005 |155| **Category** | Elevation of Privilege (E) + Information Disclosure (I) |156| **Description** | Attacker can view another tenant's expenses via direct object reference (IDOR). API endpoint `/api/expenses/{expenseId}` returns expense details without verifying the requesting user owns the expense. Attacker increments `expenseId` parameter to enumerate and read all expenses in the system. |157| **Affected Components** | Node.js API, PostgreSQL (expense table), React frontend |158| **Likelihood** | **High** — endpoint is publicly documented, parameter enumeration is trivial, no API key rotation/limit required |159| **Impact** | **High** — exposure of all user PII, financial data (amounts, vendor info, personal card details), business intelligence |160| **Risk Level** | **High** |161| **Current Mitigations** | Database encryption at rest; HTTPS for transit |162| **Recommended Mitigation** | Add authorization check in API handler: fetch expense, verify `expense.tenantId === req.user.tenantId` before returning. Add integration tests to verify IDOR is blocked. Implement per-tenant row-level security (RLS) in PostgreSQL as defense-in-depth. |163| **Effort to Mitigate** | **Low** — ~2 hour code change + 1 hour testing |164165---166167**Attack Tree for High-Risk Threat (TM-API-008):**168169*Goal: Bypass MFA and steal user accounts*170```171├─ Guess or leak session token172│ ├─ Weak token generation (predictable)173│ │ └─ Token not cryptographically random174│ ├─ Token leaked in logs/error messages175│ │ └─ Verbose error handling176│ └─ Token stored insecurely (localStorage, unencrypted)177│178└─ Exploit MFA implementation gaps179 ├─ No MFA enforcement for high-privilege actions180 ├─ Time-based OTP (TOTP) brute-force (no rate limit)181 └─ SMS-based OTP interception182 └─ SIM swap attack (out-of-scope for app, but operational risk)183```184185**Mitigation coverage:**186- Cryptographically random session tokens → eliminates "predictable" branch187- Structured logging + secret redaction → eliminates "leaked in logs" branch188- HTTPOnly + Secure cookies → reduces localStorage exposure189- Rate limiting on OTP validation → 5 attempts per 15 min per account190- Audit logs for MFA changes → post-incident forensics