一键导入
threat-modeling
Apply STRIDE methodology to identify security threats, analyze attack surfaces, and assess security risks in system architectures
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Apply STRIDE methodology to identify security threats, analyze attack surfaces, and assess security risks in system architectures
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Design AI agents with appropriate capabilities, tools, and personas for specific software development tasks
Design RESTful APIs with proper resource modeling, HTTP methods, error handling, and clear contracts following REST principles
Document APIs comprehensively with signatures, parameters, return values, errors, and working code examples for developer reference
Implement robust third-party API integrations with proper authentication, error handling, and rate limiting
Apply proven architectural patterns (MVC, layered, microservices) to create maintainable systems with clear separation of concerns
Systematically reproduce, diagnose, and analyze bugs to determine root cause, assess severity, and plan fix strategy
| name | Threat Modeling |
| description | Apply STRIDE methodology to identify security threats, analyze attack surfaces, and assess security risks in system architectures |
| category | security |
| required_tools | ["Read","Write","WebSearch"] |
Systematically identify potential security threats in system designs using structured methodologies like STRIDE, analyze attack surfaces, and prioritize security risks for mitigation.
Decompose the System
Apply STRIDE Framework
Identify Attack Vectors
Assess Risk
Define Mitigations
Context: Threat model for a web application with user authentication, file uploads, and database
Components:
Data Flows:
1. User → Frontend → API → Database
2. User → Frontend → API → File Storage
3. API → Auth Service → API
4. API → Email Service
5. Admin → API → Database (privileged operations)
Trust Boundaries:
Internet ↔ Frontend (HTTPS)
Frontend ↔ API (HTTPS, CORS)
API ↔ Database (private network)
API ↔ S3 (AWS IAM)
API ↔ Auth Service (OAuth2)
API ↔ Email Service (API key)
Data Classification:
| Component | Threat | STRIDE | Likelihood | Impact | Risk | Mitigation |
|---|---|---|---|---|---|---|
| API Login | Attacker steals session tokens by intercepting HTTPS | Spoofing | Low | High | Medium | Use HSTS, certificate pinning, short token lifetime |
| API Login | Brute force password attempts | Spoofing | High | High | High | Rate limiting, account lockout, CAPTCHA |
| Database | SQL injection modifies user data | Tampering | Medium | Critical | High | Parameterized queries, ORM, input validation |
| API | User denies making a purchase | Repudiation | High | Medium | Medium | Comprehensive audit logging, digital signatures |
| S3 Files | Public bucket exposes private files | Info Disclosure | Low | Critical | High | Private buckets, pre-signed URLs, access logging |
| S3 Files | Attacker uploads malicious file | Tampering | High | High | High | File type validation, virus scanning, size limits |
| API | DDoS overwhelms server | DoS | High | High | High | Rate limiting, CDN, auto-scaling, WAF |
| API Auth | Token forgery grants admin access | Elevation | Low | Critical | High | JWT signature verification, RBAC, token rotation |
| Frontend | XSS steals session tokens | Info Disclosure | Medium | High | High | CSP headers, output encoding, HTTPOnly cookies |
| API | CSRF performs unauthorized actions | Tampering | Medium | High | High | CSRF tokens, SameSite cookies |
External Attack Surface:
├── Web Frontend (exposed to internet)
│ ├── XSS via user inputs
│ ├── CSRF on state-changing operations
│ ├── Clickjacking via iframes
│ └── DOM-based attacks
├── API Endpoints (exposed to internet)
│ ├── Authentication bypass
│ ├── Injection attacks (SQL, NoSQL, Command)
│ ├── Broken authorization (IDOR)
│ ├── Rate limiting bypass
│ ├── Mass assignment
│ └── Insecure direct object references
├── File Upload (exposed to internet)
│ ├── Malicious file execution
│ ├── Path traversal
│ ├── Storage exhaustion
│ ├── Malware distribution
│ └── XXE attacks (XML uploads)
└── OAuth Callback (exposed to internet)
├── Authorization code interception
├── CSRF on OAuth flow
└── Open redirect vulnerabilities
Internal Attack Surface:
├── Database (internal network)
│ ├── Credential compromise
│ ├── Privilege escalation within DB
│ └── Backup exposure
├── Auth Service (internal network)
│ ├── Token generation vulnerabilities
│ └── Session fixation
└── Email Service (external API)
├── Email injection
├── API key exposure
└── Rate limit bypass
Critical (Address Immediately):
Token Forgery → Admin Access
Public S3 Bucket
SQL Injection
High (Address Soon):
Brute Force Login Attacks
Malicious File Upload
DDoS Attack
XSS Vulnerabilities
Medium (Address in Backlog):
Session Theft via HTTPS Interception
Audit Log Gaps (Repudiation)
# Threat Model Report - E-commerce Web Application
Date: 2025-01-12
Version: 1.0
## Executive Summary
Identified 10 security threats across 3 risk levels (Critical: 3, High: 4, Medium: 2).
Primary concerns: Token forgery, SQL injection, public file storage, brute force attacks.
## System Overview
Web application handling user authentication, file uploads, and payment processing.
External integrations: OAuth provider, S3 storage, SendGrid email.
## Critical Findings
1. Admin privilege escalation via token forgery (STRIDE: Elevation of Privilege)
2. Data breach via public S3 buckets (STRIDE: Information Disclosure)
3. Database compromise via SQL injection (STRIDE: Tampering)
## Recommended Actions
**Immediate (Before Launch)**:
- Implement JWT signature verification
- Configure S3 buckets as private
- Replace all string concatenation in SQL with parameterized queries
**Next Sprint**:
- Add rate limiting and account lockout
- Implement file upload validation and scanning
- Deploy CloudFlare WAF
**Ongoing**:
- Regular penetration testing
- Security code reviews for all PRs
- Quarterly threat model reviews
## Residual Risk
After mitigations: Medium
- Some risk remains from sophisticated targeted attacks
- Recommend: Bug bounty program, red team exercises
## Next Review
Scheduled: Q2 2025 or upon significant architecture changes