Threat modeling

From Hack23/riksdagsmonitor · View interactive version

Threat modeling is an AI agent skill from the GitHub repository Hack23/riksdagsmonitor. Comprehensive Hack23 threat modeling process using STRIDE, MITRE ATT&CK, attack trees, and quantitative risk assessment per ISMS Threat_Modeling.md policy

How to use this skill

Skill file

Threat Modeling Skill

๐Ÿ”ด AI FIRST Quality Principle

Apply the AI FIRST principle: never accept first-pass quality. Minimum 2 iterations. Read all output, improve every section. No shortcuts.

Purpose

This skill embodies the complete Hack23 AB threat modeling methodology as defined in ISMS Threat_Modeling.md. It provides systematic threat identification, risk quantification, and security control validation for proactive security assurance across all Hack23 projects.

Key Philosophy: "Security through transparency" - All threat models are publicly documented to demonstrate security excellence to clients, regulators, and the open-source community.

Hack23 Threat Modeling Process (ISMS ยง 4)

Per ISMS Threat_Modeling.md, Hack23 employs a five-strategy integrated approach:

1. ๐ŸŽฏ Attacker-Centric (ISMS ยง 4.1)

MITRE ATT&CK Framework Integration

Required Outputs:

2. ๐Ÿฐ Asset-Centric (ISMS ยง 4.2)

Crown Jewel Protection

Required Outputs:

3. ๐Ÿ—๏ธ Architecture-Centric (ISMS ยง 4.3)

STRIDE Per Element Analysis

Required Outputs:

4. ๐Ÿ“– Scenario-Centric (ISMS ยง 4.4)

Use Case Abuse Modeling

Required Outputs:

5. ๐Ÿ“Š Risk-Centric (ISMS ยง 4.5)

Quantitative Risk Assessment

Required Outputs:

Security Foundations

CIA Triad

| Principle | Definition | Key Controls | Threat Categories |

|-----------|------------|--------------|------------------|

| Confidentiality | Information accessible only to authorized entities | Encryption, access control, authentication | Information disclosure, credential theft |

| Integrity | Data protection from unauthorized modification | Checksums, digital signatures, version control | Tampering, data corruption |

| Availability | Reliable and timely access to systems | Redundancy, DR, DDoS mitigation | DoS, outages, resource exhaustion |

AAA Framework

| Component | Definition | Integration |

|-----------|------------|-------------|

| Authentication | Identity verification | Access Control Policy |

| Authorization | Permitted actions | RBAC, ABAC implementation |

| Accounting | Activity tracking | Security monitoring, audit logs |

STRIDE Threat Modeling Framework

STRIDE Categories

S - Spoofing Identity

T - Tampering with Data

R - Repudiation

I - Information Disclosure

D - Denial of Service

E - Elevation of Privilege

MITRE ATT&CK Integration

Tactics & Techniques

| Tactic | Description | Common Techniques |

|--------|-------------|-------------------|

| Reconnaissance | Information gathering | Active scanning, OSINT |

| Resource Development | Establishing resources | Compromise accounts, infrastructure setup |

| Initial Access | Network entry | Phishing, drive-by compromise, supply chain |

| Execution | Malicious code execution | Command interpreters, malicious input |

| Persistence | Foothold maintenance | Account manipulation, backdoors |

| Privilege Escalation | Higher permissions | Exploitation, process injection |

| Defense Evasion | Detection avoidance | Obfuscation, bypass controls |

| Credential Access | Credential theft | Brute force, token stealing |

| Discovery | Environment reconnaissance | Cloud discovery, network mapping |

| Lateral Movement | Environment traversal | Remote services, credential reuse |

| Collection | Data gathering | Local data, cloud storage |

| Command & Control | System communication | Application layer protocols |

| Exfiltration | Data theft | C2 channel, cloud storage |

| Impact | System destruction | Data destruction, resource hijacking |

Threat Agent Classification

| Threat Agent | Category | Risk Level | MITRE Tactics |

