c-review
它能做什么
对原生 C 和 C++ 程序进行安全审查,查找内存损坏、整数溢出、竞态条件等类似缺陷。适用于开发守护进程、服务和桌面软件的开发者和审计人员。
适用场景
- ✓审计人员审查原生 C 或 C++ 应用的内存安全问题的时候。
- ✓开发者检查守护进程或 Windows 服务中的整数溢出或竞态条件的时候。
- ✓团队需要对运行在用户空间的 C 或 C++ 代码进行安全审查的时候。
技能链接
https://github.com/trailofbits/skills/blob/main/plugins/c-review/skills/c-review/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请审查我的 C++ 网络服务,查找远程攻击者可能利用的内存错误和整数溢出。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能会询问威胁模型,例如远程还是本地攻击者,以及需要报告的范围和严重程度。然后它由各个独立的工作单元审查代码,并返回一份完整报告。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
C/C++ Security Review
Resolve four parameters, make one Workflow call, return the report. The workflow owns
concurrency, retries and result collection.
Use for: native C/C++ userspace — memory safety, integer overflow, races, type confusion, Linux/macOS daemons, Windows services.
Not for: kernel drivers or modules; managed languages (Java, C#, Python, Go, Rust); embedded or bare-metal code with no libc.
Phase 0 — Parameters
Parse any free text on the invocation line (flamenco only, high severity only, use haiku) and pre-fill what it implies. Then make one AskUserQuestion call for
whatever is still unresolved. Never silently default a required parameter.
| Parameter | Values | Inferring it from the invocation |
|---|---|---|
threat_model |
REMOTE / LOCAL_UNPRIVILEGED / BOTH |
"remote", "network", "attacker" → REMOTE; "local", "unprivileged" → LOCAL_UNPRIVILEGED; otherwise ask |
worker_model |
haiku / sonnet / opus / inherit |
An explicit model name. Otherwise ask. inherit uses the session model |
severity_filter |
all / medium / high |
"all", "every", "noisy" → all; "medium and above" → medium; "high only" → high; otherwise ask |
scope_subpath |
repo-relative directory, optional | "X only", "just audit X/" → the matching subdirectory, fuzzy-matched against top-level dirs. Absent → .. Ambiguous → ask |
Two scopes stay separate for the whole run:
finding_scope_root=scope_subpath(default.) — a finding must live inside it, and it is the tree the unit list is generated from.context_roots=.— read freely to establish callers, build flags and reachability. Narrow it tofinding_scope_rootonly if the user explicitly forbids wider reading, and say that reachability confidence drops when you do.
Phase 1 — Resolve paths
Resolve this plugin's directory from this SKILL.md's installed location to an absolute
plugin_root: it holds workflows/c-review.js,
agents/c-review-worker.md, and
scripts/assemble_findings.py. Print that path; stop if
any is missing. Do not search caches or the audited repository for another plugin copy.
# The workflow cannot call Date.now(), so the timestamp is made here.
output_dir="$(pwd)/.c-review-results/$(date -u +%Y%m%dT%H%M%SZ)"
mkdir -p "$output_dir"; echo "$output_dir"
# A Workflow script has no filesystem APIs, and `assemble_findings.py` resolves `--scope`
# against ITS OWN cwd. Resolve it once here and pass BOTH spellings, or the workflow strips
# `src/` from a finding's path while the assembler strips `/repo/src/`, and the two disagree
# about which findings are duplicates of each other.
scope_abs="$(cd "${scope_subpath:-.}" && pwd)" || echo "scope_subpath does not exist"
echo "$scope_abs"
uv must be on PATH: Detect runs the unit enumerator and Assemble runs
assemble_findings.py. If uv is missing, say so and stop — the whole review is
partitioned from that unit list.
Phase 2 — Run the workflow
Invoking this skill is the opt-in to multi-agent orchestration — call Workflow
without asking again. A review of a real codebase also runs past any default workflow
size guideline; that guideline is advisory and this is the case it exempts. Do not
shrink the fan-out to fit it, and do not substitute hand-spawned Agent calls.
One Workflow call. scriptPath takes the absolute path resolved in Phase 1; args
must be a real JSON object, not a JSON-encoded string.
Workflow({
scriptPath: "<plugin_root>/workflows/c-review.js",
args: {
outputDir: "<output_dir>",
pluginRoot: "<plugin_root>",
threatModel: "REMOTE",
severityFilter: "all",
findingScopeRoot: "expat/lib",
findingScopeRootAbs: "/abs/path/to/repo/expat/lib",
contextRoots: ".",
workerModel: "sonnet"
}
})
findingScopeRootAbs is the scope_abs from Phase 1 and is not optional in practice:
omitted, the workflow tells the assembler no absolute root is known and a finding filed as
/repo/expat/lib/xmlparse.c stops merging with the same bug filed as xmlparse.c.
Six further arguments are optional. Omitted, each takes its default; passed with the wrong TYPE, the workflow throws with the field name rather than defaulting. Pass them only when the user asks or when running an evaluation:
| Argument | Default | What i
常见问题
哪些内容不在涵盖范围内?
内核驱动程序、Java、Python、Go 和 Rust 等托管语言,以及没有 C 库的裸机代码,都不在范围内。
它会在运行前提问吗?
会。对于无法推断的设置,例如威胁模型或严重程度过滤,它会询问而不是猜测。
它能只检查一个文件夹吗?
可以。你可以把审查限制在项目的某个子文件夹中。
详情
作者的原始描述
Performs comprehensive C/C++ security review for memory corruption, integer overflows, race conditions, and platform-specific vulnerabilities. Use when auditing native C/C++ applications, reviewing daemons or services for memory safety, or hunting integer overflow / use-after-free / race conditions in userspace code.
repo: trailofbits/skills
热度
- GitHub 星标
- 8.0k
- 排名
- #12667
- 许可证
- CC-BY-SA-4.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
audit-context-building
8.0k帮你的智能体在安全审查之前熟悉一个陌生的代码库,梳理每个函数的假设、保证和依赖关系。
algorand-vulnerability-scanner
8.0k帮你的智能体扫描 TEAL 或 PyTeal 编写的 Algorand 智能合约,检查 11 类常见安全问题,如重新密钥攻击和未校验费用。
audit-prep-assistant
8.0k帮你的智能体为外部安全审查做好代码准备,包括静态分析、测试覆盖、死代码清理和清晰的文档。
cairo-vulnerability-scanner
8.0k帮你的智能体扫描 StarkNet 上的 Cairo 智能合约,检查 6 类严重问题,包括算术溢出、有风险的跨层消息和签名重放。