跳到正文
Skillpedia
安全7.7k · #13105

threat-model

它能做什么

这项技能建立威胁模型,即描述系统可能遭受攻击方式的图谱。它可以依据与应用负责人的访谈、代码及其过往漏洞,或两者结合进行。适合规划安全审查的安全团队。

适用场景

  • ✓当你想在查找漏洞之前,先了解应用可能出现什么问题的时候。
  • ✓当应用负责人能够回答有关系统及其风险的问题的时候。
  • ✓当没有负责人,而你想基于代码和过往漏洞建立威胁模型的时候。

技能链接

https://github.com/anthropics/defending-code-reference-harness/blob/main/.claude/skills/threat-model/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/anthropics/defending-code-reference-harness/blob/main/.claude/skills/threat-model/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“你能根据我们的代码以及我回答的问题,为我的应用建立威胁模型吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体可以通过一组问题访谈应用负责人,也可以阅读代码和过往漏洞报告。然后它为该项目编写一个威胁模型文件。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

threat-model

A threat model answers "what could go wrong with this system, who would do it, and what should we do about it?" independently of whether any specific bug has been found yet. It is the map; vulnerability discovery is the metal detector. A good threat model tells the pipeline where to look and tells triage which findings matter.

Litmus test: If patching one line of code makes an entry disappear, it was a vulnerability, not a threat. A threat ("attacker achieves RCE via untrusted media parsing") still stands after every known bug is fixed; a vulnerability ("dr_wav.h:412 doesn't bounds-check chunk_size") does not. This skill produces threats. Vulnerabilities appear only as evidence that raises a threat's likelihood score.

Invocation: /threat-model [bootstrap-then-interview|bootstrap|interview] <target-dir> [flags]


Step 0 — Safety preamble (always runs first)

This skill performs static analysis only. It reads source, git history, and any vulnerability reports the user supplies, and writes a single output file (<target-dir>/THREAT_MODEL.md). It does not build, execute, fuzz, or modify the target, and does not make network requests against the target's infrastructure.

Before proceeding, confirm and state in your first response:

  1. The target directory exists and is a local checkout you can read.
  2. You will not execute any code from the target directory.
  3. If --vulns points at a URL or you are asked to "fetch CVEs", you will query only public advisory databases (NVD, GitHub Security Advisories, the project's own issue tracker) and never the target's live deployment.

If the user asks you to validate a threat by running an exploit, decline and point them at the vuln-pipeline (README Step 2) instead.


Step 1 — Route to a mode

Parse $ARGUMENTS:

First token Route to
interview Read interview.md in this directory and follow it.
bootstrap Read bootstrap.md in this directory and follow it.
bootstrap-then-interview Bootstrap first, then interview seeded from the draft. See below.
anything else, or empty Ask the user: "Is someone who owns or built this system available to answer questions in this session?" Yes and the codebase is checked out → recommend bootstrap-then-interview. Yes but no codebase → interview.md. No → bootstrap.md.

All modes write the same artifact (THREAT_MODEL.md, schema in schema.md) so downstream consumers (pipeline recon/judge, verifier agents) do not need to know which mode produced it.

interview bootstrap
Needs An application owner present in the session A local checkout; optionally past vulns
Method Four-question framework: conversational walk through what are we working on → what can go wrong → what are we going to do about it → did we do a good job Five stages: parallel research swarm → synthesize sections 1-3 + vuln table → generalize vulns into threat classes → STRIDE gap-fill → emit
Best for New systems, design reviews, systems where the risk lives in business logic the code doesn't show Inherited systems, third-party code, OSS dependencies, anything with a CVE history
Provenance tag interview bootstrap

Context durability. Interview mode is multi-turn; tool results from early reads may be evicted before you need them. To stay resilient:

  • Do not read interview.md or bootstrap.md in full up front. Read the mode file (or the relevant section of it) at the point you need it, one question or stage at a time.
  • If a re-read via the Read tool is refused as "file unchanged", the prior result was evicted; reload with cat <path> via Bash instead.

Interview backbone (so you can proceed even if interview.md is unavailable mid-session):

Q Question Fills schema sections
Q1 What are we working on? section 1 context, section 2 assets, section 3 entry points
Q2 What can go wrong? section 4 threat rows (id, threat, actor, surface, asset)
Q3 What are we going to do about it? section 4 impact/likelihood/status/controls; section 5 deprioritized; section 8 recommended mitigations
Q4 Did we do a good job? validate ranking, coverage check, section 6 open questions

bootstrap-then-interview mode

When the owner is available and the codebase is checked out, this is the recommended path: the owner's time goe

常见问题

什么是威胁模型?

它是攻击者可能危害系统的方式列表,并附有每种方式发生的可能性以及应对措施。

它会测试应用吗?

不会。技能只阅读代码和报告,不运行也不修改应用。

结果保存在哪里?

它会在目标项目文件夹中写入一个 markdown 格式的威胁模型文件。

详情

作者的原始描述

Build a threat model for a target codebase. Three modes: "interview" walks an application owner through the four-question framework and produces a threat model from their answers; "bootstrap" derives a threat model from the code plus past vulnerabilities (CVEs, git history, pentest reports) when no owner is available; "bootstrap-then-interview" chains the two when both owner and codebase are present. All write THREAT_MODEL.md in a shared schema. Use when asked to "threat model", "build a threat model", "map the attack surface", or "what should we be worried about in this codebase".

repo: anthropics/defending-code-reference-harness

热度

GitHub 星标
7.7k
排名
#13105
许可证
—
更新时间
2026/8/6

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能