CommunityCoding & Developmentgithub.com

threat-model-analyze

Perform an evidence-backed STRIDE and OWASP threat model on a codebase to uncover concrete security vulnerabilities and architectural risks. Cross-references OWASP Top 10:2025, OWASP ASVS v5.0, OWASP API Security Top 10, OWASP LLM/Agentic/MCP Top 10, CWE, and MITRE ATT&CK, producing docs/THREAT-MODEL.md (and optional docs/threat-model.json) with file:line evidence and prioritized remediation plans. Use when asked to threat model a project or audit its security design.

What is threat-model-analyze?

threat-model-analyze is a Antigravity agent skill that perform an evidence-backed STRIDE and OWASP threat model on a codebase to uncover concrete security vulnerabilities and architectural risks. Cross-references OWASP Top 10:2025, OWASP ASVS v5.0, OWASP API Security Top 10, OWASP LLM/Agentic/MCP Top 10, CWE, and MITRE ATT&CK, producing docs/THREAT-MODEL.md (and optional docs/threat-model.json) with file:line evidence and prioritized remediation plans. Use when asked to threat model a project or audit its security design.

Works with~Claude Code~Codex CLI~Cursor✓Antigravity
npx skills add https://github.com/jusso-dev/threat-modeling-skills/tree/HEAD/skills/threat-model-analyze

Installed? Explore more Coding & Development skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Threat Model Analyze (Question 2: What Can Go Wrong?)

Use this skill to systematically uncover real, code-grounded security vulnerabilities and design weaknesses across a repository and write a complete, actionable threat model.

Prerequisites

  • If architecture discovery has not been completed yet, run the threat-model-discover workflow first so you have an accurate stack inventory, asset list, entry points, trust boundaries, and Mermaid DFD.
  • Activate every stack-specific tm-* skill that matches the detected stack (for example tm-nextjs-react, tm-rust-web, tm-apis-rest-graphql-grpc, tm-auth-oauth-oidc-jwt, tm-databases-sql-nosql, tm-ai-llm-mcp, tm-cicd-supply-chain).

Evidence & Quality Rules (Non-Negotiable)

  1. Zero hallucinated findings: Every threat MUST cite real file:line evidence (or exact config/IaC path) that you directly read.
  2. Trace mitigations before reporting: Check middleware, guards, ORM parameterization, framework auto-escaping, and upstream validation before flagging an issue. Do not pad the report with theoretical boilerplate already mitigated in code.
  3. Label confidence honestly:
    • confirmed: Exploitable vulnerability or broken control verified directly in code/config.
    • design-gap: Missing defense-in-depth control (e.g., no rate limit, no RLS, no audit log on sensitive action).
    • assumption-dependent: Secure only if an external runtime control holds (e.g., reverse proxy strips spoofed headers).
  4. Read-only by default: Write the threat model artifacts (docs/THREAT-MODEL.md and optionally docs/threat-model.json), but do not modify application code until the user invokes threat-model-remediate (or explicitly asks to threat model and fix in one pass).

Workflow

Step 1: Apply STRIDE-per-Element Across Every Trust Boundary

Walk through each trust boundary (TB-*) and entry point from discovery using references/stride-per-element.md:

  • Spoofing: Auth bypasses, missing middleware on routes, weak JWT/cookie/session verification, spoofable forwarded headers, unverified webhooks.
  • Tampering: SQL/NoSQL/Command/Template/Header injection, mass assignment/BOPLA, CSRF, unsafe deserialization, path traversal, TOCTOU races, unsigned state/artifacts.
  • Repudiation: Missing structured security logs for auth, privilege changes, exports, deletes, config changes; log injection (CWE-117); sensitive secrets logged (CWE-532).
  • Information Disclosure: Cross-tenant BOLA/IDOR, verbose stack traces/errors, client bundle secret leaks, SSRF to cloud metadata/internal services, sensitive data in caches/URLs/logs, LLM/RAG cross-tenant leaks.
  • Denial of Service: Missing rate limits or payload size caps, unbounded pagination/queries/GraphQL depth, ReDoS, archive/image decompression bombs, lock/resource exhaustion, unhandled panics/exceptions (OWASP A10:2025), unbounded LLM loops.
  • Elevation of Privilege: Missing function-level authz (BFLA), horizontal/vertical IDOR, client-controlled role/tenant fields, container/IAM over-privilege, CI/CD pull_request_target takeover, AI tool misuse / excessive agency.

Step 2: Run Deep Stack-Specific Threat Hunts

Using the matching tm-* skills, actively inspect high-risk code paths:

  • Every route/controller/action/resolver/RPC/MCP tool for default-deny authn + object-level authz + tenant scoping.
  • Every database query, shell call, file operation, template render, deserializer, and outbound HTTP request.
  • Auth flows (login, OAuth/OIDC callback, password reset, MFA, session rotation, API keys, webhooks).
  • Configuration, secrets, CORS/CSP/cookies, Dockerfiles, Kubernetes/IaC manifests, and CI workflows.
  • Error handling paths to verify fail-closed behaviour (OWASP A10:2025).

Step 3: Risk-Rate & Map Every Finding to Standards

For each real issue found, assign a unique ID (TM-001, TM-002, ...) and record:

  • Severity: critical | high | medium | low (derived from Likelihood x Impact, noting unauthenticated reachability and cross-tenant blast radius).
  • Confidence: confirmed | design-gap | assumption-dependent.
  • STRIDE category(ies).
  • Standards mapping:
    • OWASP Top 10:2025 (A01:2025 through A10:2025)
    • OWASP ASVS v5.0 chapter/control (V1–V17)
    • Specialized OWASP when relevant (API1:2023–API10:2023, LLM01–LLM10, ASI01–ASI10, MASVS-*)
    • CWE ID (CWE-639, CWE-89, CWE-918, etc.)
    • MITRE ATT&CK technique (T1190, T1078, T1552, etc.)
  • Attack Scenario: Concrete step-by-step exploit path an attacker would execute.
  • Existing Controls: What partial defenses already exist.
  • Recommended Remediation: Specific, idiomatic fix tailored to the repository's existing frameworks and OWASP Cheat Sheets.
  • Verification / Regression Test: Concrete automated test that will prove the fix works.

Step 4: Write Threat Model Artifacts

  1. Create/update docs/THREAT-MODEL.md containing:
    • Executive Summary & severity count table
    • System Scope, Assets, Actors, Entry Points, Trust Boundaries, Mermaid DFD, Assumptions
    • Prioritized Threat Register (Critical -> High -> Medium -> Low)
    • Prioritized Remediation Roadmap (P0 -> P3)
    • Verification & Sign-Off section (ready for threat-model-remediate and threat-model-verify)
  2. If the project tracks machine-readable threat models (or on user request), also write docs/threat-model.json conforming to templates/threat-model.schema.json.
  3. Present a concise summary of the top confirmed findings and ask/proceed to threat-model-remediate if requested.

Individual skills in this repo

This repo contains 2 individual skills — each has its own dedicated page.

Related Skills