|--------------|----------|------------|---------------|

| Accidental Insiders | Internal | Medium | Execution, Privilege Escalation |

| Malicious Insiders | Internal | High | Initial Access, Impact |

| Cybercriminals | External | High | Reconnaissance, Collection |

| Nation-State APTs | External | Critical | Persistence, Defense Evasion |

| Hacktivists | External | Medium | Impact, Privilege Escalation |

| Service Providers | External | Medium | Initial Access, Defense Evasion |

| Cyber Vandals | External | Low | Impact, Execution |

Current Threat Landscape (ENISA 2024)

| Priority | Threat Category | Business Impact | Mitigation Priority |

|----------|----------------|-----------------|-------------------|

| 1 | Threats Against Availability | Revenue protection | Critical |

| 2 | Ransomware | Business continuity | Critical |

| 3 | Threats Against Data | Risk reduction | High |

| 4 | Malware | Operational excellence | High |

| 5 | Social Engineering | Trust enhancement | High |

| 6 | Information Manipulation | Competitive advantage | Medium |

| 7 | Supply Chain Attacks | Partnership value | High |

Attack Tree Analysis (ISMS ยง 4.6)

Attack trees are mandatory for all Hack23 threat models per ISMS policy. They provide:

Purpose

Attack Tree Structure

Root: Attack Goal (e.g., "Compromise Application")
โ”œโ”€โ”€ OR Gate: Any child succeeds โ†’ parent succeeds
โ”‚   โ”œโ”€โ”€ AND Gate: All children must succeed โ†’ parent succeeds
โ”‚   โ”‚   โ”œโ”€โ”€ Leaf: Individual attack step (Likelihood: 40%, Impact: High)
โ”‚   โ”‚   โ””โ”€โ”€ Leaf: Individual attack step (Likelihood: 60%, Impact: Medium)
โ”‚   โ””โ”€โ”€ AND Gate: Alternative attack path
โ”‚       โ”œโ”€โ”€ Leaf: Attack step 1
โ”‚       โ””โ”€โ”€ Leaf: Attack step 2
โ””โ”€โ”€ OR Gate: Second major attack vector
    โ””โ”€โ”€ Leaf: Direct attack

Example: Static Website Compromise (from Riksdagsmonitor)

Root: Compromise Riksdagsmonitor Platform
โ”œโ”€โ”€ OR: Infrastructure Attack
โ”‚   โ”œโ”€โ”€ AND: DNS Hijacking
โ”‚   โ”‚   โ”œโ”€โ”€ Compromise Route 53 credentials (Likelihood: 10%, Impact: Critical)
โ”‚   โ”‚   โ””โ”€โ”€ Modify DNS records (Likelihood: 95%, Impact: Critical)
โ”‚   โ””โ”€โ”€ AND: S3 Bucket Compromise
โ”‚       โ”œโ”€โ”€ Find misconfigured bucket (Likelihood: 5%, Impact: High)
โ”‚       โ””โ”€โ”€ Upload malicious content (Likelihood: 90%, Impact: High)
โ””โ”€โ”€ OR: Supply Chain Attack
    โ”œโ”€โ”€ AND: Compromise GitHub Account
    โ”‚   โ”œโ”€โ”€ Steal developer credentials (Likelihood: 15%, Impact: Critical)
    โ”‚   โ””โ”€โ”€ Bypass MFA (Likelihood: 20%, Impact: Critical)
    โ””โ”€โ”€ AND: Malicious Dependency Injection
        โ”œโ”€โ”€ Compromise npm package (Likelihood: 5%, Impact: High)
        โ””โ”€โ”€ Inject malicious code (Likelihood: 80%, Impact: Critical)

Attack Tree Analysis Steps

  1. Goal Identification: Define attacker objectives
  2. Path Decomposition: Break down into AND/OR sub-goals
  3. Leaf Node Likelihood: Assign success probability (1-100%)
  4. Impact Assessment: Use Classification Framework
  5. Path Calculation: Calculate cumulative success likelihood
  6. Critical Path: Identify highest risk paths
  7. Mitigation Priority: Focus on high-likelihood, high-impact leaves

