CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

Slither

$ slither 官方出品 低风险
Trail of Bits · 安全扫描与密钥管理 · AGPL-3.0 · macos / linux / windows

Slither(slither)对 Solidity 和 Vyper 智能合约执行快速的 AST、SSA 与数据流漏洞分析,兼容 Foundry、Hardhat、Truffle 及独立 .sol 文件。传入 --json - 可将结构化检测结果流式输出到 stdout,配合 --exclude-informational 与 --detect 可保持 Agent 审计结果精简。

FCRS-1.0 综合评分
87 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
pip install slither-analyzer
CLI vs MCP 选型建议 优先选 CLI

在 Foundry 或 Hardhat 工作区中直接运行 slither . --json - 可直接调用本地 solc 工具链,无需通过 MCP 传输整套合约源码。

Agent 友好度体检单

✓ 原生 JSON 输出
✓ 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md

当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。

FCRS-1.0 六维评分拆解

Agent 友好度 23 / 25

支持 --json - 标准输出流、--sarif、--detect、--exclude-informational 及 --list-detectors 自描述。

  • --json - streams structured detector output to stdout
  • Granular --detect, --exclude-low, and --exclude-informational filters
安全与权限边界 21 / 25

静态分析工具,绝不部署或广播交易,但会在本地调用 solc / Foundry / Hardhat 构建命令。

  • Purely local static analysis; compilation writes project build artifacts
安装与运行摩擦 12 / 15

可通过 pip install slither-analyzer 轻松安装,但项目需要匹配的 solc 版本(通常配合 solc-select)。

  • PyPI package plus external solc compiler dependency
能力覆盖与边际价值 14 / 15

业界标准的 Solidity 静态分析器,内置 90+ 检测器、打印器(human-summary、call-graph)及可升级性检查。

  • Deep Solidity/Vyper IR (SlithIR) analysis across Foundry and Hardhat
维护与来源背书 9 / 10

Trail of Bits 官方安全工程项目(crytic/slither),持续活跃更新。

  • Trail of Bits Crytic organization
文档与可验证性 8 / 10

GitHub Wiki 上提供详尽的检测器目录、打印器指南和框架集成文档。

  • Comprehensive detector docs in crytic/slither/wiki

安全边界、鉴权与放权指南

鉴权方式
无需鉴权 环境变量密钥
凭证存储位置

本地合约审计无需任何凭据;拉取链上已验证合约时使用 --etherscan-apikey 或 ETHERSCAN_API_KEY。

潜在副作用
只读查询 本地写入
费用与配额提示

本地审计 100% 免费、离线、开源(AGPL-3.0)。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Slither Agent Rules
- Always pass `--json -` (note the trailing `-` for stdout) and `--exclude-informational` to keep output structured and concise.
- Verify the matching `solc` compiler version is active via `solc-select` before diagnosing compilation errors.
- Remember Slither invokes Foundry/Hardhat compilation in the repo, which updates local `out/` or `artifacts/` directories.

Agent 高频安全命令配方

只读查询(安全推荐)

审计智能合约并将 JSON 流式输出至 stdout
slither . --json - --exclude-informational --exclude-low

运行 Slither 检测器,过滤低危与信息类噪音,并将 JSON 结果写入 stdout(-)。

列出所有内置漏洞检测器
slither --list-detectors

在不编译合约的情况下输出所有内置检测器及其严重程度和置信度元数据。

受控写入与预演

导出 SARIF 格式扫描报告
slither . --sarif slither-results.sarif

将 SARIF v2.1.0 报告写入 slither-results.sarif,用于 CI 代码安全扫描。

核心优势

  • + 原生支持 --json - 标准输出流与 --sarif 导出,并可按严重性与检测器过滤。
  • + 深度 Solidity/Vyper 中间表示(SlithIR)分析,原生适配 Foundry、Hardhat 与 solc。

注意事项与踩坑点

  • ! 需要与合约 pragma 精确匹配的 solc 版本(常需配合 solc-select 切换)。
  • ! 运行 slither . 会触发项目编译,未初始化依赖的工作区可能编译失败并写入构建产物。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI