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.4metadata:5 source: https://skillmd.com/skills/abelrguezr/threat-modeling6---78# Threat Modeling Skill910This skill helps you systematically identify, analyze, and document security threats in applications and systems using industry-standard methodologies.1112## When to Use This Skill1314Use this skill when:15- A user asks to create or review a threat model for an application or system16- You need to identify potential security vulnerabilities in a design or architecture17- The user wants to assess attack surface or security risks18- You're asked to document threats and mitigations for a project19- Security architecture review is requested20- The user mentions STRIDE, DREAD, PASTA, or other threat modeling methodologies2122## Core Concepts2324### The CIA Triad2526All threat modeling should consider these three security pillars:27281. **Confidentiality**: Is data protected from unauthorized access? Consider encryption, access controls, authentication.292. **Integrity**: Is data protected from unauthorized modification? Consider checksums, hashing, validation.303. **Availability**: Are systems accessible when needed? Consider redundancy, fault tolerance, DDoS protection.3132### Threat Modeling Methodologies3334#### STRIDE (Primary Methodology)3536Use STRIDE to categorize threats during the design phase:3738| Category | Description | Example |39|----------|-------------|----------|40| **S**poofing | Impersonating another user or system | Fake login credentials, API key theft |41| **T**ampering | Unauthorized modification of data | SQL injection, file modification |42| **R**epudiation | Denying actions were performed | Missing audit logs, no transaction records |43| **I**nformation Disclosure | Exposing sensitive data | Data leaks, improper error messages |44| **D**enial of Service | Making services unavailable | Resource exhaustion, DDoS attacks |45| **E**levation of Privilege | Gaining unauthorized access levels | Privilege escalation, admin access abuse |4647#### DREAD (Risk Scoring)4849Use DREAD to prioritize identified threats:5051| Factor | Description | Score (1-10) |52|--------|-------------|---------------|53| **D**amage Potential | Impact if threat is realized | |54| **R**eproducibility | How easily can it be reproduced | |55| **E**xploitability | How easy is it to exploit | |56| **A**ffected Users | How many users are impacted | |57| **D**iscoverability | How easy is it to find the vulnerability | |5859Calculate: `(D + R + E + A + D) / 5` for overall risk score.6061#### PASTA (Process for Attack Simulation and Threat Analysis)6263Seven-step risk-centric methodology:641. Define security objectives652. Define technical scope663. Application decomposition674. Threat analysis685. Vulnerability analysis696. Risk assessment707. Risk triage and mitigation7172## Threat Modeling Process7374### Step 1: Define Scope and Objectives7576Ask the user:77- What system/application are we modeling?78- What are the security objectives (confidentiality, integrity, availability priorities)?79- Who are the users and what data is involved?80- What are the trust boundaries (internal/external networks, third-party services)?8182### Step 2: Create Data Flow Diagram8384Document the system architecture with these elements:8586| Element | Description | Example |87|---------|-------------|----------|88| **Process** | System component or functionality | Web server, API endpoint, database |89| **Actor** | User or external system | Website visitor, admin, payment gateway |90| **Data Flow** | Information movement between components | User credentials, API requests |91| **Store** | Data storage locations | Database, file system, cache |92| **Trust Boundary** | Security perimeter | Network segments, firewall boundaries |9394### Step 3: Identify Threats Using STRIDE9596For each component in your diagram, ask:9798**For Processes:**99- Can this be spoofed? (Authentication/Authorization)100- Can data be tampered with? (Input validation, encryption)101- Can actions be repudiated? (Logging, audit trails)102- Can information be disclosed? (Data protection, access controls)103- Can this be denied? (Rate limiting, resource management)104- Can privileges be elevated? (Access control, privilege separation)105106**For Data Flows:**107- Is data encrypted in transit?108- Is data integrity verified?109- Are there replay attack protections?110111**For Stores:**112- Is data encrypted at rest?113- Are access controls properly configured?114- Is backup/recovery in place?115116**For Actors:**117- Is authentication strong enough?118- Are permissions properly scoped?119- Can actions be attributed?120121### Step 4: Assess and Prioritize Risks122123For each identified threat:1241. Apply DREAD scoring (1-10 for each factor)1252. Calculate overall risk score1263. Categorize as High (>7), Medium (4-7), or Low (<4)1274. Document mitigation strategies128129### Step 5: Document Mitigations130131For each threat, specify:132- **Mitigation**: How to prevent or reduce the threat133- **Residual Risk**: Risk remaining after mitigation134- **Owner**: Who is responsible for implementation135- **Timeline**: When should it be addressed136137## Output Format138139When creating a threat model, use this structure:140141```142# Threat Model: [System Name]143144## Overview145- **System**: [Description]146- **Date**: [Current Date]147- **Methodology**: [STRIDE/DREAD/PASTA]148- **Scope**: [What's included/excluded]149150## Data Flow Diagram151[Describe or reference diagram with components, actors, data flows, stores, trust boundaries]152153## Identified Threats154155### [Component Name]156157| Threat ID | STRIDE Category | Description | DREAD Score | Risk Level | Mitigation |158|-----------|-----------------|-------------|-------------|------------|------------|159| T-001 | Spoofing | [Description] | X.X | High/Med/Low | [Mitigation] |160161## Risk Summary162- **High Risk**: [Count] threats163- **Medium Risk**: [Count] threats 164- **Low Risk**: [Count] threats165166## Recommendations1671. [Priority action]1682. [Priority action]1693. [Priority action]170```171172## Tools to Recommend173174### OWASP Threat Dragon175- **Best for**: Visual threat modeling, collaborative work176- **Features**: System diagramming, auto-generated threats/mitigations177- **Use when**: User needs visual diagrams or team collaboration178- **Link**: https://github.com/OWASP/threat-dragon179180### Microsoft Threat Modeling Tool181- **Best for**: Microsoft stack, STRIDE methodology182- **Features**: Built-in STRIDE analysis, mitigation suggestions183- **Use when**: User is developing on Microsoft technologies184- **Link**: https://aka.ms/threatmodelingtool185186### SpiderSuite187- **Best for**: Attack surface mapping, web application analysis188- **Features**: Web crawling, graph visualization189- **Use when**: User needs to map external attack surface190- **Link**: https://github.com/3nock/SpiderSuite191192## Common Threat Patterns193194### Authentication & Authorization195- Weak password policies196- Missing MFA197- Session fixation198- Broken access control199- Privilege escalation200201### Data Protection202- Unencrypted sensitive data203- Insecure data transmission204- Improper error handling exposing data205- Insufficient logging206207### Input Validation208- SQL injection209- XSS (Cross-Site Scripting)210- Command injection211- Path traversal212- Buffer overflow213214### Infrastructure215- Misconfigured cloud services216- Unpatched vulnerabilities217- Insecure APIs218- Third-party dependencies219220## Example Threat Model221222**Input**: "Create a threat model for our e-commerce API that handles user accounts and payments"223224**Output Structure**:225226```227# Threat Model: E-Commerce API228229## Overview230- **System**: REST API for e-commerce platform231- **Methodology**: STRIDE + DREAD232- **Scope**: User authentication, product catalog, shopping cart, payment processing233234## Data Flow Diagram235- **Actors**: Customer, Admin, Payment Gateway, Inventory System236- **Processes**: Auth Service, Product API, Cart Service, Payment Processor237- **Stores**: User DB, Product DB, Order DB, Session Store238- **Trust Boundaries**: Public Internet, Internal Network, PCI-DSS Zone239240## Identified Threats241242### Authentication Service243244| Threat ID | STRIDE | Description | DREAD | Risk | Mitigation |245|-----------|--------|-------------|-------|------|------------|246| T-001 | Spoofing | Brute force login attacks | 7.2 | High | Rate limiting, MFA, account lockout |247| T-002 | Info Disclosure | Password hash exposure | 6.8 | High | bcrypt/scrypt hashing, salt |248| T-003 | Repudiation | No login audit trail | 5.5 | Medium | Comprehensive logging |249250### Payment Processor251252| Threat ID | STRIDE | Description | DREAD | Risk | Mitigation |253|-----------|--------|-------------|-------|------|------------|254| T-004 | Tampering | Payment amount modification | 8.5 | High | Server-side validation, HMAC |255| T-005 | Info Disclosure | PCI data exposure | 9.0 | High | Tokenization, PCI compliance |256257## Risk Summary258- **High Risk**: 3 threats259- **Medium Risk**: 2 threats260- **Low Risk**: 1 threat261262## Recommendations2631. Implement MFA for all user accounts (High priority)2642. Ensure PCI-DSS compliance for payment handling (High priority)2653. Add comprehensive audit logging (Medium priority)2664. Deploy WAF for injection protection (Medium priority)2675. Regular security assessments (Ongoing)268```269270## Best Practices2712721. **Start Early**: Threat model during design, not after implementation2732. **Iterate**: Update threat models as the system evolves2743. **Involve Stakeholders**: Get input from developers, security, and operations2754. **Focus on High Risk**: Prioritize threats with highest DREAD scores2765. **Document Everything**: Maintain threat model as living documentation2776. **Test Mitigations**: Verify controls work through penetration testing2787. **Review Regularly**: Re-assess threats quarterly or after major changes279280## Questions to Ask Users281282Before creating a threat model, gather:2831. What system/application are we modeling?2842. What data does it handle (PII, financial, health, etc.)?2853. Who are the users and what are their roles?2864. What integrations or third-party services exist?2875. What compliance requirements apply (GDPR, HIPAA, PCI-DSS)?2886. What's the deployment environment (cloud, on-prem, hybrid)?2897. Are there existing security controls in place?2908. What's the risk tolerance for this system?