Integration with STRIDE

Each STRIDE threat should have corresponding attack tree showing exploitation paths.

Data Flow Diagrams (DFD)

DFD Elements

STRIDE per DFD Element

| Element | Applicable STRIDE Threats |

|---------|--------------------------|

| External Entity | Spoofing, Repudiation |

| Process | All 6 STRIDE categories |

| Data Store | Tampering, Information Disclosure, DoS |

| Data Flow | Tampering, Information Disclosure, DoS |

| Trust Boundary | Elevation of Privilege |

Quantitative Risk Assessment

Risk Calculation

Risk = Likelihood ร— Impact

Likelihood Scoring

Impact Scoring (per Classification Framework)

Risk Matrix

| Likelihood โ†’ Impact | Negligible (1) | Low (2) | Medium (3) | High (4) | Critical (5) |

|--------------------|----------------|---------|------------|----------|--------------|

| Critical (5) | Medium | High | High | Critical | Critical |

| High (4) | Medium | Medium | High | High | Critical |

| Medium (3) | Low | Medium | Medium | High | High |

| Low (2) | Low | Low | Medium | Medium | High |

| Negligible (1) | Low | Low | Low | Medium | Medium |

Threat Model Document Structure

Every repository MUST maintain THREAT_MODEL.md with:

1. System Overview

2. Asset Inventory

3. STRIDE Analysis

4. MITRE ATT&CK Mapping

5. Attack Trees

6. Risk Assessment

7. Security Controls

8. Residual Risk

9. Recommendations

Threat Modeling Workflow (ISMS ยง 6)

Follow this structured 7-phase process for all Hack23 threat models:

Phase 1: Planning (Week 1)

Phase 2: Data Collection (Week 1-2)

Phase 3: Threat Identification (Week 2-3)

Phase 4: Risk Assessment (Week 3)

Phase 5: Mitigation Planning (Week 3-4)

Phase 6: Documentation (Week 4)

Phase 7: Review & Continuous Improvement (Ongoing)

Best Practices & Quality Standards

โœ… Do's

  1. Start Early: Threat model during design phase, not after implementation
  2. Use All 5 Strategies: Attacker, Asset, Architecture, Scenario, Risk-centric
  3. Quantify Risk: Use likelihood ร— impact matrix, not just qualitative assessment
  4. Document Visually: Mermaid DFDs, attack trees, risk matrices
  5. Link Everything: Cross-reference SECURITY_ARCHITECTURE.md, Risk_Register.md
  6. Business Value: Quantify cost avoidance, competitive advantage
  7. Public Transparency: All threat models public (security through transparency)
  8. Continuous Updates: Threat landscape evolves, models must too
  9. Attack Trees Mandatory: Minimum 3-5 trees per ISMS ยง 4.6
  10. MITRE ATT&CK Required: Map tactics/techniques per ISMS ยง 4.6

โŒ Don'ts

  1. Skip Attack Trees: ISMS ยง 4.6 requires attack tree analysis
  2. Generic Threats: Customize to actual system architecture
  3. Ignore Low Risks: Document all risks, even accepted ones
  4. One-Time Activity: Threat modeling is continuous, not one-and-done
  5. Missing Controls: Every threat needs control or risk acceptance
  6. No Quantification: Risk scores required, not just High/Medium/Low
  7. Siloed Analysis: Integrate with ISMS policies (Access Control, Crypto, Network)
  8. Forget Business Value: Security is business enabler, quantify benefits
  9. Incomplete Documentation: Follow mandatory structure ยง 5 completely
  10. No CEO Approval: All threat models require CEO sign-off

Integration with Hack23 ISMS

Required Policy Cross-References

