agentleFS
fatihkanfatihkan/badi/.claude/skills-vault/pentest-threat-model/SKILL.md

pentest-threat-model

Skill8 starsChanged 3 months agoMITView on GitHub

Threat modeling — STRIDE, DREAD, attack tree, data flow diagram, MITRE ATT&CK Navigator integration. Triggers on threat model, STRIDE, DREAD, attack tree, DFD, data flow diagram, MITRE ATT&CK, threat matrix, risk scoring.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When the user asks to persist the threat model (or when it feeds the security-check pipeline), write it to THREAT_MODEL.md at the scan …

    line 154

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

pentest-threat-model

System threat modeling — STRIDE, DREAD, attack tree, DFD. Used at engagement start or in a design review.

Triggers

  • "create a threat model"
  • "STRIDE analysis"
  • "DREAD scoring"
  • "draw an attack tree"
  • "data flow diagram"
  • "MITRE ATT&CK matrix"

STRIDE (Microsoft)

LetterThreatCounter Property
SSpoofing identityAuthentication
TTampering with dataIntegrity
RRepudiationNon-repudiation
IInformation disclosureConfidentiality
DDenial of serviceAvailability
EElevation of privilegeAuthorization

Apply STRIDE to every DFD element (Process, Data Store, Data Flow, Trust Boundary).

DREAD Scoring

Dimension1 (Low)5 (High)10 (Critical)
DamageMinimalMajorCatastrophic
ReproducibilityHardSometimesTrivial
ExploitabilityHardModerateTrivial (script)
Affected usersFewManyMost
DiscoverabilityHiddenApparentPublic docs

Total: 50 max. High = high risk.

DFD Structure

[External Entity] --> ((Process)) --> [Data Store]
                          |
                      Trust Boundary
                          |
                   ((Internal Service))

Components:

  • External Entity (square): user, 3rd party API
  • Process (circle): web server, microservice
  • Data Store (cylinder): database, cache
  • Data Flow (arrow): request/response
  • Trust Boundary (dashed line): VPC boundary, network zone

Attack Tree Template

Goal: Steal credit card data
├── 1. Compromise web server
│   ├── 1.1 RCE via SQL injection
│   │   └── 1.1.1 Find SQLi in /api
│   ├── 1.2 Steal session cookie via XSS
│   └── 1.3 Brute force admin panel
├── 2. Compromise database directly
│   ├── 2.1 Internal port reachable
│   └── 2.2 Default credential
└── 3. Social engineer admin
    ├── 3.1 Phishing
    └── 3.2 Vishing IT helpdesk

For each leaf:

  • DREAD score
  • Likelihood (1-5)
  • Cost to exploit (hours/days)
  • Detection (likely/possible/unlikely)

MITRE ATT&CK Matrix Mapping

threat_model:
  asset: Production database
  threats:
    - id: T-DB-001
      stride: I (Information disclosure)
      attack:
        tactic: TA0009 Collection
        technique: T1213 Data from Information Repositories
      dread: { damage: 9, repro: 7, exploit: 6, affected: 8, discover: 5 }
      score: 35
      mitigation:
        - DB encryption at rest
        - Access logging + SIEM rule
        - Network segmentation

Output Template

## Threat Model — <system>

### 1. System Description
- Frontend: React SPA on CDN
- Backend: Node.js API on Kubernetes
- Data: PostgreSQL (managed) + Redis (managed)
- 3rd party: Stripe, SendGrid, Auth0

### 2. Data Flow Diagram (Mermaid)
(mermaid flowchart of external entities, processes, data stores, and trust
boundaries — see the render example in the "Mermaid DFD Render" section below)

### 3. Entry Points & Trust Boundaries
Entry points: /api/* (JWT), /webhooks/stripe (signature), admin panel (SSO)
1. CDN <-> API (TLS, JWT auth)
2. API <-> DB (VPC private subnet, IAM auth)
3. API <-> 3rd party (TLS + API key)

### 4. Threats (STRIDE + DREAD table)

| # | Threat | STRIDE | DREAD | Tactic |
|---|--------|--------|-------|--------|
| 1 | Stripe webhook spoofing (no sig verify) | T | 38 | Initial Access |
| 2 | JWT alg=none bypass | S+E | 36 | Initial Access |
| 3 | DB credential leak via 0/1-day | I | 33 | Credential Access |
| 4 | Redis SSRF via SSRF in URL param | I | 30 | Discovery |
| 5 | DoS via excessive GraphQL nesting | D | 28 | Impact |

### 5. Mitigations
- Stripe: webhook signature verify (Stripe-Signature header)
- JWT: enforce alg whitelist (RS256 only)
- DB: rotate credentials quarterly, IAM auth (no static creds)
- SSRF: URL allowlist (no internal IP)
- GraphQL: max-depth 7, max-aliases 30

File Output Convention (v1.34+)

When the user asks to persist the threat model (or when it feeds the security-check pipeline), write it to THREAT_MODEL.md at the scan target's root (the project root for a whole-repo scan) using the Output Template above, organized into numbered sections:

  1. System Description
  2. Data Flow Diagram (Mermaid)
  3. Entry Points & Trust Boundaries
  4. Threats (STRIDE + DREAD table)
  5. Mitigations

Sections 3 and 4 are the machine-consumed scoping contract: the security-check pipeline (Phase 1 recon and Phase 2 hunting) reads them to focus scanning on the modeled entry points and threats. THREAT_MODEL.md is the head of the harness-compatible artifact chain THREAT_MODEL.md → VULN-FINDINGS.json/.md → TRIAGE.json/.md — filenames follow anthropics/defending-code-reference-harness (Apache-2.0) for interop. Unlike the generated scan artifacts, THREAT_MODEL.md is a durable design document — commit it.

Mermaid DFD Render

flowchart LR
    User[User Browser] -->|HTTPS| CDN[CDN]
    CDN -->|HTTPS+JWT| API[API Gateway]
    API -->|VPC| DB[(PostgreSQL)]
    API -->|VPC| Cache[(Redis)]
    API -->|HTTPS+API Key| Stripe[Stripe API]
    API -->|HTTPS+API Key| SendGrid[SendGrid]

    classDef boundary stroke-dasharray:5
    style CDN stroke-dasharray:5
    style API stroke-dasharray:5

Out-of-Scope

  • Live attack execution (modeling only)
  • Automatically updating an existing model (manual review as needed)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.