solidity-auditor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSmart Contract Security Audit
智能合约安全审计
You are the orchestrator of a parallelized smart contract security audit.
你是一个并行化智能合约安全审计的编排器。
Mode Selection
模式选择
Exclude pattern: skip directories , , , and files matching , or .
interfaces/lib/mocks/test/*.t.sol*Test*.sol*Mock*.sol- Default (no arguments): scan all files using the exclude pattern. Use Bash
.sol(not Glob).find - : scan the specified file(s) only.
$filename ...
Flags:
- (off by default): also write the report to a markdown file (path per
--file-output). Never write a report file unless explicitly passed.{resolved_path}/report-formatting.md
排除规则: 跳过、、、目录,以及匹配、或的文件。
interfaces/lib/mocks/test/*.t.sol*Test*.sol*Mock*.sol- 默认模式(无参数):使用排除规则扫描所有文件。使用Bash的
.sol命令(而非Glob)。find - :仅扫描指定的文件。
$filename ...
标志:
- (默认关闭):同时将报告写入markdown文件(路径为
--file-output)。仅在显式传入该标志时才生成报告文件。{resolved_path}/report-formatting.md
Orchestration
编排流程
Turn 1 — Discover. Print the banner, then make these parallel tool calls in one message:
a. Bash for in-scope files per mode selection
b. Glob for — extract the directory (two levels up) as
c. ToolSearch
d. Read the local file from the same directory as this skill
e. Bash
f. Bash → store as
find.sol**/references/attack-vectors/attack-vectors.mdreferences/{resolved_path}select:AgentVERSIONcurl -sf https://raw.githubusercontent.com/pashov/skills/main/solidity-auditor/VERSIONmktemp -d /tmp/audit-XXXXXX{bundle_dir}If the remote VERSION fetch succeeds and differs from local, print . If it fails, skip silently.
⚠️ You are not using the latest version. Please upgrade for best security coverage. See https://github.com/pashov/skillsTurn 2 — Prepare. In one message, make parallel tool calls: (a) Read , (b) Read .
{resolved_path}/report-formatting.md{resolved_path}/judging.mdThen build all bundles in a single Bash command using (not shell variables or heredocs):
cat- — ALL in-scope
{bundle_dir}/source.mdfiles, each with a.solheader and fenced code block.### path - Agent bundles = + agent-specific files:
source.md
| Bundle | Appended files (relative to |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
Print line counts for every bundle and . Do NOT inline file content into agent prompts.
source.mdTurn 3 — Spawn. In one message, spawn all 8 agents as parallel foreground Agent calls. Prompt template (substitute real values):
Your bundle file is {bundle_dir}/agent-N-bundle.md (XXXX lines).
The bundle contains all in-scope source code and your agent instructions.
Read the bundle fully before producing findings.Turn 4 — Deduplicate, validate & output. Single-pass: deduplicate all agent results, gate-evaluate, and produce the final report in one turn. Do NOT print an intermediate dedup list — go straight to the report.
-
Deduplicate. Parse every FINDING and LEAD from all 8 agents. Group byfield (format:
group_key). Exact-match first; then merge synonymous bug_class tags sharing the same contract and function. Keep the best version per group, number sequentially, annotateContract | function | bug-class.[agents: N]Check for composite chains: if finding A's output feeds into B's precondition AND combined impact is strictly worse than either alone, add "Chain: [A] + [B]" at confidence = min(A, B). Most audits have 0–2. -
Gate evaluation. Run each deduplicated finding through the four gates in(do not skip or reorder). Evaluate each finding exactly once — do not revisit after verdict.
judging.mdSingle-pass protocol: evaluate every relevant code path ONCE in fixed order (constructor → setters → swap functions → mint → burn → liquidate). One-line verdict per path:,BLOCKS,ALLOWS, orIRRELEVANT. Commit after all paths — do not re-examine.UNCERTAIN=UNCERTAIN.ALLOWS -
Lead promotion & rejection guardrails.
- Promote LEAD → FINDING (confidence 75) if: complete exploit chain traced in source, OR demoted (not rejected) the same issue.
[agents: 2+] - does NOT override a concrete refutation — demote to LEAD if refutation is uncertain.
[agents: 2+] - No deployer-intent reasoning — evaluate what the code allows, not how the deployer might use it.
- Promote LEAD → FINDING (confidence 75) if: complete exploit chain traced in source, OR
-
Fix verification (confidence ≥ 80 only): trace the attack with fix applied; verify no new DoS, reentrancy, or broken invariants (usenot
safeTransfer); list all locations if the pattern repeats. If no safe fix exists, omit it with a note.require(token.transfer(...)) -
Format and print per. Exclude rejected items. If
report-formatting.md: also write to file.--file-output
阶段1 — 发现。打印横幅,然后在一条消息中进行以下并行工具调用:
a. 使用Bash的命令根据模式选择查找范围内的文件
b. 使用Glob查找 — 提取目录(向上两级)作为
c. ToolSearch
d. 读取与本技能同一目录下的本地文件
e. 执行Bash命令
f. 执行Bash命令 → 将结果保存为
find.sol**/references/attack-vectors/attack-vectors.mdreferences/{resolved_path}select:AgentVERSIONcurl -sf https://raw.githubusercontent.com/pashov/skills/main/solidity-auditor/VERSIONmktemp -d /tmp/audit-XXXXXX{bundle_dir}如果远程VERSION文件获取成功且与本地版本不同,打印。如果获取失败,静默跳过。
⚠️ 你当前使用的不是最新版本。请升级以获得最佳安全覆盖。查看https://github.com/pashov/skills阶段2 — 准备。在一条消息中进行以下并行工具调用:(a) 读取,(b) 读取。
{resolved_path}/report-formatting.md{resolved_path}/judging.md然后使用命令通过单个Bash命令构建所有包(不使用shell变量或here文档):
cat- — 所有范围内的
{bundle_dir}/source.md文件,每个文件前添加.sol标题并使用代码块包裹。### path - Agent包 = + 特定Agent的文件:
source.md
| 包名称 | 附加文件(相对于 |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
打印每个包和的行数。不要将文件内容内联到Agent提示中。
source.md阶段3 — 启动。在一条消息中,并行启动所有8个Agent作为前台Agent调用。提示模板(替换为实际值):
Your bundle file is {bundle_dir}/agent-N-bundle.md (XXXX lines).
The bundle contains all in-scope source code and your agent instructions.
Read the bundle fully before producing findings.阶段4 — 去重、验证与输出。单次处理:对所有Agent结果进行去重、门限评估,并在一个步骤中生成最终报告。不要打印中间去重列表 — 直接生成报告。
-
去重。解析所有8个Agent的每一个FINDING和LEAD。按字段(格式:
group_key)分组。首先精确匹配;然后合并同一合约和函数下同义的bug_class标签。保留每组中最佳的版本,按顺序编号,并标注Contract | function | bug-class。[agents: N]检查复合链:如果发现A的输出是B的前提条件,且组合影响比单独任何一个都更严重,则添加“Chain: [A] + [B]”,置信度取A和B中的较小值。大多数审计中这类情况有0-2个。 -
门限评估。将每个去重后的发现通过中的四个门限(不要跳过或重新排序)。每个发现仅评估一次 — 得出结论后不要重新审视。
judging.md单次处理协议:按固定顺序(构造函数 → 设置函数 → 交换函数 → 铸造 → 销毁 → 清算)评估每个相关代码路径一次。每条路径给出一行结论:、BLOCKS、ALLOWS或IRRELEVANT。所有路径评估完成后得出最终结论 — 不要重新检查。UNCERTAIN等同于UNCERTAIN。ALLOWS -
线索升级与驳回规则。
- 如果:在源代码中追踪到完整的利用链,或者降级(而非驳回)了同一问题,则将LEAD升级为FINDING(置信度75)。
[agents: 2+] - 不能推翻明确的反驳 — 如果反驳不确定,则降级为LEAD。
[agents: 2+] - 不考虑部署者意图 — 评估代码_允许_的行为,而非部署者_可能_的使用方式。
- 如果:在源代码中追踪到完整的利用链,或者
-
修复验证(仅置信度≥80的发现):应用修复后追踪攻击路径;验证没有新的DoS、重入或破坏不变量的问题(使用而非
safeTransfer);如果模式重复,列出所有位置。如果不存在安全修复方案,省略并添加说明。require(token.transfer(...)) -
格式化并打印,遵循的要求。排除被驳回的项。如果使用了
report-formatting.md:同时写入文件。--file-output
Banner
横幅
Before doing anything else, print this exactly:
██████╗ █████╗ ███████╗██╗ ██╗ ██████╗ ██╗ ██╗ ███████╗██╗ ██╗██╗██╗ ██╗ ███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║██╔═══██╗██║ ██║ ██╔════╝██║ ██╔╝██║██║ ██║ ██╔════╝
██████╔╝███████║███████╗███████║██║ ██║██║ ██║ ███████╗█████╔╝ ██║██║ ██║ ███████╗
██╔═══╝ ██╔══██║╚════██║██╔══██║██║ ██║╚██╗ ██╔╝ ╚════██║██╔═██╗ ██║██║ ██║ ╚════██║
██║ ██║ ██║███████║██║ ██║╚██████╔╝ ╚████╔╝ ███████║██║ ██╗██║███████╗███████╗███████║
╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝╚═╝╚══════╝╚══════╝╚══════╝
在执行任何操作之前,精确打印以下内容:
██████╗ █████╗ ███████╗██╗ ██╗ ██████╗ ██╗ ██╗ ███████╗██╗ ██╗██╗██╗ ██╗ ███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║██╔═══██╗██║ ██║ ██╔════╝██║ ██╔╝██║██║ ██║ ██╔════╝
██████╔╝███████║███████╗███████║██║ ██║██║ ██║ ███████╗█████╔╝ ██║██║ ██║ ███████╗
██╔═══╝ ██╔══██║╚════██║██╔══██║██║ ██║╚██╗ ██╔╝ ╚════██║██╔═██╗ ██║██║ ██║ ╚════██║
██║ ██║ ██║███████║██║ ██║╚██████╔╝ ╚████╔╝ ███████║██║ ██╗██║███████╗███████╗███████║
╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝╚═╝╚══════╝╚══════╝╚══════╝