Every THREAT_MODEL.md must reference and align with:

  1. Information_Security_Policy.md
  1. Access_Control_Policy.md
  1. Data_Classification_Policy.md
  1. Network_Security_Policy.md
  1. Cryptography_Policy.md
  1. Secure_Development_Policy.md
  1. Vulnerability_Management.md
  1. Incident_Response_Plan.md
  1. Business_Continuity_Plan.md
  1. CLASSIFICATION.md
  1. Risk_Register.md

Compliance Framework Mapping

Map all threats and controls to:

ISO 27001:2022 Annex A Controls:

NIST CSF 2.0 Functions:

CIS Controls v8.1:

AWS Well-Architected Framework (for AWS projects)

Mermaid Diagram Standards for Threat Models

Use ISMS color palette (per STYLE_GUIDE.md v2.3):

Classification Colors

Critical/Extreme:  #D32F2F  # Red
High/Very High:    #FF9800  # Orange  
Medium/Moderate:   #FFC107  # Amber
Low/Standard:      #4CAF50  # Green
Public/Minimal:    #9E9E9E  # Grey

Trust Boundary Colors

External (Untrusted):  #D32F2F  # Red
DMZ (Partially Trusted): #FF9800  # Orange
Internal (Trusted):    #4CAF50  # Green
Secure (Highly Trusted): #2196F3  # Blue

Example DFD with Trust Boundaries

graph TB
    User[End Users<br/>๐ŸŒ External] 
    CDN[CloudFront CDN<br/>๐Ÿ”’ Edge Security]
    S3[S3 Buckets<br/>๐Ÿ’พ Static Content]
    GitHub[GitHub Actions<br/>โš™๏ธ CI/CD]
    
    User -->|HTTPS TLS 1.3| CDN
    CDN -->|Serves| S3
    GitHub -->|Deploy OIDC| S3
    
    subgraph External["๐Ÿ”ด Untrusted Zone"]
        User
    end
    
    subgraph Edge["๐ŸŸ  Edge Security Zone"]
        CDN
    end
    
    subgraph Internal["๐ŸŸข Trusted AWS Zone"]
        S3
        GitHub
    end
    
    style User fill:#D32F2F,color:#fff
    style CDN fill:#FF9800,color:#000
    style S3 fill:#4CAF50,color:#000
    style GitHub fill:#4CAF50,color:#000

Remember: Hack23 Threat Modeling Philosophy

  1. ๐Ÿ” Proactive Not Reactive: Identify threats before they materialize
  2. ๐Ÿฐ Defense in Depth: Multiple security layers reduce single point of failure
  3. ๐Ÿ“Š Risk-Based Prioritization: Focus resources on high-impact threats first
  4. ๐Ÿ”„ Continuous Process: Threat landscape evolves, models must evolve too
  5. ๐Ÿ“ Documentation Essential: THREAT_MODEL.md is mandatory, not optional
  6. ๐Ÿ”— Integration Critical: Align with all ISMS policies for consistency
  7. ๐ŸŒŸ Transparency Advantage: Public threat models demonstrate security expertise
  8. ๐Ÿ’น Quantitative Assessment: Numbers drive decisions, not gut feelings
  9. ๐ŸŽฏ Business Value: Security enables business, quantify the benefits
  10. โœ… CEO Accountability: James Pether Sรถrling approves all threat models

"Security through transparency" - Hack23 AB

Hack23 Threat Model Examples

Per ISMS Threat_Modeling.md ยง 7, all Hack23 projects maintain comprehensive threat models demonstrating security excellence through transparency.

1. ๐Ÿ›๏ธ Citizen Intelligence Agency (CIA)

Repository: Hack23/cia

Threat Model: THREAT_MODEL.md

Architecture: Full-stack web application (Java/Spring Boot + PostgreSQL + AWS)

Key Characteristics:

Notable Sections:

Use CIA as reference for:

2. ๐ŸŽฎ Black Trigram (ํ‘๊ด˜)

Repository: Hack23/blacktrigram

Threat Model: THREAT_MODEL.md

Architecture: Frontend-only gaming application (React + Vite + Phaser.js)

Key Characteristics:

Notable Sections:

