Run a structured threat-modeling session for a new feature, system, or architecture — STRIDE, attack trees, data flow diagrams, abuse cases. Use when the user mentions 'threat model,' 'threat modeling,' 'STRIDE,' 'attack tree,' 'abuse case,' 'data flow diagram,' 'DFD,' 'security architecture review,' 'security review,' 'design review,' 'pre-implementation security,' 'shift left,' 'what could go wrong,' or needs strategic security thinking before code is written.
70
88%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Run a structured threat-modeling session against a proposed feature, system, or architecture. This is the design-time security skill — different from audit (which inspects code that exists). Use this when there's a design doc, a feature spec, an architecture diagram — but not yet code.
When to use:
Cross-references: owasp-audit (code-level checklist that lines up with the threats this surfaces), api-audit (API-specific category mapping), iam-audit (identity decisions touch every threat model).
Adam Shostack's framing — every threat model answers these four:
The rest of this skill walks through each in order.
Produce a Data Flow Diagram (DFD) at one of three levels:
A useful DFD has:
Trust boundaries are the most useful element. If you can draw exactly one diagram that shows every trust boundary in your feature, you've already done 60% of the work.
For text-only environments, render the DFD in Mermaid:
flowchart LR
User[User] -- HTTPS --> WAF[WAF / CDN]
WAF -- request --> API[API Gateway]
API -- JWT --> Service[Service]
Service -- SQL --> DB[(Postgres)]
Service -- HTTPS --> Stripe[Stripe]
classDef trust fill:#fff,stroke:#f00,stroke-dasharray:4 4
class API,Service trustFor each process, data store, and data flow, ask STRIDE — one threat category per letter. Not every category applies to every element, and that's fine.
| Letter | Threat | Property violated | Examples |
|---|---|---|---|
| S | Spoofing | Authentication | Stolen token, forged JWT, replay attack, impersonating a service |
| T | Tampering | Integrity | Modifying a request mid-flight, parameter tampering, modifying stored data |
| R | Repudiation | Non-repudiation | User denies an action; logs don't prove they did it |
| I | Information Disclosure | Confidentiality | Leak via error messages, IDOR exposing other users' data, exposed S3 bucket |
| D | Denial of Service | Availability | Resource exhaustion, expensive query bomb, billing exhaustion via paid downstream APIs |
| E | Elevation of Privilege | Authorization | User → admin via mass assignment, BFLA, escape from sandbox |
A useful threat-modeling habit: for each element of the DFD, write a short table.
**Element:** API Gateway
| STRIDE | Threat | Likelihood | Impact |
|---|---|---|---|
| S | Forged JWT — symmetric secret in env, leaks if .env exposed | M | H |
| T | Request body modified between gateway and upstream service | L | M |
| R | Gateway access logs deleted by attacker post-breach | L | H |
| I | Verbose error responses expose internal hostnames | M | L |
| D | No rate limit at the gateway → upstream services overwhelmed | H | H |
| E | "X-Admin: true" header pass-through from external requests | L | C |Likelihood and impact: L / M / H / C(ritical) — qualitative is fine; quantitative scoring is theater for most engagements.
For features with business-flow concerns, also walk abuse cases. The format is:
As a malicious actor, I want to [goal] so that I can [outcome].Examples:
Abuse cases catch what STRIDE misses — STRIDE is great at "security properties violated"; abuse cases are great at "business intent violated."
For each threat surfaced in Step 2, pick one of four responses:
Mitigations should be specific:
| Bad mitigation | Good mitigation |
|---|---|
| "Add rate limiting" | "Add 5 req/min per user IP to /api/coupon/redeem, with Redis-backed counter; queue 429 responses to be alerted on" |
| "Validate inputs" | "Reject ?next= URLs that contain control bytes (\t, \n, \0), backslashes, or percent-encoded slashes; normalize via new URL(target, ...).pathname (see owasp-audit A01)" |
| "Encrypt the data" | "Application-level encryption with AWS KMS-managed CMK, envelope encryption per row, key rotation every 90 days, audit log of every Decrypt call" |
iam-audit)api-audit API3)can(user, action, resource), deny-by-default, sister-route audit (see owasp-audit A04 sister-route)Validation comes from three sources:
owasp-audit Second-Opinion Pass.Worth it:
prompt-injection)Probably not worth it:
The test: if the change introduces a new trust boundary, moves an existing one, or changes what crosses one — threat model it. Otherwise, skip.
A threat model is a living document, not a one-shot report. Keep it short and reviewable.
# Threat Model: [Feature / System Name]
## Status: Draft / In Review / Approved
## Owner: [name]
## Date: [date]
## Reviewers: [names]
## 1. Scope
[2-3 sentences — what's in, what's out]
## 2. Data Flow Diagram
[Mermaid diagram or link to image]
## 3. Assumptions and constraints
- [Anything taken as given — e.g. "users authenticate via Okta, MFA enforced"]
## 4. Threats and mitigations
[STRIDE-per-element tables, then abuse cases]
## 5. Open questions
[Things we deferred or couldn't decide]
## 6. Decision log
[Material design decisions and why — including risks accepted]
## 7. Action items
| Item | Owner | Deadline | Status |
|------|-------|----------|--------|Keep this in the repo alongside the design doc, not in a separate security tracker. Drift between the threat model and the implementation is the dominant failure mode — proximity helps.
web-pentest or owasp-audit for verificationc9ade03
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.