๐ Transform source code into actionable security insights with the Code-First Automated Threat Modeling Toolkit for deep risk analysis.
Resources
12Install
npx skillscat add cga22099/skill-threat-modeling Install via the SkillsCat registry.
name: threat-modeling
description: |
Code-first automated threat modeling toolkit. STRICT 8-PHASE WORKFLOW - DO NOT MODIFY.
MANDATORY: Create exactly 8 TodoWrite items with these EXACT names:
- Phase 1: Project Understanding (้กน็ฎ็่งฃ)
- Phase 2: Call Flow & DFD Analysis (ๆฐๆฎๆตๅๆ)
- Phase 3: Trust Boundary Evaluation (ไฟกไปป่พน็)
- Phase 4: Security Design Review (ๅฎๅ จ่ฎพ่ฎก่ฏๅฎก)
- Phase 5: STRIDE Threat Analysis (STRIDEๅๆ)
- Phase 6: Risk Validation (้ฃ้ฉ้ช่ฏ) โ NOT mitigation!
- Phase 7: Mitigation Planning (็ผ่งฃๆชๆฝ) โ AFTER validation!
- Phase 8: Report Generation (ๆฅๅ็ๆ) โ Output to Risk_Assessment_Report/
MANDATORY OUTPUT (Phase 8):
- Directory:
{PROJECT_ROOT}/Risk_Assessment_Report/ - Main report:
{PROJECT}-RISK-ASSESSMENT-REPORT.md(PROJECT=UPPERCASE) - Required: 4 reports + 6 phase docs (P1-P6)
- โ FORBIDDEN:
THREAT-MODEL-REPORT.mdor reports in project root
Use when: threat model, STRIDE, DFD, security assessment, ๅจ่ๅปบๆจก, ๅฎๅ จ่ฏไผฐ.
Code-First Deep Risk Analysis v2.0
Code-first automated deep threat modeling with comprehensive security chain analysis.
Execution Mode
Full Assessment Only - All 8 phases executed sequentially with maximum depth.
Phase 1 โโโบ Phase 2 โโโบ Phase 3 โโโบ Phase 4 โโโบ Phase 5 โโโบ Phase 6 โโโบ Phase 7 โโโบ Phase 8
Project Call Flow Trust Security STRIDE Risk Mitigation Report
Understanding DFD Boundaries Design Analysis ValidationStrict Workflow Rules:
- Phases execute strictly in order (1โ2โ3โ4โ5โ6โ7โ8)
- Each phase output passes to next phase as input
- Summary and reflection after each phase before proceeding
- No skipping, reordering, or parallel execution of phases
- Multi-risk analysis within phases can use parallel sub-agents
Phase Todo Creation โ CRITICAL REQUIREMENT
โ ๏ธ STOP AND READ: Before ANY analysis, you MUST create EXACTLY 8 todo items.
DO NOT proceed until you have created all 8 phases as separate todo items.
DO NOT modify phase names or descriptions. Copy EXACTLY as shown below.
MANDATORY TodoWrite Call (copy exactly, do not modify):
[
{"content": "Phase 1: Project Understanding", "status": "pending", "activeForm": "ๅๆ้กน็ฎๆถๆๅๆๆฏๆ "},
{"content": "Phase 2: Call Flow & DFD Analysis", "status": "pending", "activeForm": "ๆๅปบๆฐๆฎๆตๅพ"},
{"content": "Phase 3: Trust Boundary Evaluation", "status": "pending", "activeForm": "่ฏๅซไฟกไปป่พน็"},
{"content": "Phase 4: Security Design Review", "status": "pending", "activeForm": "่ฏไผฐๅฎๅ
จ่ฎพ่ฎก"},
{"content": "Phase 5: STRIDE Threat Analysis", "status": "pending", "activeForm": "ๆง่กSTRIDEๅๆ"},
{"content": "Phase 6: Risk Validation", "status": "pending", "activeForm": "้ช่ฏ้ฃ้ฉๅๆปๅป่ทฏๅพ"},
{"content": "Phase 7: Mitigation Planning", "status": "pending", "activeForm": "ๅถๅฎ็ผ่งฃๆชๆฝ"},
{"content": "Phase 8: Report Generation", "status": "pending", "activeForm": "็ๆๅจ่ๅปบๆจกๆฅๅ"}
]VIOLATIONS (will cause incorrect analysis):
- โ Creating fewer than 8 phases
- โ Combining phases (e.g., "Phase 2-7: Complete analysis")
- โ Renaming phases (e.g., "Phase 6: ็ผ่งฃๆชๆฝ" instead of "Phase 6: Risk Validation")
- โ Skipping Phase 6 (Risk Validation) or Phase 7 (Mitigation Planning)
- โ Starting analysis before creating all 8 todo items
CORRECT execution order:
- Phase 6 = Risk Validation (้ช่ฏ้ฃ้ฉๅๆปๅป่ทฏๅพ) โ NOT mitigation
- Phase 7 = Mitigation Planning (ๅถๅฎ็ผ่งฃๆชๆฝ) โ comes AFTER validation
- Phase 8 = Report Generation (็ๆๆฅๅ) โ final phase, MUST exist
Report Output Convention
Output Directory Structure
{PROJECT_ROOT}/
โโโ Risk_Assessment_Report/ โ ๆ็ปๆฅๅ่พๅบ็ฎๅฝ
โ
โ โโ ๅฟ
้ๆฅๅ (4ไปฝ) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโ {PROJECT}-RISK-ASSESSMENT-REPORT.md โ ้ฃ้ฉ่ฏไผฐๆฅๅ (ไธปๆฅๅ)
โโโ {PROJECT}-RISK-INVENTORY.md โ ้ฃ้ฉๆธ
ๅ
โโโ {PROJECT}-MITIGATION-MEASURES.md โ ็ผ่งฃๆชๆฝ
โโโ {PROJECT}-PENETRATION-TEST-PLAN.md โ ๆธ้ๆต่ฏๆนๆก โจ NEW
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โ โโ ้ถๆฎต่ฟ็จๆๆกฃ (ไป.phase_workingๅคๅถ๏ผไฟ็่ฑๆๅ) โโโโโโโโโโโโโโโ
โโโ P1-PROJECT-UNDERSTANDING.md โ Phase 1 ้กน็ฎ็่งฃ
โโโ P2-DFD-ANALYSIS.md โ Phase 2 DFDๅๆ
โโโ P3-TRUST-BOUNDARY.md โ Phase 3 ไฟกไปป่พน็
โโโ P4-SECURITY-DESIGN-REVIEW.md โ Phase 4 ๅฎๅ
จ่ฎพ่ฎก่ฏไผฐ
โโโ P5-STRIDE-THREATS.md โ Phase 5 STRIDEๅจ่ๅๆ
โโโ P6-RISK-VALIDATION.md โ Phase 6 ้ฃ้ฉ้ช่ฏ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโ .phase_working/ โ ้ถๆฎตไบง็ฉๅทฅไฝ็ฎๅฝ (้่)
โโโ _session_meta.yaml โ ไผ่ฏๅ
ๆฐๆฎ
โโโ P1-PROJECT-UNDERSTANDING.md โ Phase 1 ๅทฅไฝๆๆกฃ
โโโ P2-DFD-ANALYSIS.md โ Phase 2 ๅทฅไฝๆๆกฃ
โโโ P3-TRUST-BOUNDARY.md โ Phase 3 ๅทฅไฝๆๆกฃ
โโโ P4-SECURITY-DESIGN-REVIEW.md โ Phase 4 ๅทฅไฝๆๆกฃ
โโโ P5-STRIDE-THREATS.md โ Phase 5 ๅทฅไฝๆๆกฃ
โโโ P6-RISK-VALIDATION.md โ Phase 6 ๅทฅไฝๆๆกฃ
โโโ P7-MITIGATION-PLAN.md โ Phase 7 ๅทฅไฝๆๆกฃFile Naming Convention
Format: {PROJECT}-{REPORT_TYPE}.md
- PROJECT: ไป้กน็ฎๅๆๅ๏ผ่ฝฌๅคงๅ๏ผๆๅค30ๅญ็ฌฆ
- ๆ ผๅผ:
^[A-Z][A-Z0-9-]{0,29}$ - ็คบไพ:
OPEN-WEBUI,MY-PROJECT,STRIDE-DEMO
- ๆ ผๅผ:
- REPORT_TYPE: ๆ ๅๆฅๅ็ฑปๅ (ๅคงๅ)
| ๆฅๅ็ฑปๅ | ๅฟ ้ๆกไปถ | ๆไปถๅ็คบไพ |
|---|---|---|
| ้ฃ้ฉ่ฏไผฐๆฅๅ (ไธปๆฅๅ) | โ ๅง็ป | OPEN-WEBUI-RISK-ASSESSMENT-REPORT.md |
| ้ฃ้ฉๆธ ๅ | โ ๅง็ป | OPEN-WEBUI-RISK-INVENTORY.md |
| ็ผ่งฃๆชๆฝ | โ ๅง็ป | OPEN-WEBUI-MITIGATION-MEASURES.md |
| ๆธ้ๆต่ฏๆนๆก | โ ๅง็ป | OPEN-WEBUI-PENETRATION-TEST-PLAN.md |
| ๆถๆๅๆ | โช ๅฏ้ | OPEN-WEBUI-ARCHITECTURE-ANALYSIS.md |
| DFDๅพ | โช ๅฏ้ | OPEN-WEBUI-DFD-DIAGRAM.md |
| ๅ่งๆ ๅฐ | โช ๅฏ้ | OPEN-WEBUI-COMPLIANCE-MAPPING.md |
| ๆปๅป่ทฏๅพ | โช ๅฏ้ | OPEN-WEBUI-ATTACK-PATHS.md |
| ๆง่กๆ่ฆ | โช ๅฏ้ | OPEN-WEBUI-EXECUTIVE-SUMMARY.md |
ๅพไพ: โ ๅฟ ้ | โช ๅฏ้
Phase Output Persistence
ๆฏ้ถๆฎตๅฎๆๆถ:
- ๅฐ้ถๆฎต่พๅบๅๅ
ฅ
.phase_working/P{N}-*.md - ๆดๆฐ
_session_meta.yaml็phases_completed
ไผ่ฏๅ
ๆฐๆฎ (_session_meta.yaml):
session_id: "20260103-120000"
project_name: "OPEN-WEBUI"
project_path: "/path/to/project"
started_at: "2026-01-03T12:00:00+08:00"
phases_completed: [1, 2, 3] # ๅทฒๅฎๆ็้ถๆฎต
current_phase: 4
skill_version: "2.1.0"Session Recovery
ๆฐไผ่ฏๅฏๅจๆถๆฃๆฅ .phase_working/:
- ๅญๅจไธ
project_nameๅน้ โ ๆ็คบ: "็ปง็ปญไธๆฌกไผ่ฏ" ๆ "่ฆ็้ๆฐๅผๅง" - ๅญๅจไฝ
project_nameไธๅ โ ๆธ ็ฉบ็ฎๅฝ๏ผๅผๅงๆฐไผ่ฏ - ไธๅญๅจ โ ๅๅปบ็ฎๅฝ๏ผๅผๅงๆฐไผ่ฏ
่ฏฆ็ป่ง่: ่ง
WORKFLOW.mdPhase 8 ้จๅ
็คบไพ: ่งEXAMPLES.md
Language Adaptation Rules
ๅๅ: ่พๅบ่ฏญ่จ่ท้ไธไธๆ่ฏญ่จ๏ผ้ค้ๆพๅผๆๅฎใ
่ฏญ่จๆฃๆต้ป่พ
็จๆทๆไปค่ฏญ่จ โ ่พๅบ่ฏญ่จ
โโโ ไธญๆๆไปค/ไธไธๆ โ ไธญๆๆไปถๅ + ไธญๆๅ
ๅฎน
โโโ ่ฑๆๆไปค/ไธไธๆ โ ่ฑๆๆไปถๅ + ่ฑๆๅ
ๅฎน
โโโ ๅ
ถไป่ฏญ่จ โ ่ท้่ฏฅ่ฏญ่จ
โโโ --lang=xx ๆพๅผๆๅฎ โ ่ฆ็่ชๅจๆฃๆตๅฝฑๅ่ๅด
| ๅ ็ด | ่ฏญ่จ่ช้ๅบ | ็คบไพ (ไธญๆไธไธๆ) | ็คบไพ (่ฑๆไธไธๆ) |
|---|---|---|---|
| ๆฅๅๆไปถๅ | โ | ้กน็ฎ-้ฃ้ฉ่ฏไผฐๆฅๅ.md |
PROJECT-RISK-ASSESSMENT-REPORT.md |
| ้ถๆฎตไบง็ฉๆไปถๅ | โ | P1-้กน็ฎ็่งฃ.md |
P1-PROJECT-UNDERSTANDING.md |
| ๆฅๅๅ ๅฎน | โ | ไธญๆๆญฃๆ | English content |
| ็ฎๅฝๅ | โ | ้ฃ้ฉ่ฏไผฐๆฅๅ/ |
Risk_Assessment_Report/ |
| ๆจกๆฟๅ ไฝ็ฌฆ | โ | ไฟๆ่ฑๆ (ๅ ้จไฝฟ็จ) | ไฟๆ่ฑๆ |
ๆพๅผ่ฏญ่จๆๅฎ
# ๅผบๅถ่ฑๆ่พๅบ (ๅณไฝฟไธไธๆๆฏไธญๆ)
--lang=en
# ๅผบๅถไธญๆ่พๅบ (ๅณไฝฟไธไธๆๆฏ่ฑๆ)
--lang=zh
# ๆฏๆ็่ฏญ่จไปฃ็ : en, zh, ja, ko, es, fr, de, pt, ruๅฎ็ฐๆนๅผ
- ๆจกๆฟ: ไฟๆๅไธ่ฑๆๆจกๆฟ (assets/templates/*.template.md)
- ่ฝฌๆข: LLM ๆ นๆฎไธไธๆ่ฏญ่จๅฎๆถ็ฟป่ฏ่พๅบ
- ๆไปถๅๆ ๅฐ: ่งไธ่กจ
ๆไปถๅ่ฏญ่จๆ ๅฐ่กจ
| English (Default) | ไธญๆ | Franรงais | Espaรฑol |
|---|---|---|---|
RISK-ASSESSMENT-REPORT |
้ฃ้ฉ่ฏไผฐๆฅๅ |
RAPPORT-EVALUATION-RISQUES |
INFORME-EVALUACION-RIESGOS |
RISK-INVENTORY |
้ฃ้ฉๆธ
ๅ |
INVENTAIRE-RISQUES |
INVENTARIO-RIESGOS |
MITIGATION-MEASURES |
็ผ่งฃๆชๆฝ |
MESURES-ATTENUATION |
MEDIDAS-MITIGACION |
PENETRATION-TEST-PLAN |
ๆธ้ๆต่ฏๆนๆก |
PLAN-TEST-PENETRATION |
PLAN-PRUEBA-PENETRACION |
P1-PROJECT-UNDERSTANDING |
P1-้กน็ฎ็่งฃ |
P1-COMPREHENSION-PROJET |
P1-COMPRENSION-PROYECTO |
P2-DFD-ANALYSIS |
P2-ๆฐๆฎๆตๅๆ |
P2-ANALYSE-DFD |
P2-ANALISIS-DFD |
P3-TRUST-BOUNDARY |
P3-ไฟกไปป่พน็ |
P3-LIMITE-CONFIANCE |
P3-LIMITE-CONFIANZA |
P4-SECURITY-DESIGN-REVIEW |
P4-ๅฎๅ
จ่ฎพ่ฎก่ฏๅฎก |
P4-REVUE-CONCEPTION-SECURITE |
P4-REVISION-DISENO-SEGURIDAD |
P5-STRIDE-THREATS |
P5-STRIDEๅจ่ๅๆ |
P5-MENACES-STRIDE |
P5-AMENAZAS-STRIDE |
P6-RISK-VALIDATION |
P6-้ฃ้ฉ้ช่ฏ |
P6-VALIDATION-RISQUES |
P6-VALIDACION-RIESGOS |
Risk_Assessment_Report/ |
้ฃ้ฉ่ฏไผฐๆฅๅ/ |
Rapport_Evaluation_Risques/ |
Informe_Evaluacion_Riesgos/ |
ๆณจๆ: ๆๆฏๆฏ่ฏญ (STRIDE, DFD, CWE, CAPEC, ATT&CK) ไฟๆ่ฑๆไธ็ฟป่ฏใ
Skill Path Resolution
Issue: Scripts use relative paths scripts/unified_kb_query.py, but Claude may work in project root.
Solution: Resolve Skill installation path before executing scripts.
Path Detection Algorithm
Priority Order:
1. $SKILL_PATH environment variable (explicit override)
2. Script self-location (when running from skill directory)
3. Project-local paths (multi-platform):
- .claude/skills/{threat-modeling|skill-threat-modeling}/
- .agents/skills/{name}/ (Portable/XDG standard)
- .qwen/agents/{name}/ (Qwen Code)
- .codex/skills/{name}/ (OpenAI Codex)
- .github/skills/{name}/ (GitHub Copilot)
- .goose/skills/{name}/ (Goose)
4. Global paths (multi-platform):
- ~/.claude/skills/{name}/
- ~/.config/agents/skills/{name}/ (XDG Portable)
- ~/.qwen/agents/{name}/
- ~/.codex/skills/{name}/
- ~/.config/goose/skills/{name}/Supported Directory Names: threat-modeling, skill-threat-modeling (both work)
Claude Invocation Pattern
Step 1: Detect and cache SKILL_PATH at session start:
# Use the skill_path.sh helper (recommended - supports all platforms)
SKILL_PATH=$(bash skill_path.sh)
# Or set environment variable explicitly
export SKILL_PATH=/path/to/skill-threat-modelingStep 2: Execute scripts using detected path:
# Standard invocation pattern
python "$SKILL_PATH/scripts/unified_kb_query.py" --stride spoofing
# Or cd to skill directory
cd "$SKILL_PATH" && python scripts/unified_kb_query.py --stride spoofingShortcut 1: kb wrapper (Recommended)
Skill includes kb wrapper script for invocation from any directory:
# Use absolute path to invoke kb wrapper
$SKILL_PATH/kb --stride spoofing
$SKILL_PATH/kb --full-chain CWE-89
$SKILL_PATH/kb --all-llm
# Or add to PATH
export PATH="$SKILL_PATH:$PATH"
kb --stride spoofingShortcut 2: skill_path.sh
Get skill path for other operations:
# Get skill path
SKILL_PATH=$(bash skill_path.sh)
# One-liner invocation
python "$(bash skill_path.sh)/scripts/unified_kb_query.py" --stride spoofingDevelopment Mode
Use source path directly during development:
# Development path (non-installed mode)
cd /path/to/threat-modeling
python scripts/unified_kb_query.py --stride spoofingScript Invocation Convention
All python scripts/unified_kb_query.py ... examples in this document assume:
cd $SKILL_PATHhas been executed, or- Use
$SKILL_PATH/kb ...as replacement
Claude should detect SKILL_PATH at session start and use kb wrapper or cd mode.
Security Knowledge Architecture
Three Knowledge Sets
The security knowledge system consists of three complementary sets:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Security Knowledge Architecture โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Security Principles โ โ
โ โ (Foundation - Guides All Phases) โ โ
โ โ DID โ LP โ ZT โ FS โ SOD โ SBD โ CM โ EOM โ OD โ IV โ LA โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Security Control Set โ โ Threat Pattern Set โ โ
โ โ (What to do & How to do) โ โ (What to know & Validate) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
โ โ Security Domains (16) โ โ CWE Weakness Types (974) โ โ
โ โ โ โ โ โ โ โ
โ โ โผ โ โ โผ โ โ
โ โ Control Sets (18 files, 107) โ โ CAPEC Attack Patterns (615) โ โ
โ โ โ โ โ โ โ โ
โ โ โผ โ โ โผ โ โ
โ โ OWASP References (74) โ โ ATT&CK Techniques (835) โ โ
โ โ โ โ โ โ โ โ
โ โ โผ โ โ โผ โ โ
โ โ Compliance Frameworks (14) โ โ CVE/KEV Vulnerabilities (323K+) โ โ
โ โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ Verification Set โ โ โ
โ โ โ (How to verify & test) โ โ โ
โ โโโโโโโถโ โโโโโโโโโโ โ
โ โ WSTG Tests (121) โ โ
โ โ MASTG Tests (206) โ โ
โ โ ASVS Requirements (345) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ Used in: Phase 6 / Phase 7 / Phase 8 โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโSecurity Principles (11)
Core security principles that guide all security design decisions across all 8 phases.
| Code | Principle | Definition |
|---|---|---|
| DID | Defense in Depth | Multiple independent security controls; single point failure doesn't compromise system |
| LP | Least Privilege | Grant only minimum permissions required to complete task |
| ZT | Zero Trust | Never trust, always verify; assume network is compromised |
| FS | Fail Secure | Default to most secure state on error |
| SOD | Separation of Duties | Critical operations require multiple parties; prevent single-person abuse |
| SBD | Secure by Default | Default configuration is secure; user must actively reduce security |
| CM | Complete Mediation | Every access must be verified; no bypass paths |
| EOM | Economy of Mechanism | Security mechanisms should be simple and auditable; complexity is security's enemy |
| OD | Open Design | Security doesn't depend on algorithm or design secrecy |
| IV | Input Validation | All input must be validated before processing; default deny |
| LA | Least Agency | Limit AI agent autonomy, tool access, and decision scope to minimum required |
Phase References:
- Phase 1: DID, LP, ZT, LA (architecture assessment, agent scope)
- Phase 2: CM, IV, ZT (data flow security)
- Phase 3: ZT, SOD, LP, LA (trust boundaries, agent boundaries)
- Phase 4: All 11 principles (security function completeness)
Detailed definitions in
assets/knowledge/security-principles.yaml
Security Control Set
Defines "what to do" and "how to do it" from a defensive perspective.
Security Domains โโโถ Control Sets โโโถ OWASP References โโโถ Compliance Frameworks
โ โ โ โ
security- control-set- reference-set- YAML + SQLite
design.yaml *.md *.md (compliance tables)Security Domains (16 total):
| Seq | Code | Name | STRIDE | Description |
|---|---|---|---|---|
| 01 | AUTHN | Authentication & Session | S | Identity verification and session lifecycle |
| 02 | AUTHZ | Authorization & Access Control | E | Access permission enforcement |
| 03 | INPUT | Input Validation | T | External input validation and sanitization |
| 04 | OUTPUT | Output Encoding | T,I | Context-aware output encoding |
| 05 | CLIENT | Client-Side Security | S,T,I | Browser and client-side security |
| 06 | CRYPTO | Cryptography & Transport | I | Data encryption in transit and at rest |
| 07 | LOG | Logging & Monitoring | R | Security event logging and audit |
| 08 | ERROR | Error Handling | I | Secure error handling and information control |
| 09 | API | API & Service Security | S,T,I,D,E | API endpoint and service communication security |
| 10 | DATA | Data Protection | I | Sensitive data and credential protection |
| ext-11 | INFRA | Infrastructure Security | - | Container and orchestration security |
| ext-12 | SUPPLY | Supply Chain Security | - | Dependency and pipeline security |
| ext-13 | AI | AI/LLM Security | - | LLM-specific threats (OWASP LLM Top 10) |
| ext-14 | MOBILE | Mobile Security | - | Mobile app security |
| ext-15 | CLOUD | Cloud Security | - | Cloud-native security controls |
| ext-16 | AGENT | Agentic Security | S,T,R,I,D,E | AI Agent security (OWASP Agentic Top 10) |
Threat Pattern Set
Defines "what to know" and "what to validate" from an offensive perspective.
CWE Weaknesses โโโถ CAPEC Patterns โโโถ ATT&CK Techniques โโโถ CVE/KEV Vulnerabilities
โ โ โ โ
SQLite:cwe SQLite:capec SQLite:attack_* SQLite:cve + API
(974 entries) (615 entries) (835 entries) (323K+ entries)STRIDE to CWE Mapping:
| STRIDE | Primary CWEs | Attack Patterns |
|---|---|---|
| S (Spoofing) | CWE-287, 290, 307 | CAPEC-151, 194, 600 |
| T (Tampering) | CWE-20, 77, 78, 89 | CAPEC-66, 88, 248 |
| R (Repudiation) | CWE-117, 223, 778 | CAPEC-93 |
| I (Information Disclosure) | CWE-200, 209, 311 | CAPEC-116, 157 |
| D (Denial of Service) | CWE-400, 770, 918 | CAPEC-125, 227 |
| E (Elevation of Privilege) | CWE-269, 284, 862 | CAPEC-122, 233 |
Verification Set (Cross-Cutting)
Bridges Security Control Set and Threat Pattern Set, providing test procedures for Phase 6/7/8.
| Component | Tests/Requirements | Usage |
|---|---|---|
| WSTG (Web Security Testing Guide) | 121 tests | Phase 6: Risk validation |
| MASTG (Mobile App Security Testing Guide) | 206 tests | Phase 6: Mobile risk validation |
| ASVS (Application Security Verification Standard) | 345 requirements | Phase 7-8: Mitigation & compliance |
STRIDE to Verification Mapping:
| STRIDE | Verification Categories | Test Count |
|---|---|---|
| S (Spoofing) | WSTG-ATHN/IDNT/SESS, MASTG-AUTH, ASVS-V6/V7/V9/V10 | 240 |
| T (Tampering) | WSTG-INPV/CONF/CLNT, MASTG-PLATFORM/RESILIENCE, ASVS-V1/V2/V3 | 402 |
| R (Repudiation) | WSTG-BUSL, ASVS-V7/V16 | 46 |
| I (Information Disclosure) | WSTG-INFO/ERRH/CRYP, MASTG-STORAGE/NETWORK, ASVS-V11/V12/V14 | 442 |
| D (Denial of Service) | WSTG-BUSL/APIT, MASTG-RESILIENCE | 49 |
| E (Elevation of Privilege) | WSTG-AUTHZ, MASTG-PLATFORM, ASVS-V8 | 90 |
| Total | All verification tests mapped to STRIDE | 1,269 |
8-Phase Workflow Overview
| Phase | Name | Type | Knowledge Sets Used | Key Output |
|---|---|---|---|---|
| 1 | Project Understanding | Exploratory | Security Principles | findings_1: project_context |
| 2 | Call Flow & DFD | Constructive | Principles + security-design.yaml | findings_2: dfd_elements |
| 3 | Trust Boundaries | Evaluative | Principles + security-design.yaml | findings_3: boundary_context |
| 4 | Security Design | Evaluative | Control Sets + References | findings_4: security_gaps |
| 5 | STRIDE Analysis | Enumerative | CWE โ CAPEC (Threat Pattern Set) | findings_5: threat_inventory |
| 6 | Risk Validation | Verification | Threat Pattern Set + Verification Set | validated_risks |
| 7 | Mitigation | Prescriptive | Control Sets + CWE Mitigations + ASVS | mitigation_plan |
| 8 | Report | Comprehensive | All outputs + Compliance + ASVS | RISK-ASSESSMENT-REPORT.md |
Core Data Model (ๆ ธๅฟๆฐๆฎๆจกๅ) โ ๏ธ CRITICAL
Design Principle: ไปๆฐๆฎๆตๅจๅ่ฝฌๆข็ๆฌ่ดจๅบๅ๏ผๅฎไนๆธ ๆฐ็ๅฎไฝใๅ ณ็ณปๅ่ฝฌๆข่งๅ
Entity Definitions (ๅฎไฝๅฎไน)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Core Entity Model โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Finding (ๅ็ฐ) โ โ
โ โ โโโโโโโโโโโโโโโโโ โ โ
โ โ ๆฅๆบ: Phase 1-4 โ โ
โ โ ID: F-P{N}-{Seq} ไพ: F-P1-001, F-P4-003 โ โ
โ โ ๆง่ดจ: ๅฎๅ
จ็ธๅ
ณ็่งๅฏใ็ผบ้ทใ้ฃ้ฉ็น โ โ
โ โ ๆฐ้: ้ๅธธ 10-30 ไธช โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ (่พๅ
ฅ Phase 5) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Threat (ๅจ่) โ โ
โ โ โโโโโโโโโโโโโโโโโ โ โ
โ โ ๆฅๆบ: Phase 5 STRIDE ๅๆ โ โ
โ โ ID: T-{STRIDE}-{ElementID}-{Seq} ไพ: T-T-P13-002 โ โ
โ โ ๆง่ดจ: ้ๅฏน DFD ๅ
็ด ็ๆฝๅจๆปๅปๅ้ โ โ
โ โ ๆฐ้: ้ๅธธ 50-200 ไธช (ๆฏๅ
็ด ๅคไธช) โ โ
โ โ ็ถๆ: identified (ๅทฒ่ฏๅซ) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ (้ช่ฏ Phase 6) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ValidatedRisk (้ช่ฏ้ฃ้ฉ) โ โ
โ โ โโโโโโโโโโโโโโโโโ โ โ
โ โ ๆฅๆบ: Phase 6 ้ฃ้ฉ้ช่ฏ โ โ
โ โ ID: VR-{Seq} ไพ: VR-001 โ โ
โ โ ๆง่ดจ: ็ป่ฟ้ช่ฏ็ใๅฏๅฉ็จ็้ฃ้ฉ โ โ
โ โ ๆฐ้: ้ๅธธ 5-30 ไธช (ๅจ่ๅๅนถ/่ฟๆปคๅ) โ โ
โ โ โ ๏ธ ๅฟ
ๅกซ: threat_refs[] ่ฟฝๆบฏๅฐๅๅงๅจ่ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ (็ผ่งฃ Phase 7) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Mitigation (็ผ่งฃๆชๆฝ) โ โ
โ โ โโโโโโโโโโโโโโโโโ โ โ
โ โ ๆฅๆบ: Phase 7 ็ผ่งฃ่งๅ โ โ
โ โ ID: M-{Seq} ไพ: M-001 โ โ
โ โ ๆง่ดจ: ้ๅฏน้ช่ฏ้ฃ้ฉ็ไฟฎๅคๆนๆก โ โ
โ โ ๆฐ้: ้ๅธธ 5-20 ไธช (ๅฏไธๅฏนๅค) โ โ
โ โ ๅ
ๅซ: risk_refs[] ่ฟฝๆบฏๅฐ้ช่ฏ้ฃ้ฉ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโEntity Relationships (ๅฎไฝๅ ณ็ณป)
DFD Element 1:N โโโโโโโโโโโโ
(P01, DS01, DF01...) โโโโโโโโโโโโโโโโโโโโโโถโ Threat โ
โ (T-xxx) โ
โโโโโโฌโโโโโโ
โ
โ N:1 (ๅๅนถ)
โผ
โโโโโโโโโโโโโโโโโโโ
Finding โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโถโ ValidatedRisk โ
(F-xxx) ๅๅนถ โ (VR-xxx) โ
โ โ
โ threat_refs: โ
โ [T-T-P13-001, โ
โ T-T-P13-002, โ
โ T-E-P13-001] โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โ N:1 (่ฆ็)
โผ
โโโโโโโโโโโโโโโโโโโ
โ Mitigation โ
โ (M-xxx) โ
โ โ
โ risk_refs: โ
โ [VR-001, โ
โ VR-002] โ
โโโโโโโโโโโโโโโโโโโ
ๅ
ณ้ฎๅ
ณ็ณป:
โข Threat N:1 ValidatedRisk (ๅคๅจ่ๅๅนถไธบไธไธช้ฃ้ฉ)
โข ValidatedRisk N:1 Mitigation (ๅค้ฃ้ฉๅฏ่ขซๅไธๆชๆฝ่ฆ็)
โข ๆๆๅ
ณ็ณป้่ฟ *_refs[] ๆพๅผ่ฟฝๆบฏUnified ID Convention (็ปไธID่ง่)
| ๅฎไฝ็ฑปๅ | ID ๆ ผๅผ | ็คบไพ | ้ถๆฎต |
|---|---|---|---|
| Finding | F-P{N}-{Seq:03d} | F-P1-001 | P1-P4 |
| Threat | T-{STRIDE}-{Element}-{Seq} | T-T-P13-002 | P5 |
| ValidatedRisk | VR-{Seq:03d} | VR-001 | P6 |
| Mitigation | M-{Seq:03d} | M-001 | P7 |
| POC | POC-{Seq:03d} | POC-001 | P6 |
| AttackPath | AP-{Seq:03d} | AP-001 | P6 |
| AttackChain | AC-{Seq:03d} | AC-001 | P6 |
โ ็ฆๆญข็ ID ๆ ผๅผ (ไธๅไฝฟ็จ):
RISK-{Seq}โ ๆน็จVR-{Seq}T-E-RCE-001โ ๆน็จT-E-P13-001(ไฟ็ ElementID)SD-{Seq}โ ๆน็จF-P4-{Seq}
Count Conservation Rules (ๆฐ้ๅฎๆ่งๅ) โ ๏ธ CRITICAL
# ๅจ่ๅค็ๅฎๆๅ
ฌๅผ
count_conservation:
p5_output: "threat_inventory.total = T" # ไพ: 120
p6_processing:
verified: V # ้ช่ฏ็กฎ่ฎค็ๅจ่ๆฐ
theoretical: Th # ็่ฎบๅฏ่ก็ๅจ่ๆฐ
pending: P # ๅพ
้ช่ฏ็ๅจ่ๆฐ
excluded: E # ๆ้ค็ๅจ่ๆฐ (ๆ็็ฑ)
conservation_formula: "V + Th + P + E = T"
traceability_rule: |
FOR each threat T in p5_output:
T MUST appear in exactly one VR.threat_refs[]
OR T.status = 'excluded' with documented reason
report_consistency:
RISK-INVENTORY.count = "len(VR where status != 'excluded')"
MAIN-REPORT.risk_count = "RISK-INVENTORY.count"
# ้ช่ฏๆฃๆฅ็น
checkpoints:
cp1_p5_to_p6: "P6.input_count = P5.threat_inventory.summary.total"
cp2_p6_output: "sum(verified, theoretical, pending, excluded) = input_count"
cp3_report_gen: "RISK-INVENTORY.count = P6.final_risk_count"ValidatedRisk Structure (้ช่ฏ้ฃ้ฉๆฐๆฎ็ปๆ)
ValidatedRisk:
# === ๆ ่ฏ ===
id:
format: "VR-{Seq:03d}"
example: "VR-001"
# === ่ฟฝๆบฏ (MANDATORY!) ===
threat_refs:
type: array[Threat.id]
description: "ๆญค้ฃ้ฉๆฅๆบ็ๆๆๅจ่ ID"
example: ["T-T-P13-001", "T-T-P13-002", "T-E-P13-001"]
requirement: "MANDATORY - ๅฟ
้กปๅๅบๆๆๆบๅจ่"
finding_refs:
type: array[Finding.id]
description: "ๆญค้ฃ้ฉๆฅๆบ็ P1-P4 ๅ็ฐ"
example: ["F-P4-003"]
requirement: "OPTIONAL - ๅฆๆๅ
ณ่ๅ็ฐ"
# === ้ฃ้ฉ่ฏไผฐ ===
severity:
cvss_score: float # 0.0-10.0
priority: "P0|P1|P2|P3"
stride_types: ["T", "E"] # ๅฏๅ
ๅซๅคไธช STRIDE ็ฑปๅ
# === ้ช่ฏ็ถๆ ===
validation:
status: "verified|theoretical|pending|excluded"
poc_available: boolean
poc_id: "POC-{Seq}" # ๅฆๆ POC่ฏฆ็ป่ฎพ่ฎก: ่ง
tmp_data/DATA-ARCHITECTURE-DESIGN.md
Phase Data Flow
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Phase Data Flow Architecture โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Phase 1 Phase 2 Phase 3 Phase 4 Phase 5 โ
โ โโโโโโโ โโโโโโโ โโโโโโโ โโโโโโโ โโโโโโโ โ
โ โ P1 โโfindings1โโถโ P2 โโfindings2โโถโ P3 โโfindings3โโถโ P4 โโfindings4โโถโ P5 โ โ
โ โโโโฌโโโ โโโโฌโโโ โโโโฌโโโ โโโโฌโโโ โโโโฌโโโ โ
โ โ โผ โผ โ โ โ
โ โ security- security- โ โ โ
โ โ design.yaml design.yaml โ โ โ
โ โ โผ โผ โ
โ โ control-set-*.md CWE โ CAPEC โ
โ โ reference-set-*.md โ
โ โผ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Phase 6: Risk Validation โ โ
โ โ INPUT: findings_1 + findings_2 + findings_3 + findings_4 + findings_5 โ โ
โ โ (ALL issues consolidated and deduplicated) โ โ
โ โ KNOWLEDGE: CAPEC โ ATT&CK โ CVE/KEV + WSTG + MASTG โ โ
โ โ OUTPUT: validated_risks โ โ
โ โ โโโ risk_summary (counts, categorization) โ โ
โ โ โโโ risk_details (per-item: location, analysis, root cause, test cases) โ โ
โ โ โโโ attack_paths (chains, step-by-step with commands/POC) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Phase 7: Mitigation Planning โ โ
โ โ INPUT: validated_risks (complete Phase 6 output) โ โ
โ โ KNOWLEDGE: Control Sets + OWASP References + CWE Mitigations + ASVS โ โ
โ โ OUTPUT: mitigation_plan (per-risk: immediate, short-term, long-term) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Phase 8: Report Generation โ โ
โ โ INPUT: ALL phase outputs (findings_1 โ mitigation_plan) โ โ
โ โ KNOWLEDGE: Compliance Frameworks + ASVS โ โ
โ โ CRITICAL: Must include COMPLETE Phase 6 and Phase 7 outputs (no omission) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโPhase Context Protocol
Core Principle: Each phase must explicitly declare Input Context and Output Context for cross-phase data continuity.
| Phase | Context Name | Key Fields |
|---|---|---|
| P1โP2 | project_context |
project_type, modules[], integrations[], security_design{} |
| P2โP3 | dfd_elements |
elements[{id,type,name}], flows[{id,source,target,data}], dfd_diagram |
| P3โP4 | boundary_context |
boundaries[], interfaces[], data_nodes[], cross_boundary_flows[] |
| P4โP5 | security_gaps |
gaps[{domain,severity,description}], design_matrix{} |
| P5โP6 | threat_inventory |
threats[{id,element_id,stride,cwe,priority}] |
| P6โP7 | validated_risks |
risk_summary{}, risk_details[], attack_paths[] |
| P7โP8 | mitigation_plan |
mitigations[{risk_id,measures,implementation}], roadmap{} |
Element ID Naming Convention
DFD Element ID Format (Phase 2 generates, subsequent phases must reference):
| Element Type | Prefix | Format | Example |
|---|---|---|---|
| External Interactor | EI | EI{NN} | EI01, EI02 |
| Process | P | P{NN} | P01, P02, P03 |
| Data Store | DS | DS{NN} | DS01, DS02 |
| Data Flow | DF | DF{NN} | DF01, DF02 |
| Trust Boundary | TB | TB{NN} | TB01, TB02 |
Threat ID Format (Phase 5 generates):
T-{STRIDE}-{ElementID}-{Seq}- STRIDE: S/T/R/I/D/E (single letter)
- ElementID: From P2 element ID
- Seq: Three-digit sequence (001-999)
- Example:
T-S-P01-001(First Spoofing threat for Process 01)
Phase Details
Phase 1: Project Understanding
1.1 Core Analysis Goal
Goal: Comprehensively understand project architecture, functional modules, tech stack, and security design decisions.
This is an exploratory task where LLM needs to understand overall project structure through code reading.
1.2 Input Context
Input: Project path/codebase
1.3 Knowledge Reference
Security Principles: assets/knowledge/security-principles.yaml
- Evaluate if project embodies core security principles (DID, LP, ZT)
- Identify obvious security design flaws
1.4 Script Support
# Get project structure with type detection
python $SKILL_PATH/scripts/list_files.py <path> --categorize --detect-type --pretty1.5 Output Context
โ P2: project_context {project_type, modules[], integrations[], security_design{}}
Required Output:
## Project Summary
- Project Type: [Web/API/Microservice/AI-LLM/Hybrid]
- Primary Language: [Language]
- Framework: [Frameworks]
## Functional Description
- Core Functions: [...]
- User Roles: [...]
## Major Modules
| Module | Responsibility | Location |
|--------|---------------|----------|
## Key Security Design
- Authentication: [...]
- Data Storage: [...]
- External Integrations: [...]Scenario Confirmation (based on Phase 1 analysis):
| Scenario Type | Trigger Condition | Enable Extension |
|---|---|---|
| Standard Web/API | No AI/No Cloud-Native | Standard STRIDE flow |
| AI/LLM Application | Model calls/RAG/Prompt processing detected | --all-llm, --ai-component |
| Cloud-Native App | AWS/Azure/GCP/K8s detected | --cloud {provider} |
| Microservices | Multi-service/Docker/K8s | Cross-service threat analysis |
| Hybrid | Multiple features | Combined extensions |
Checkpoint: Summarize and reflect before Phase 2.
Phase 2: Call Flow & DFD
2.1 Core Analysis Goal
Goal: Build Data Flow Diagram (DFD), trace complete data path from entry to storage.
This is a constructive task where LLM needs to understand code call relationships and visualize data flow.
2.2 Input Context
โ P1: project_context
2.3 Knowledge Reference
Security Principles: assets/knowledge/security-principles.yaml
- Apply Complete Mediation (CM) to identify access checkpoints
- Apply Input Validation (IV) to mark validation points
Security Design: assets/knowledge/security-design.yaml
- Reference 16 security domains to identify security-relevant DFD elements
2.4 Output Context
โ P3: dfd_elements {elements[], flows[], dfd_diagram, dfd_issues[]}
Output Requirements:
- ASCII DFD diagram (in body)
- Mermaid DFD source (in appendix)
- Element inventory table
Checkpoint: Summarize and reflect before Phase 3.
Phase 3: Trust Boundaries
3.1 Core Analysis Goal
Goal: Based on DFD, identify trust boundaries, key interfaces, and data nodes; evaluate security posture.
This is an evaluative task where LLM needs to identify security boundaries and assess cross-boundary risks.
3.2 Input Context
โ P1/P2: project_context, dfd_elements
3.3 Knowledge Reference
Security Principles: Apply ZT, SOD, LP principles
Security Design: assets/knowledge/security-design.yaml - AUTHN, AUTHZ, API domains
3.4 Output Context
โ P4: boundary_context {boundaries[], interfaces[], data_nodes[], boundary_issues[]}
Checkpoint: Summarize and reflect before Phase 4.
Phase 4: Security Design Assessment
4.1 Core Analysis Goal
Goal: Evaluate project's design maturity across all security domains, identify gaps.
This is an evaluative task requiring LLM to understand code security implementation and compare with best practices.
4.2 Input Context
โ P1/P2/P3: All cumulative findings
4.3 Knowledge Reference (Progressive Loading)
- Load
security-design.yaml- Get all 16 domains with core requirements - For each relevant domain, load corresponding
control-set-*.md - When specific implementation details needed, load
reference-set-*.md
Query Commands:
# Get security domain details
$SKILL_PATH/kb --control authentication
$SKILL_PATH/kb --stride-controls S4.4 Output Context
โ P5: security_gaps {gaps[], design_matrix{}}
Required Output:
## Security Design Assessment Matrix
| Domain | Current Implementation | Assessment | Gap | Risk Level | KB Reference |
|--------|----------------------|------------|-----|------------|--------------|
| AUTHN | [...] | Yes/No/Partial | [...] | High/Medium/Low | control-set-01 |Checkpoint: Summarize and reflect before Phase 5.
Phase 5: STRIDE Analysis
5.1 Core Analysis Goal
Goal: Apply STRIDE method to DFD elements, generate complete threat inventory.
This is an enumerative task where LLM systematically identifies potential threats for each element.
5.2 Input Context
โ P2/P4: dfd_elements, security_gaps
5.3 Knowledge Reference
Threat Pattern Set: CWE โ CAPEC mapping
Query Commands:
$SKILL_PATH/kb --stride spoofing # STRIDE category details
$SKILL_PATH/kb --full-chain CWE-XXX # Complete chain: STRIDEโCWEโCAPECโATT&CK
$SKILL_PATH/kb --all-llm # LLM threats (AI components)5.4 STRIDE per Element Matrix
| Element Type | Applicable STRIDE |
|---|---|
| Process | S, T, R, I, D, E (all 6) |
| Data Store | T, R, I, D |
| Data Flow | T, I, D |
| External Entity (as source) | S, R |
5.5 Output Context
โ P6: threat_inventory {threats[{id, element_id, stride, cwe, priority}]}
Checkpoint: Summarize and reflect before Phase 6.
Phase 6: Risk Validation
๐ Detailed Workflow: See
@VALIDATION.mdfor complete Phase 6 workflow, consolidation process, and POC templates.
6.1 Core Analysis Goal
Goal: Consolidate ALL findings from P1-P5, perform deep validation, design attack paths and POC.
This is a verification task where LLM thinks from attacker's perspective.
6.2 Input Context
โ ALL P1-P5: findings_1 + findings_2 + findings_3 + findings_4 + findings_5
CRITICAL: Phase 6 must consolidate ALL previous findings, not just Phase 5 threats.
6.3 Knowledge Reference
Threat Pattern Set: CAPEC โ ATT&CK โ CVE/KEV
Verification Set: WSTG + MASTG (test generation)
Query Commands:
# Attack path analysis
$SKILL_PATH/kb --capec CAPEC-XXX --attack-chain
$SKILL_PATH/kb --attack-technique TXXX
$SKILL_PATH/kb --check-kev CVE-XXXX
# Verification tests
$SKILL_PATH/kb --stride-tests S # STRIDE category tests
$SKILL_PATH/kb --cwe-tests CWE-89 # CWE-specific tests
$SKILL_PATH/kb --wstg-category ATHN # WSTG tests by category6.4 Output Structure (5 Parts)
Schema Reference:
assets/schemas/risk-detail.schema.mddefines complete risk detail format.
Template Reference:assets/templates/RISK-ASSESSMENT-REPORT.template.mdSection 5-6 for output format.
Priority Mapping (from schema):
| CVSS ่ฏๅ | ไธฅ้็จๅบฆ | ไผๅ ็บง | ่กๅจ่ฆๆฑ |
|---|---|---|---|
| 9.0 - 10.0 | Critical | P0 | ็ซๅณไฟฎๅค |
| 7.0 - 8.9 | High | P1 | ็ดงๆฅๅค็ (24h) |
| 4.0 - 6.9 | Medium | P2 | ้ซไผๅ ็บง (7d) |
| 0.1 - 3.9 | Low | P3 | ่ฎกๅไธญ (30d) |
POC Verification Status Types:
| ็ถๆๆ ่ฏ | ๅซไน | ๅคๅฎๆ ๅ |
|---|---|---|
| โ ๅทฒ้ช่ฏ | POC ๆง่กๆๅ | ๆๅๅค็ฐๆปๅป่กไธบๅนถ่ทๅพ้ขๆ็ปๆ |
| โ ๏ธ ้้ช่ฏ | ็่ฎบๅฏ่กไฝ้ๆๅจ้ช่ฏ | ้่ฆ็นๅฎ็ฏๅขๆๆ้ๆ่ฝ้ช่ฏ |
| ๐ ็่ฎบๅฏ่ก | ๅบไบไปฃ็ ๅๆๆจๅฏผ | ไปฃ็ ่ทฏๅพๅญๅจไฝๆชๅฎ้ ๆต่ฏ |
| โ ๅทฒๆ้ค | ้ช่ฏๅ็กฎ่ฎคไธๅฏๅฉ็จ | ๅญๅจ็ผ่งฃๆชๆฝๆๆกไปถไธๆปก่ถณ |
validated_risks:
# Part 1: Risk Summary (้ช่ฏ่ฆ็็ป่ฎก)
risk_summary:
total_identified: N
total_verified: N # โ
ๅทฒ้ช่ฏ
total_pending: N # โ ๏ธ ้้ช่ฏ
total_theoretical: N # ๐ ็่ฎบๅฏ่ก
total_excluded: N # โ ๅทฒๆ้ค
verification_rate: "N%"
risk_by_severity: {critical: N, high: N, medium: N, low: N}
risk_by_stride: {S: N, T: N, R: N, I: N, D: N, E: N}
# Part 2: POC Details (ๆฏไธช Critical/High ๅจ่ไธไธชๅฎๆดๅ)
poc_details:
- poc_id: "POC-001" # Format: POC-{SEQ:03d}
threat_ref: "T-S-P01-001" # ๅ
ณ่ๅจ่ID
stride_type: "S" # STRIDE็ฑปๅ
verification_status: "verified" # verified|pending|theoretical|excluded
exploitation_difficulty: "medium" # low|medium|high
prerequisites: # ๅ็ฝฎๆกไปถ
- "ๆๆ็็จๆทไผ่ฏ"
- "็ฅ้็ฎๆ ็จๆทID"
vulnerability_location:
file_path: "src/api/auth.py"
function_name: "verify_token"
line_number: 45
vulnerable_code: | # ๆผๆดไปฃ็ ็ๆฎต
def verify_token(token):
# ็ผบๅฐ็ญพๅ้ช่ฏ
return jwt.decode(token, options={"verify_signature": False})
exploitation_steps: # ๅฉ็จๆญฅ้ชค
- "ๆ้ ๆถๆJWT Token"
- "ๅ้่ฏทๆฑๅฐ่ฎค่ฏ็ซฏ็น"
- "็ป่ฟ่บซไปฝ้ช่ฏ"
poc_code: | # POCไปฃ็ (ๅฎๆดๅฏๆง่ก)
import jwt
# ๆ้ ๆถๆtoken
malicious_token = jwt.encode({"user_id": "admin"}, "any_key", algorithm="HS256")
# ๅ้่ฏทๆฑ...
expected_result: | # ้ขๆ็ปๆ
{"status": "authenticated", "user": "admin"}
verification_log: "..." # ้ช่ฏๆฅๅฟ/ๆชๅพ
risk_assessment:
complexity: "medium"
attack_vector: "network"
impact_scope: "user_data"
data_sensitivity: "high"
# Part 3: Risk Details (per item) - See assets/schemas/risk-detail.schema.md
risk_details:
- risk_id: "VR-001" # Format: VR-{SEQ:03d}
original_refs: ["T-S-P01-001", "SD-001"] # From multiple phases
priority: "P1" # P0/P1/P2/P3
location: {files: [], elements: [], trust_boundary: ""}
detailed_analysis: {...}
root_cause: {...}
related_cwe: "CWE-XXX" # Required field
related_poc: "POC-001" # Link to POC detail
validation:
test_cases: []
poc_available: true
cvss_score: 8.8
verification_status: "verified"
# Part 4: Attack Path Feasibility Matrix (ๅฏ่กๆง่ฏๅ)
attack_path_matrix:
- path_id: "AP-001"
path_name: "่ฎค่ฏ็ป่ฟโๆฐๆฎๅบ่ฎฟ้ฎ"
entry_point: "API Gateway"
key_nodes: ["Auth Service"]
final_target: "ๆฐๆฎๅบ"
feasibility_score: 8.5 # 0.0-10.0
detection_difficulty: "low" # low|medium|high
priority_fix: true
# Part 5: Attack Chains (ๅฎๆดๆปๅป้พๅๆ)
attack_chains:
- chain_id: "AC-001"
chain_name: "ๆ้ๆๅๆปๅป้พ"
entry_point: "ๅ
ฌๅ
ฑAPI็ซฏ็น"
target: "็ฎก็ๅๆ้"
impact_scope: "ๅฎๅ
จ็ณป็ปๆงๅถ"
difficulty: "medium"
related_threats: ["T-E-P01-001", "T-S-P02-001"]
steps:
- step: 1
title: "ๅๅง่ฎฟ้ฎ"
source: "ๆปๅป่
"
target: "API็ฝๅ
ณ"
action: "ๅ้ๆถๆ่ฏทๆฑ"
code_location: "api/routes.py:120"
data_change: "่ทๅพไผ่ฏtoken"
- step: 2
title: "ๆ้ๆๅ"
source: "API็ฝๅ
ณ"
target: "่ฎค่ฏๆๅก"
action: "ๅฉ็จJWTๆผๆด"
code_location: "auth/jwt.py:45"
data_change: "่ทๅพ็ฎก็ๅ่ง่ฒ"
# ASCII ๆปๅป้พๅพ (ๅฟ
้กปๅจๆฅๅไธญๅฑ็คบ)
attack_flow_diagram: |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๆปๅป้พ: ๆ้ๆๅๆปๅป โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Step 1: ๅๅง่ฎฟ้ฎ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๆปๅป่
โโโ API็ฝๅ
ณ โ โ
โ โ ๅจไฝ: ๅ้ๆถๆ่ฏทๆฑ โ โ
โ โ ไปฃ็ ไฝ็ฝฎ: api/routes.py:120 โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ Step 2: ๆ้ๆๅ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ API็ฝๅ
ณ โโโ ่ฎค่ฏๆๅก โ โ
โ โ ๅจไฝ: ๅฉ็จJWTๆผๆด่ทๅพ็ฎก็ๅ่ง่ฒ โ โ
โ โ ไปฃ็ ไฝ็ฝฎ: auth/jwt.py:45 โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ ็ปๆ: ่ทๅพ็ฎก็ๅๆ้๏ผๅฎๅ
จ็ณป็ปๆงๅถ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
prerequisites:
- "็ฝ็ป่ฎฟ้ฎๆ้"
- "ๅบ็ก็จๆท่ดฆๆท"
exploitation_commands: |
# Step 1: ่ทๅๅๅงtoken
curl -X POST https://target/api/login -d '{"user":"test","pass":"test"}'
# Step 2: ๆ้ ๆๆtoken
python3 jwt_exploit.py --token $TOKEN --role admin
ioc_indicators:
- "ๅผๅธธ็JWT token็ปๆ"
- "็ญๆถ้ดๅ
่ง่ฒๅๆด"
defense_recommendations:
- cutpoint: "Step 1"
recommendation: "ๅฎๆฝ่ฏทๆฑ้็้ๅถๅๅผๅธธๆฃๆต"
- cutpoint: "Step 2"
recommendation: "ๅฏ็จJWT็ญพๅ้ช่ฏ๏ผไฝฟ็จๅผบๅฏ้ฅ"6.5 Output Quality Requirements
CRITICAL: Phase 6 output MUST include:
- POC Details: Every Critical/High threat must have a complete POC block with executable code
- Attack Chains: At least one detailed attack chain diagram per high-risk attack path
- Feasibility Matrix: All attack paths must have feasibility scores (0.0-10.0)
- ASCII Diagrams: Attack chains must include ASCII box diagrams in
attack_flow_diagramfield
Checkpoint: Summarize and reflect before Phase 7.
Phase 7: Mitigation Planning
๐ Detailed Workflow: See
@REPORT.mdfor complete Phase 7-8 workflow with content aggregation instructions.
7.1 Core Analysis Goal
Goal: Design specific mitigation measures and implementation plans for each validated risk.
This is a prescriptive task requiring LLM to design feasible security controls for the tech stack.
7.2 Input Context
โ P6: validated_risks (complete Phase 6 output)
7.3 Knowledge Reference
Security Control Set: Control Sets + OWASP References
Threat Pattern Set: CWE Mitigations
Verification Set: ASVS (requirement verification)
Query Commands:
$SKILL_PATH/kb --cwe CWE-XXX --mitigations # CWE mitigations
$SKILL_PATH/kb --control authentication # Security controls
$SKILL_PATH/kb --asvs-level L2 # ASVS requirements
$SKILL_PATH/kb --asvs-chapter V4 # ASVS by chapter7.4 Output Context
โ P8: mitigation_plan {mitigations[], roadmap{}}
Required Output for Each Risk:
### Mitigation Measures
| Risk ID | CWE | Recommended Measure | Implementation | Priority | Effort |
|---------|-----|---------------------|----------------|----------|--------|
| VR-XXX | CWE-XXX | [Measure] | [Code/Config] | Critical/High/Medium/Low | [Est.] |Checkpoint: Summarize and reflect before Phase 8.
Phase 8: Comprehensive Report
๐ Detailed Workflow: See
@REPORT.mdfor complete Phase 8 workflow with mandatory content aggregation rules.
โ ๏ธ CRITICAL: Phase 8 MUST read all phase files and copy content completely โ do NOT summarize from memory!
8.1 Core Analysis Goal
Goal: Synthesize all phase outputs into complete threat model report.
This is a comprehensive task where LLM integrates all 7 phases of analysis.
8.2 Input Context
โ P1-P7: ALL preceding phase outputs
8.3 Knowledge Reference
Compliance Frameworks + ASVS (compliance verification)
$SKILL_PATH/kb --compliance nist-csf
$SKILL_PATH/kb --asvs-level L2 --chapter V18.4 โ ๏ธ MANDATORY: Output Directory Setup
ๅจ็ๆไปปไฝๆฅๅไนๅ๏ผๅฟ ้กปๆง่กไปฅไธๆญฅ้ชค:
็กฎๅฎ PROJECT ๅ็งฐ: ไป้กน็ฎๅๆๅ๏ผ่ฝฌๆขไธบๅคงๅ
- ็คบไพ:
open-webuiโOPEN-WEBUI - ๆ ผๅผ:
^[A-Z][A-Z0-9-]{0,29}$
- ็คบไพ:
ๅๅปบ่พๅบ็ฎๅฝ:
mkdir -p {PROJECT_ROOT}/Risk_Assessment_Report/ๆๆๆฅๅๅฟ ้กป่พๅบๅฐๆญค็ฎๅฝ:
- ไธปๆฅๅ:
Risk_Assessment_Report/{PROJECT}-RISK-ASSESSMENT-REPORT.md - ้ฃ้ฉๆธ
ๅ:
Risk_Assessment_Report/{PROJECT}-RISK-INVENTORY.md - ็ผ่งฃๆชๆฝ:
Risk_Assessment_Report/{PROJECT}-MITIGATION-MEASURES.md
- ไธปๆฅๅ:
โ ๏ธ ็ฆๆญข: ็ดๆฅๅจ้กน็ฎๆ น็ฎๅฝๅๅปบๆฅๅๆไปถ๏ผ
8.5 Report Structure (9 Sections + Appendix)
CRITICAL: Sections 5, 6, and 8 must include COMPLETE Phase 6 and Phase 7 outputs without omission.
Template Reference:
assets/templates/RISK-ASSESSMENT-REPORT.template.md
# {PROJECT}-RISK-ASSESSMENT-REPORT.md
## 1. ๆง่กๆ่ฆ (Executive Summary)
- ๅจ่็ป่ฎกใSTRIDEๅๅธใๅ
ณ้ฎๅ็ฐใ็ซๅณ่กๅจๅปบ่ฎฎ
## 2. ็ณป็ปๆถๆๆฆ่ง (System Architecture)
- ็ปไปถๆๆASCIIๅพใๆฐๆฎๆตๅพDFDใไฟกไปป่พน็ใๆๆฏๆ
- (from findings_1, findings_2, findings_3)
## 3. ๅฎๅ
จๅ่ฝ่ฎพ่ฎก่ฏไผฐ (Security Design Assessment)
- 9ๅฎๅ
จๅ่ฏไผฐ็ฉ้ตใๅ
ณ้ฎๅฎๅ
จๅ็ฐ่ฏฆๆ
- (from findings_4)
## 4. STRIDE ๅจ่ๅๆ (STRIDE Threat Analysis)
- ๅจ่ๆฑๆป่กจใๆSTRIDEๅ็ฑป่กจใๅจ่่ฏฆ็ปๅๆ
- (from findings_5)
## 5. ้ฃ้ฉ้ช่ฏไธPOC่ฎพ่ฎก (Risk Validation & POC) โ CRITICAL
- POC้ช่ฏๆนๆณ่ฎบใ้ช่ฏ่ฆ็็ป่ฎกใPOC้ช่ฏ่ฏฆๆ
ใPOCๆฑๆป่กจ
- ๆฏไธชCritical/Highๅจ่ๅฟ
้กปๆๅฎๆดPOCไปฃ็ ๅ
- (from validated_risks.poc_details)
## 6. ๆปๅป่ทฏๅพๅๆ (Attack Path Analysis) โ CRITICAL
- ๆปๅป่ทฏๅพๅฏ่กๆง็ฉ้ตใๆปๅป้พ่ฏฆ็ปๅๆใๆปๅป้ข็ญๅๅพใไผๅ
็บงๆๅบ
- ๆฏๆก้ซๅฑๆปๅป่ทฏๅพๅฟ
้กปๆASCIIๆปๅป้พๅพ
- (from validated_risks.attack_chains, validated_risks.attack_path_matrix)
## 7. ๅจ่ไผๅ
็บง็ฉ้ต (Threat Priority Matrix)
- ้ฃ้ฉ่ฏไผฐ็ฉ้ตใๅจ่ๅๅธ็ฉ้ตใๆปๅป้ข็ญๅๅพ
## 8. ็ผ่งฃๆชๆฝๅปบ่ฎฎ (Mitigation Recommendations) โ CRITICAL
- P0/P1/P2ๅ็บงๆชๆฝใๅฎๆฝ่ทฏ็บฟๅพใ้ฒๅพก็บตๆทฑๆถๆ
- (from mitigation_plan)
## 9. ๅ่งๆงๆ ๅฐ (Compliance Mapping)
- OWASP Top 10ๆ ๅฐใOWASP LLM Top 10ๆ ๅฐ(ๅฆ้็จ)
## ้ๅฝ (Appendices)
- A: DFDๅ
็ด ๅฎๆดๆธ
ๅ
- B: Mermaid DFDๆบ็
- C: ๅจ่ๅฎๆดๆธ
ๅ
- D: ็ฅ่ฏๅบๆฅ่ฏข่ฎฐๅฝ
- E: ๅ่่ตๆ8.6 Output Files
่พๅบ็ฎๅฝ: {PROJECT_ROOT}/Risk_Assessment_Report/
ๅฟ ้ๆฅๅ (ๅง็ป็ๆ):
| ๅบๅท | ๆฅๅๆไปถ | ่ฏดๆ |
|---|---|---|
| 1 | {PROJECT}-RISK-ASSESSMENT-REPORT.md |
้ฃ้ฉ่ฏไผฐๆฅๅ (ไธปๆฅๅ) |
| 2 | {PROJECT}-RISK-INVENTORY.md |
้ฃ้ฉๆธ ๅ |
| 3 | {PROJECT}-MITIGATION-MEASURES.md |
็ผ่งฃๆชๆฝ |
| 4 | {PROJECT}-PENETRATION-TEST-PLAN.md |
ๆธ้ๆต่ฏๆนๆก |
8.7 โ ๏ธ MANDATORY: Phase Output Publication
ๅจ็ๆๆๆๆฅๅๅ๏ผๅฟ ้กปๆง่ก้ถๆฎต่ฟ็จๆๆกฃๅๅธ:
ๅฐ .phase_working/ ไธญ็้ถๆฎตไบง็ฉๅคๅถๅฐ Risk_Assessment_Report/ ็ฎๅฝ๏ผไฟ็่ฑๆๆไปถๅ:
phase_output_publication:
source_dir: ".phase_working/"
target_dir: "Risk_Assessment_Report/"
files: # ็ดๆฅๅคๅถ๏ผไฟ็ๅๆไปถๅ
- P1-PROJECT-UNDERSTANDING.md # Phase 1 ้กน็ฎ็่งฃ
- P2-DFD-ANALYSIS.md # Phase 2 DFDๅๆ
- P3-TRUST-BOUNDARY.md # Phase 3 ไฟกไปป่พน็
- P4-SECURITY-DESIGN-REVIEW.md # Phase 4 ๅฎๅ
จ่ฎพ่ฎก่ฏไผฐ
- P5-STRIDE-THREATS.md # Phase 5 STRIDEๅจ่ๅๆ
- P6-RISK-VALIDATION.md # Phase 6 ้ฃ้ฉ้ช่ฏๆง่กๅฝไปค (็คบไพ):
# ๅคๅถ้ถๆฎต่ฟ็จๆๆกฃๅฐๆฅๅ็ฎๅฝ (ไฟ็่ฑๆๅ)
cp .phase_working/P1-PROJECT-UNDERSTANDING.md Risk_Assessment_Report/
cp .phase_working/P2-DFD-ANALYSIS.md Risk_Assessment_Report/
cp .phase_working/P3-TRUST-BOUNDARY.md Risk_Assessment_Report/
cp .phase_working/P4-SECURITY-DESIGN-REVIEW.md Risk_Assessment_Report/
cp .phase_working/P5-STRIDE-THREATS.md Risk_Assessment_Report/
cp .phase_working/P6-RISK-VALIDATION.md Risk_Assessment_Report/ไปทๅผ่ฏดๆ:
- ้ถๆฎต่ฟ็จๆๆกฃ่ฎฐๅฝๅฎๆดๅๆ่ฟ็จ
- ๆฏๆๅฎก่ฎก่ฟฝๆบฏๅ่ดจ้้ช่ฏ
- ไพฟไบๅข้็่งฃๅจ่ๅปบๆจกๆจๅฏผ้ป่พ
- ไฟ็่ฑๆๅ็กฎไฟๅฝๅ่ง่ไธ่ดๆง
Scripts Reference
| Script | Purpose | Key Commands |
|---|---|---|
list_files.py |
Phase 1: File listing | --categorize, --detect-type |
stride_matrix.py |
Phase 5: STRIDE matrix | --element, --generate-id |
unified_kb_query.py |
Phase 4-8: KB queries | See below |
unified_kb_query.py - Complete Parameter Reference
STRIDE Queries
--stride {spoofing|tampering|repudiation|information_disclosure|denial_of_service|elevation_of_privilege}
--all-stride # All STRIDE categories overview
--element {process|data_store|data_flow|external_interactor}CWE Queries
--cwe CWE-XXX # Query specific CWE
--cwe CWE-XXX --mitigations # Include detailed mitigations
--full-chain CWE-XXX # Complete chain: STRIDEโCWEโCAPECโATT&CKCAPEC Attack Patterns
--capec CAPEC-XXX # Query specific CAPEC
--capec CAPEC-XXX --attack-chain # Include ATT&CK technique mappingATT&CK Techniques
--attack-technique TXXX # Query ATT&CK technique
--attack-mitigation MXXX # Query ATT&CK mitigation
--attack-search "keyword" # Search ATT&CK techniquesCVE Queries
--cve CVE-XXXX-XXXXX # Direct CVE query
--cve-for-cwe CWE-XXX # CVEs by CWE
--cve-severity {CRITICAL|HIGH|MEDIUM|LOW}
--check-kev CVE-XXXX # Check Known Exploited VulnerabilityVerification Set Queries (NEW)
--stride-tests {S|T|R|I|D|E} # Get verification tests for STRIDE category
--cwe-tests CWE-XXX # Get verification tests for CWE
--asvs-level {L1|L2|L3} # Get ASVS requirements by level
--asvs-chapter {V1|V2|...} # Get ASVS requirements by chapter
--wstg-category {ATHN|AUTHZ|...} # Get WSTG tests by categoryCloud & LLM Extensions
--cloud {aws|azure|gcp|alibaba|tencent}
--category {compute|storage|database|networking|identity|serverless}
--llm LLM01 # Query OWASP LLM Top 10
--all-llm # All OWASP LLM Top 10 threats
--ai-component {llm_inference_service|rag_retrieval|...}Semantic Search
--semantic-search "query" # Natural language search
--search-type {cwe|capec|all}Knowledge Base Layers
| Layer | Source | Content | Use Case |
|---|---|---|---|
| L1: Curated | YAML + Markdown | Security domains, controls, references | Phase 2-4 |
| L2: Indexed | SQLite (18MB) | 974 CWEs, 615 CAPECs, 835 ATT&CK | Phase 5-7 |
| L3: Extension | SQLite (304MB) | 323K+ CVEs | Phase 6 CVE lookup |
| L4: Live | NVD/KEV API | Real-time CVE/KEV | Exploit context |
| L5: Verification | SQLite | WSTG, MASTG, ASVS | Phase 6-8 |
Parallel Sub-Agent Pattern
For Phases 5/6/7 with multiple risks:
Main Agent Sub-Agents (Parallel)
โ โโโโโโโโโโโโโโโโโโโ
โโโโบ Risk 1 โโโโโโโโโโโโโโโบ Agent 1 โโโบ KB Query โโโบ Result 1
โ โโโโโโโโโโโโโโโโโโโ
โ โโโโโโโโโโโโโโโโโโโ
โโโโบ Risk 2 โโโโโโโโโโโโโโโบ Agent 2 โโโบ KB Query โโโบ Result 2
โ โโโโโโโโโโโโโโโโโโโ
โ โโโโโโโโโโโโโโโโโโโ
โโโโบ Risk N โโโโโโโโโโโโโโโบ Agent N โโโบ KB Query โโโบ Result N
โ โโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโ Aggregate Results โโโโโโโโโโโโโโโโโโLarge Project Handling
| Scale | File Count | Module Count | Strategy |
|---|---|---|---|
| Small | <50 | <5 | Standard 8-phase analysis |
| Medium | 50-200 | 5-15 | Module-priority (key modules deep) |
| Large | 200-500 | 15-30 | Subsystem split + merge |
| Very Large | >500 | >30 | Layered analysis + parallel sub-agents |
Subsystem Threat ID: T-{STRIDE}-{SubsysID}-{ElementID}-{Seq}
Common Pitfalls
| Pitfall | Solution |
|---|---|
| Skipping phases | Execute all 8 phases in order |
| Not using KB queries | Use unified_kb_query.py for every risk |
| Generic mitigations | Query CWE-specific mitigations from KB |
| Missing attack paths | Use CAPEC + ATT&CK for verification |
| No reflection | Summarize and reflect after each phase |
| Parallel phase execution | Phases are strictly serial |
| Incomplete Phase 6 consolidation | Must include ALL P1-P5 findings |
| Phase 8 omissions | Must include COMPLETE P6 and P7 outputs |
Reference Files
Workflow & Phase Details (load progressively):
@WORKFLOW.md- Phase 1-5 detailed workflow@VALIDATION.md- Phase 6 (Risk Validation) complete workflow, consolidation process, POC templates@REPORT.md- Phase 7-8 (Mitigation & Report) with mandatory content aggregation rulesEXAMPLES.md- Real-world threat modeling examples
Schemas (format specifications):
assets/schemas/risk-detail.schema.md- Risk detail format, priority mapping (P0-P3), required fieldsassets/schemas/phase-risk-summary.schema.md- Phase output summary format (if exists)
Knowledge Base (query via scriptsโdo NOT load directly):
assets/knowledge/security_kb.sqlite- Core databaseassets/knowledge/security_kb_extension.sqlite- CVE extensionassets/knowledge/*.yaml- Curated mappingsassets/knowledge/security-controls/*.md- Control setsassets/knowledge/security-controls/references/*.md- OWASP references