Threat Modeling Skill
This skill helps you systematically identify, analyze, and document security threats in applications and systems using industry-standard methodologies.
When to Use This Skill
Use this skill when:
- A user asks to create or review a threat model for an application or system
- You need to identify potential security vulnerabilities in a design or architecture
- The user wants to assess attack surface or security risks
- You're asked to document threats and mitigations for a project
- Security architecture review is requested
- The user mentions STRIDE, DREAD, PASTA, or other threat modeling methodologies
Core Concepts
The CIA Triad
All threat modeling should consider these three security pillars:
- Confidentiality: Is data protected from unauthorized access? Consider encryption, access controls, authentication.
- Integrity: Is data protected from unauthorized modification? Consider checksums, hashing, validation.
- Availability: Are systems accessible when needed? Consider redundancy, fault tolerance, DDoS protection.
Threat Modeling Methodologies
STRIDE (Primary Methodology)
Use STRIDE to categorize threats during the design phase:
| Category |
Description |
Example |
| Spoofing |
Impersonating another user or system |
Fake login credentials, API key theft |
| Tampering |
Unauthorized modification of data |
SQL injection, file modification |
| Repudiation |
Denying actions were performed |
Missing audit logs, no transaction records |
| Information Disclosure |
Exposing sensitive data |
Data leaks, improper error messages |
| Denial of Service |
Making services unavailable |
Resource exhaustion, DDoS attacks |
| Elevation of Privilege |
Gaining unauthorized access levels |
Privilege escalation, admin access abuse |
DREAD (Risk Scoring)
Use DREAD to prioritize identified threats:
| Factor |
Description |
Score (1-10) |
| Damage Potential |
Impact if threat is realized |
|
| Reproducibility |
How easily can it be reproduced |
|
| Exploitability |
How easy is it to exploit |
|
| Affected Users |
How many users are impacted |
|
| Discoverability |
How easy is it to find the vulnerability |
|
Calculate: (D + R + E + A + D) / 5 for overall risk score.
PASTA (Process for Attack Simulation and Threat Analysis)
Seven-step risk-centric methodology:
- Define security objectives
- Define technical scope
- Application decomposition
- Threat analysis
- Vulnerability analysis
- Risk assessment
- Risk triage and mitigation
Threat Modeling Process
Step 1: Define Scope and Objectives
Ask the user:
- What system/application are we modeling?
- What are the security objectives (confidentiality, integrity, availability priorities)?
- Who are the users and what data is involved?
- What are the trust boundaries (internal/external networks, third-party services)?
Step 2: Create Data Flow Diagram
Document the system architecture with these elements:
| Element |
Description |
Example |
| Process |
System component or functionality |
Web server, API endpoint, database |
| Actor |
User or external system |
Website visitor, admin, payment gateway |
| Data Flow |
Information movement between components |
User credentials, API requests |
| Store |
Data storage locations |
Database, file system, cache |
| Trust Boundary |
Security perimeter |
Network segments, firewall boundaries |
Step 3: Identify Threats Using STRIDE
For each component in your diagram, ask:
For Processes:
- Can this be spoofed? (Authentication/Authorization)
- Can data be tampered with? (Input validation, encryption)
- Can actions be repudiated? (Logging, audit trails)
- Can information be disclosed? (Data protection, access controls)
- Can this be denied? (Rate limiting, resource management)
- Can privileges be elevated? (Access control, privilege separation)
For Data Flows:
- Is data encrypted in transit?
- Is data integrity verified?
- Are there replay attack protections?
For Stores:
- Is data encrypted at rest?
- Are access controls properly configured?
- Is backup/recovery in place?
For Actors:
- Is authentication strong enough?
- Are permissions properly scoped?
- Can actions be attributed?
Step 4: Assess and Prioritize Risks
For each identified threat:
- Apply DREAD scoring (1-10 for each factor)
- Calculate overall risk score
- Categorize as High (>7), Medium (4-7), or Low (<4)
- Document mitigation strategies
Step 5: Document Mitigations
For each threat, specify:
- Mitigation: How to prevent or reduce the threat
- Residual Risk: Risk remaining after mitigation
- Owner: Who is responsible for implementation
- Timeline: When should it be addressed
Output Format
When creating a threat model, use this structure:
# Threat Model: [System Name]
## Overview
- **System**: [Description]
- **Date**: [Current Date]
- **Methodology**: [STRIDE/DREAD/PASTA]
- **Scope**: [What's included/excluded]
## Data Flow Diagram
[Describe or reference diagram with components, actors, data flows, stores, trust boundaries]
## Identified Threats
### [Component Name]
| Threat ID | STRIDE Category | Description | DREAD Score | Risk Level | Mitigation |
|-----------|-----------------|-------------|-------------|------------|------------|
| T-001 | Spoofing | [Description] | X.X | High/Med/Low | [Mitigation] |
## Risk Summary
- **High Risk**: [Count] threats
- **Medium Risk**: [Count] threats
- **Low Risk**: [Count] threats
## Recommendations
1. [Priority action]
2. [Priority action]
3. [Priority action]
Tools to Recommend
OWASP Threat Dragon
- Best for: Visual threat modeling, collaborative work
- Features: System diagramming, auto-generated threats/mitigations
- Use when: User needs visual diagrams or team collaboration
- Link: https://github.com/OWASP/threat-dragon
Microsoft Threat Modeling Tool
- Best for: Microsoft stack, STRIDE methodology
- Features: Built-in STRIDE analysis, mitigation suggestions
- Use when: User is developing on Microsoft technologies
- Link: https://aka.ms/threatmodelingtool
SpiderSuite
- Best for: Attack surface mapping, web application analysis
- Features: Web crawling, graph visualization
- Use when: User needs to map external attack surface
- Link: https://github.com/3nock/SpiderSuite
Common Threat Patterns
Authentication & Authorization
- Weak password policies
- Missing MFA
- Session fixation
- Broken access control
- Privilege escalation
Data Protection
- Unencrypted sensitive data
- Insecure data transmission
- Improper error handling exposing data
- Insufficient logging
Input Validation
- SQL injection
- XSS (Cross-Site Scripting)
- Command injection
- Path traversal
- Buffer overflow
Infrastructure
- Misconfigured cloud services
- Unpatched vulnerabilities
- Insecure APIs
- Third-party dependencies
Example Threat Model
Input: "Create a threat model for our e-commerce API that handles user accounts and payments"
Output Structure:
# Threat Model: E-Commerce API
## Overview
- **System**: REST API for e-commerce platform
- **Methodology**: STRIDE + DREAD
- **Scope**: User authentication, product catalog, shopping cart, payment processing
## Data Flow Diagram
- **Actors**: Customer, Admin, Payment Gateway, Inventory System
- **Processes**: Auth Service, Product API, Cart Service, Payment Processor
- **Stores**: User DB, Product DB, Order DB, Session Store
- **Trust Boundaries**: Public Internet, Internal Network, PCI-DSS Zone
## Identified Threats
### Authentication Service
| Threat ID | STRIDE | Description | DREAD | Risk | Mitigation |
|-----------|--------|-------------|-------|------|------------|
| T-001 | Spoofing | Brute force login attacks | 7.2 | High | Rate limiting, MFA, account lockout |
| T-002 | Info Disclosure | Password hash exposure | 6.8 | High | bcrypt/scrypt hashing, salt |
| T-003 | Repudiation | No login audit trail | 5.5 | Medium | Comprehensive logging |
### Payment Processor
| Threat ID | STRIDE | Description | DREAD | Risk | Mitigation |
|-----------|--------|-------------|-------|------|------------|
| T-004 | Tampering | Payment amount modification | 8.5 | High | Server-side validation, HMAC |
| T-005 | Info Disclosure | PCI data exposure | 9.0 | High | Tokenization, PCI compliance |
## Risk Summary
- **High Risk**: 3 threats
- **Medium Risk**: 2 threats
- **Low Risk**: 1 threat
## Recommendations
1. Implement MFA for all user accounts (High priority)
2. Ensure PCI-DSS compliance for payment handling (High priority)
3. Add comprehensive audit logging (Medium priority)
4. Deploy WAF for injection protection (Medium priority)
5. Regular security assessments (Ongoing)
Best Practices
- Start Early: Threat model during design, not after implementation
- Iterate: Update threat models as the system evolves
- Involve Stakeholders: Get input from developers, security, and operations
- Focus on High Risk: Prioritize threats with highest DREAD scores
- Document Everything: Maintain threat model as living documentation
- Test Mitigations: Verify controls work through penetration testing
- Review Regularly: Re-assess threats quarterly or after major changes
Questions to Ask Users
Before creating a threat model, gather:
- What system/application are we modeling?
- What data does it handle (PII, financial, health, etc.)?
- Who are the users and what are their roles?
- What integrations or third-party services exist?
- What compliance requirements apply (GDPR, HIPAA, PCI-DSS)?
- What's the deployment environment (cloud, on-prem, hybrid)?
- Are there existing security controls in place?
- What's the risk tolerance for this system?
1---2name: threat-modeling3description: Create comprehensive threat models for applications and systems using established methodologies like STRIDE, DREAD, and PASTA. Use this skill whenever the user needs to identify security vulnerabilities, assess system risks, create data flow diagrams, or document potential threats and mitigations. Trigger for any request involving security architecture review, vulnerability assessment, attack surface analysis, or security planning for software projects.4---56# Threat Modeling Skill78This skill helps you systematically identify, analyze, and document security threats in applications and systems using industry-standard methodologies.910## When to Use This Skill1112Use this skill when:13- A user asks to create or review a threat model for an application or system14- You need to identify potential security vulnerabilities in a design or architecture15- The user wants to assess attack surface or security risks16- You're asked to document threats and mitigations for a project17- Security architecture review is requested18- The user mentions STRIDE, DREAD, PASTA, or other threat modeling methodologies1920## Core Concepts2122### The CIA Triad2324All threat modeling should consider these three security pillars:25261. **Confidentiality**: Is data protected from unauthorized access? Consider encryption, access controls, authentication.272. **Integrity**: Is data protected from unauthorized modification? Consider checksums, hashing, validation.283. **Availability**: Are systems accessible when needed? Consider redundancy, fault tolerance, DDoS protection.2930### Threat Modeling Methodologies3132#### STRIDE (Primary Methodology)3334Use STRIDE to categorize threats during the design phase:3536| Category | Description | Example |37|----------|-------------|----------|38| **S**poofing | Impersonating another user or system | Fake login credentials, API key theft |39| **T**ampering | Unauthorized modification of data | SQL injection, file modification |40| **R**epudiation | Denying actions were performed | Missing audit logs, no transaction records |41| **I**nformation Disclosure | Exposing sensitive data | Data leaks, improper error messages |42| **D**enial of Service | Making services unavailable | Resource exhaustion, DDoS attacks |43| **E**levation of Privilege | Gaining unauthorized access levels | Privilege escalation, admin access abuse |4445#### DREAD (Risk Scoring)4647Use DREAD to prioritize identified threats:4849| Factor | Description | Score (1-10) |50|--------|-------------|---------------|51| **D**amage Potential | Impact if threat is realized | |52| **R**eproducibility | How easily can it be reproduced | |53| **E**xploitability | How easy is it to exploit | |54| **A**ffected Users | How many users are impacted | |55| **D**iscoverability | How easy is it to find the vulnerability | |5657Calculate: `(D + R + E + A + D) / 5` for overall risk score.5859#### PASTA (Process for Attack Simulation and Threat Analysis)6061Seven-step risk-centric methodology:621. Define security objectives632. Define technical scope643. Application decomposition654. Threat analysis665. Vulnerability analysis676. Risk assessment687. Risk triage and mitigation6970## Threat Modeling Process7172### Step 1: Define Scope and Objectives7374Ask the user:75- What system/application are we modeling?76- What are the security objectives (confidentiality, integrity, availability priorities)?77- Who are the users and what data is involved?78- What are the trust boundaries (internal/external networks, third-party services)?7980### Step 2: Create Data Flow Diagram8182Document the system architecture with these elements:8384| Element | Description | Example |85|---------|-------------|----------|86| **Process** | System component or functionality | Web server, API endpoint, database |87| **Actor** | User or external system | Website visitor, admin, payment gateway |88| **Data Flow** | Information movement between components | User credentials, API requests |89| **Store** | Data storage locations | Database, file system, cache |90| **Trust Boundary** | Security perimeter | Network segments, firewall boundaries |9192### Step 3: Identify Threats Using STRIDE9394For each component in your diagram, ask:9596**For Processes:**97- Can this be spoofed? (Authentication/Authorization)98- Can data be tampered with? (Input validation, encryption)99- Can actions be repudiated? (Logging, audit trails)100- Can information be disclosed? (Data protection, access controls)101- Can this be denied? (Rate limiting, resource management)102- Can privileges be elevated? (Access control, privilege separation)103104**For Data Flows:**105- Is data encrypted in transit?106- Is data integrity verified?107- Are there replay attack protections?108109**For Stores:**110- Is data encrypted at rest?111- Are access controls properly configured?112- Is backup/recovery in place?113114**For Actors:**115- Is authentication strong enough?116- Are permissions properly scoped?117- Can actions be attributed?118119### Step 4: Assess and Prioritize Risks120121For each identified threat:1221. Apply DREAD scoring (1-10 for each factor)1232. Calculate overall risk score1243. Categorize as High (>7), Medium (4-7), or Low (<4)1254. Document mitigation strategies126127### Step 5: Document Mitigations128129For each threat, specify:130- **Mitigation**: How to prevent or reduce the threat131- **Residual Risk**: Risk remaining after mitigation132- **Owner**: Who is responsible for implementation133- **Timeline**: When should it be addressed134135## Output Format136137When creating a threat model, use this structure:138139```140# Threat Model: [System Name]141142## Overview143- **System**: [Description]144- **Date**: [Current Date]145- **Methodology**: [STRIDE/DREAD/PASTA]146- **Scope**: [What's included/excluded]147148## Data Flow Diagram149[Describe or reference diagram with components, actors, data flows, stores, trust boundaries]150151## Identified Threats152153### [Component Name]154155| Threat ID | STRIDE Category | Description | DREAD Score | Risk Level | Mitigation |156|-----------|-----------------|-------------|-------------|------------|------------|157| T-001 | Spoofing | [Description] | X.X | High/Med/Low | [Mitigation] |158159## Risk Summary160- **High Risk**: [Count] threats161- **Medium Risk**: [Count] threats 162- **Low Risk**: [Count] threats163164## Recommendations1651. [Priority action]1662. [Priority action]1673. [Priority action]168```169170## Tools to Recommend171172### OWASP Threat Dragon173- **Best for**: Visual threat modeling, collaborative work174- **Features**: System diagramming, auto-generated threats/mitigations175- **Use when**: User needs visual diagrams or team collaboration176- **Link**: https://github.com/OWASP/threat-dragon177178### Microsoft Threat Modeling Tool179- **Best for**: Microsoft stack, STRIDE methodology180- **Features**: Built-in STRIDE analysis, mitigation suggestions181- **Use when**: User is developing on Microsoft technologies182- **Link**: https://aka.ms/threatmodelingtool183184### SpiderSuite185- **Best for**: Attack surface mapping, web application analysis186- **Features**: Web crawling, graph visualization187- **Use when**: User needs to map external attack surface188- **Link**: https://github.com/3nock/SpiderSuite189190## Common Threat Patterns191192### Authentication & Authorization193- Weak password policies194- Missing MFA195- Session fixation196- Broken access control197- Privilege escalation198199### Data Protection200- Unencrypted sensitive data201- Insecure data transmission202- Improper error handling exposing data203- Insufficient logging204205### Input Validation206- SQL injection207- XSS (Cross-Site Scripting)208- Command injection209- Path traversal210- Buffer overflow211212### Infrastructure213- Misconfigured cloud services214- Unpatched vulnerabilities215- Insecure APIs216- Third-party dependencies217218## Example Threat Model219220**Input**: "Create a threat model for our e-commerce API that handles user accounts and payments"221222**Output Structure**:223224```225# Threat Model: E-Commerce API226227## Overview228- **System**: REST API for e-commerce platform229- **Methodology**: STRIDE + DREAD230- **Scope**: User authentication, product catalog, shopping cart, payment processing231232## Data Flow Diagram233- **Actors**: Customer, Admin, Payment Gateway, Inventory System234- **Processes**: Auth Service, Product API, Cart Service, Payment Processor235- **Stores**: User DB, Product DB, Order DB, Session Store236- **Trust Boundaries**: Public Internet, Internal Network, PCI-DSS Zone237238## Identified Threats239240### Authentication Service241242| Threat ID | STRIDE | Description | DREAD | Risk | Mitigation |243|-----------|--------|-------------|-------|------|------------|244| T-001 | Spoofing | Brute force login attacks | 7.2 | High | Rate limiting, MFA, account lockout |245| T-002 | Info Disclosure | Password hash exposure | 6.8 | High | bcrypt/scrypt hashing, salt |246| T-003 | Repudiation | No login audit trail | 5.5 | Medium | Comprehensive logging |247248### Payment Processor249250| Threat ID | STRIDE | Description | DREAD | Risk | Mitigation |251|-----------|--------|-------------|-------|------|------------|252| T-004 | Tampering | Payment amount modification | 8.5 | High | Server-side validation, HMAC |253| T-005 | Info Disclosure | PCI data exposure | 9.0 | High | Tokenization, PCI compliance |254255## Risk Summary256- **High Risk**: 3 threats257- **Medium Risk**: 2 threats258- **Low Risk**: 1 threat259260## Recommendations2611. Implement MFA for all user accounts (High priority)2622. Ensure PCI-DSS compliance for payment handling (High priority)2633. Add comprehensive audit logging (Medium priority)2644. Deploy WAF for injection protection (Medium priority)2655. Regular security assessments (Ongoing)266```267268## Best Practices2692701. **Start Early**: Threat model during design, not after implementation2712. **Iterate**: Update threat models as the system evolves2723. **Involve Stakeholders**: Get input from developers, security, and operations2734. **Focus on High Risk**: Prioritize threats with highest DREAD scores2745. **Document Everything**: Maintain threat model as living documentation2756. **Test Mitigations**: Verify controls work through penetration testing2767. **Review Regularly**: Re-assess threats quarterly or after major changes277278## Questions to Ask Users279280Before creating a threat model, gather:2811. What system/application are we modeling?2822. What data does it handle (PII, financial, health, etc.)?2833. Who are the users and what are their roles?2844. What integrations or third-party services exist?2855. What compliance requirements apply (GDPR, HIPAA, PCI-DSS)?2866. What's the deployment environment (cloud, on-prem, hybrid)?2877. Are there existing security controls in place?2888. What's the risk tolerance for this system?