agentleFS
saizulsaizul/security-audit-skills/skills/threat-modeling/SKILL.md

threat-modeling

Skill0 starsChanged 11 days agoMITView on GitHub

Lightweight STRIDE threat modeling for a feature or system you are building - capture components, data stores, external actors, data flows and trust boundaries as a small JSON model, generate a STRIDE-per-element threat table (spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege) with likelihood, impact, risk and mitigations, then refine it with the team into tracked actions. Use when the user asks for a threat model, STRIDE analysis, security design review, "what could go wrong with this architecture", abuse cases for a new feature, or security requirements before building something.

54 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use iac-security, container-security and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • hardw00tSkill

    iac-security

    Infrastructure-as-Code security scanning router for Terraform, CloudFormation, Kubernetes manifests, Helm, ARM/Bicep. Orchestrates Checkov, tfsec, Terrascan, KICS, kubesec, kube-linter, Polaris, cfn-lint/cfn-nag, and OPA/Conftest. Use when auditing IaC for misconfigurations, scanning Terraform plans, validating K8s security policies, checking cloud infrastructure compliance, or authoring custom policy-as-code (Rego).

    Also in 4 projects that use this

  • vbrevikSkill

    container-security

    Scan container images, Dockerfiles, docker-compose files, and Kubernetes manifests for security misconfigurations and vulnerabilities. Uses Trivy for image/IaC scanning and Kubescape for K8s policy compliance. Falls back to regex-based Dockerfile and K8s YAML analysis when tools are unavailable. Produces STIG V-ID-tagged findings for /stig-compliance pipeline. Use when (1) reviewing Docker or K8s configuration changes, (2) scanning container images for OS-level CVEs, (3) validating K8s RBAC and NetworkPolicy configuration, (4) before deployment. Works air-gapped with pre-downloaded vulnerability database.

    Also in 4 projects that use this

  • wgpsecSkill

    prompt-injection

    AI/LLM 间接 Prompt 注入攻击。当目标 AI 系统会处理外部数据源(网页、文档、邮件、数据库、API 返回)时使用。覆盖间接注入、工具链劫持、RAG 投毒、数据外泄等技术。OWASP LLM Top 10 #1 漏洞类别

    Also in 4 projects that use this

  • narlyseorgSkill

    secure-code-review

    Use when reviewing source code for security vulnerabilities, performing static analysis of a codebase, auditing code for injection flaws, authentication issues, cryptographic weaknesses, insecure deserialization, SSRF, path traversal, memory safety bugs, hardcoded secrets, or misconfigurations. Use when the user asks to find security bugs in code, assess code quality from a security perspective, or review pull requests for security implications. Use when performing dependency audits, secrets scanning, or configuration review of application source.

    Also in 4 projects that use this

  • allanninalSkill

    threat-hunting

    Hunt threats using Sigma detection rules and security analysis techniques. Use when investigating security incidents, creating detection rules, or analyzing suspicious activity.

    Also in 3 projects that use this

  • testified-ossSkill

    exploratory-testing

    Guide exploratory testing sessions including charter creation, session-based testing, heuristics application, and finding documentation. Use when planning exploratory testing, conducting test sessions, or documenting discoveries.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 48 edited versions we read keep these.

  • 2

    Distinctive

    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. Distinctive:

    Add threats the template cannot know: business logic abuse, race conditions, insider and support-tool misuse, data retention, account …

    line 58
  2. Very specific:

    Keep it alive: Commit the model and table next to the code (for example docs/threat-model/), and re-run when a flow, store or boundary …

    line 64
  3. Distinctive:

    Follow the table with: the top 5 risks in plain language, decisions taken (mitigate/accept), open questions for the team, and what was out …

    line 76

“Common” is measured: kept by at least 6 in 10 of the 48 edited versions of this file we could read. “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

Threat modeling (STRIDE)

Answer four questions: what are we building, what can go wrong, what are we going to do about it, and did we do a good job. The script handles the mechanical part (every element gets the applicable STRIDE categories, model facts raise risk); the value comes from reviewing the table with someone who knows the system. Paths below are relative to this skill's folder (in Claude Code: ${CLAUDE_SKILL_DIR}).

When to use

  • "Threat model this feature / service / architecture", "do a STRIDE analysis"
  • A design doc or pull request introduces a new trust boundary: public API, webhook, file upload, third-party integration, admin tool, multi-tenant data, payments
  • Preparing security requirements or test cases before implementation

When not to use

  • Reviewing existing code for bugs: owasp-web-review (it may suggest a threat model for risky features)
  • Compliance risk registers or organisation-wide risk assessments (different granularity)
  • Threat modeling systems you do not own or have no permission to assess

Workflow

  1. Scope one thing. A feature, a service or a user journey - not "the whole company". Ask for (or read) the design doc, architecture diagram, API routes and infrastructure files.
  2. Write the model as JSON, starting from assets/model-template.json. Rules of thumb:
    • external: people and systems you do not control (browser, mobile app, payment provider).
    • process: code you run (API, worker, lambda, cron job). Mark internet_facing: true.
    • store: databases, caches, buckets, queues at rest, log stores. List sensitive data (pii, credentials, payment, health, secrets, tokens, keys, financial) and encrypted_at_rest.
    • flows: who sends data to whom, with protocol, authenticated and data.
    • zone: give elements in different trust levels different zones (internet, dmz, internal, third-party, admin). A flow between zones crosses a trust boundary. Show the model to the user and confirm it matches reality before generating threats.
  3. Generate the table.
    python3 scripts/stride.py model.json > THREATS.md
    python3 scripts/stride.py model.json --format csv > threats.csv     # for a spreadsheet/tracker
    python3 scripts/stride.py model.json --format json --min-risk Medium
    Exit 2 = invalid model (unknown element id, bad type, duplicate id).
  4. Refine with judgment using references/stride-guide.md:
    • Replace generic threats with specific ones ("any merchant can call /refunds for another merchant's order") and delete threats that truly do not apply - say why.
    • Add threats the template cannot know: business logic abuse, race conditions, insider and support-tool misuse, data retention, account recovery.
    • Adjust likelihood/impact (1-3) with the user; note existing controls.
  5. Decide per threat: mitigate (name the control and owner), accept (with reason and review date), transfer, or eliminate (remove the feature/data). Turn mitigations into tickets or acceptance criteria and tests.
  6. Keep it alive. Commit the model and table next to the code (for example docs/threat-model/), and re-run when a flow, store or boundary changes.

Output

# Threat model: Example shop
40 candidate threats - High 10, Medium 30, Low 0 ...
| ID | Element | STRIDE | Threat | Mitigation | L | I | Risk | Status |
| T01 | Payment webhook (Payment provider -> Web/API) | Spoofing | Requests ... without authentication ... | Require authentication ... | 3 | 3 | High | open |

Follow the table with: the top 5 risks in plain language, decisions taken (mitigate/accept), open questions for the team, and what was out of scope.

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.