Use Black Trigram as reference for:

3. ๐Ÿ—ณ๏ธ Riksdagsmonitor (Current Project)

Repository: Hack23/riksdagsmonitor

Threat Model: THREAT_MODEL.md

Architecture: Static HTML/CSS website with Chart.js/D3.js dashboards + AWS CloudFront CDN

Key Characteristics:

Notable Sections:

Use Riksdagsmonitor as reference for:

4. ๐Ÿ“Š CIA Compliance Manager

Repository: Hack23/cia-compliance-manager (referenced in ISMS policy)

Threat Model: THREAT_MODEL.md

Architecture: Static HTML/CSS compliance dashboard

Key Characteristics:

Use CIA Compliance Manager as reference for:

โŒ WRONG STRUCTURE (Do NOT Use)

NEVER use numbered sections (1-10) like this:

## 1. System Boundary and Assets
## 2. STRIDE Threat Analysis
## 3. Attack Trees
## 4. MITRE ATT&CK Mapping
## 5. Risk Quantification
## 6. Threat Scenarios
## 7. Security Metrics
## 8. Assumptions and Constraints
## 9. Recommendations
## 10. Approval and Review

Why wrong: This generic structure is NOT aligned with Hack23 ISMS Threat_Modeling.md policy and does NOT demonstrate the 5-strategy integrated approach or domain expertise.


โœ… CORRECT STRUCTURE: Hack23 Thematic Sections

All Hack23 threat models use thematic sections (not numbered) that demonstrate comprehensive threat modeling maturity. Structure varies by project domain but core sections are mandatory.

Mandatory Core Sections (All Projects)

1. Header Section (per STYLE_GUIDE.md v2.3)

<p align="center">
  <img src="https://hack23.com/icon-192.png" alt="Hack23 Logo" width="192" height="192">
</p>

<h1 align="center">๐ŸŽฏ [Project Name] โ€” Threat Model</h1>

<p align="center">
  <strong>๐Ÿ›ก๏ธ Proactive Security Through Structured Threat Analysis</strong><br>
  <em>๐Ÿ” STRIDE โ€ข MITRE ATT&CK โ€ข [Architecture Type] โ€ข [Key Security Focus]</em>
</p>

<p align="center">
  <a href="#"><img src="https://img.shields.io/badge/Owner-CEO-0A66C2?style=for-the-badge" alt="Owner"/></a>
  <a href="#"><img src="https://img.shields.io/badge/Version-1.0-555?style=for-the-badge" alt="Version"/></a>
  <a href="#"><img src="https://img.shields.io/badge/Effective-YYYY--MM--DD-success?style=for-the-badge" alt="Effective Date"/></a>
  <a href="#"><img src="https://img.shields.io/badge/Review-Quarterly-orange?style=for-the-badge" alt="Review Cycle"/></a>
</p>

**๐Ÿ“‹ Document Owner:** CEO | **๐Ÿ“„ Version:** 1.0 | **๐Ÿ“… Last Updated:** YYYY-MM-DD (UTC)  
**๐Ÿ”„ Review Cycle:** Quarterly | **โฐ Next Review:** YYYY-MM-DD  
**๐Ÿข Owner:** Hack23 AB (Org.nr 5595347807) | **๐Ÿท๏ธ Classification:** Public

2. CEO Purpose Statement

Quote from CEO James Pether Sรถrling connecting threat modeling to Hack23's transparency and security excellence principles:

"At Hack23, we believe that true security comes through transparency and demonstrable practices. This threat model is publicly available to showcase our proactive security posture, allowing clients and stakeholders to verify our commitment to security excellence. By openly documenting our threat analysis, we demonstrate not just what we protect, but how we protect it."

3. Executive Summary

4. System Boundary and Assets (ISMS ยง 5.1)

5. STRIDE Threat Analysis (ISMS ยง 5.2)

For each STRIDE category (Spoofing, Tampering, Repudiation, Information Disclosure, DoS, Elevation of Privilege):

6. Attack Tree Analysis (ISMS ยง 5.3) - **MANDATORY**

Minimum 3-5 attack trees showing major attack scenarios:

7. MITRE ATT&CK Mapping (ISMS ยง 5.4) - **MANDATORY**

Map applicable tactics and techniques:

8. Risk Assessment Summary (ISMS ยง 5.5)

9. Security Controls (ISMS ยง 5.6)

Reference SECURITY_ARCHITECTURE.md with:

10. Business Value Integration (ISMS ยง 5.7) - **REQUIRED**

Quantify security business value:

11. Compliance Mapping (ISMS ยง 5.8)

Map threats and controls to:

12. Related Documents (ISMS ยง 5.9)

## ๐Ÿ“š Related Documents

- [๐Ÿ›๏ธ Architecture](./ARCHITECTURE.md) - System architecture with C4 models
- [๐Ÿ” Security Architecture](./SECURITY_ARCHITECTURE.md) - Security controls implementation
- [๐Ÿ“Š Data Model](./DATA_MODEL.md) - Data entities and relationships
- [๐Ÿ”„ Workflows](./WORKFLOWS.md) - CI/CD security workflows
- [๐Ÿ“‹ ISMS Threat Modeling Policy](https://github.com/Hack23/ISMS-PUBLIC/blob/main/Threat_Modeling.md) - Comprehensive methodology
- [๐Ÿท๏ธ Classification Framework](https://github.com/Hack23/ISMS-PUBLIC/blob/main/CLASSIFICATION.md) - Business impact analysis
- [๐Ÿ“‰ Risk Register](https://github.com/Hack23/ISMS-PUBLIC/blob/main/Risk_Register.md) - Enterprise risk management
- [๐Ÿ› ๏ธ Secure Development Policy](https://github.com/Hack23/ISMS-PUBLIC/blob/main/Secure_Development_Policy.md) - SDLC security requirements

**Reference Implementations:**
- [๐Ÿ›๏ธ CIA Threat Model](https://github.com/Hack23/cia/blob/master/THREAT_MODEL.md) - Full-stack web application
- [๐ŸŽฎ Black Trigram Threat Model](https://github.com/Hack23/blacktrigram/blob/main/THREAT_MODEL.md) - Frontend gaming application
- [๐Ÿ“Š CIA Compliance Manager](https://github.com/Hack23/cia-compliance-manager/blob/main/THREAT_MODEL.md) - Compliance dashboard

13. Document Control Footer (ISMS ยง 5.10)

---

**๐Ÿ“‹ Document Control:**  
**โœ… Approved by:** James Pether Sรถrling, CEO  
**๐Ÿ“ค Distribution:** Public  
**๐Ÿท๏ธ Classification:** [![Confidentiality: Public](https://img.shields.io/badge/C-Public-lightgrey?style=flat-square)](https://github.com/Hack23/ISMS-PUBLIC/blob/main/CLASSIFICATION.md#confidentiality-levels)  
**๐Ÿ“… Effective Date:** YYYY-MM-DD  
**โฐ Next Review:** YYYY-MM-DD  
**๐ŸŽฏ Framework Compliance:** [![ISO 27001](https://img.shields.io/badge/ISO_27001-2022_Aligned-blue?style=flat-square&logo=iso&logoColor=white)](https://github.com/Hack23/ISMS-PUBLIC/blob/main/CLASSIFICATION.md) [![NIST CSF 2.0](https://img.shields.io/badge/NIST_CSF-2.0_Aligned-green?style=flat-square&logo=nist&logoColor=white)](https://github.com/Hack23/ISMS-PUBLIC/blob/main/CLASSIFICATION.md) [![CIS Controls](https://img.shields.io/badge/CIS_Controls-v8.1_Aligned-orange?style=flat-square&logo=cisecurity&logoColor=white)](https://github.com/Hack23/ISMS-PUBLIC/blob/main/CLASSIFICATION.md)

References

Hack23 ISMS Documentation

External Frameworks

Remember

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.