crytic/slither

GitHub: crytic/slither

Slither 是一款专为 Solidity 和 Vyper 智能合约设计的静态分析框架,能以极低误报率快速检测漏洞并辅助代码审查。

Stars: 6148 | Forks: 1087

# [Slither,智能合约静态分析器](https://crytic.github.io/slither/slither.html) Slither Static Analysis Framework Logo [![构建状态](https://img.shields.io/github/actions/workflow/status/crytic/slither/ci.yml?branch=master)](https://github.com/crytic/slither/actions?query=workflow%3ACI) ![PyPI](https://img.shields.io/pypi/v/slither-analyzer?logo=python&logoColor=white&label=slither-analyzer) [![Slither - 阅读文档](https://img.shields.io/badge/Slither-Read_the_Docs-2ea44f)](https://crytic.github.io/slither/slither.html) [![Slither - 维基](https://img.shields.io/badge/Slither-Wiki-2ea44f)](https://github.com/crytic/slither/wiki/SlithIR) **Slither** 是一个用 Python3 编写的 Solidity & Vyper 静态分析框架。它运行一套漏洞检测器,打印有关合约详情的可视化信息,并提供一个 API 以轻松编写自定义分析。Slither 使开发者能够发现漏洞,增强对代码的理解,并快速原型化自定义分析。 * [功能特性](#features) * [用法](#usage) * [如何安装](#how-to-install) * [使用 uv(推荐)](#using-uv-recommended) * [使用 Pip](#using-pip) * [使用 Git](#using-git-development) * [使用 Docker](#using-docker) * [集成](#integration) * [检测器](#detectors) * [打印机](#printers) * [快速审查打印机](#quick-review-printers) * [深度审查打印机](#in-depth-review-printers) * [工具](#tools) * [API 文档](#api-documentation) * [获取帮助](#getting-help) * [常见问题](#faq) * [许可证](#license) * [出版物](#publications) * [Trail of Bits 出版物](#trail-of-bits-publication) * [外部出版物](#external-publications) ## 功能特性 * 检测有漏洞的 Solidity 代码,具有低误报率(参见[战利品](./trophies.md)列表) * 识别错误条件在源代码中发生的位置 * 轻松集成到持续集成和 Hardhat/Foundry 构建中 * 内置“打印机”快速报告关键合约信息 * Detector API 用于用 Python 编写自定义分析 * 能够分析用 Solidity >= 0.4 编写的合约 * 中间表示([SlithIR](https://github.com/crytic/slither/wiki/SlithIR))实现简单、高精度的分析 * 正确解析 99.9% 的所有公开 Solidity 代码 * 每个合约的平均执行时间少于 1 秒 * 在 [CI](https://github.com/marketplace/actions/slither-action) 中与 Github 的代码扫描集成 * 支持 Vyper 智能合约 ## 用法 在 Hardhat/Foundry/Dapp/Brownie 应用程序上运行 Slither: ``` slither . ``` 如果你的项目有依赖项,这是首选选项,因为 Slither 依赖底层编译框架来编译源代码。 但是,你可以在不导入依赖项的单个文件上运行 Slither: ``` slither tests/uninitialized.sol ``` ## 如何安装 ### 使用 uv(推荐) [uv](https://github.com/astral-sh/uv) 是一个快速的 Python 包管理器,速度比 pip 快 10-100 倍。 ``` # 如尚未安装请先安装 uv curl -LsSf https://astral.sh/uv/install.sh | sh # 将 slither 作为工具安装 uv tool install slither-analyzer # 或者在不安装的情况下运行 slither uvx slither-analyzer ``` 升级: ``` uv tool upgrade slither-analyzer ``` ### 使用 Pip ``` python3 -m pip install slither-analyzer ``` 升级: ``` python3 -m pip install --upgrade slither-analyzer ``` ### 使用 Brew ``` brew install slither-analyzer ``` ### 使用 Git(开发版) ``` git clone https://github.com/crytic/slither.git && cd slither # 作为可编辑模式安装以进行开发 uv tool install -e . # 或者使用 uv run 进行测试而无需安装 uv run slither ``` `-e` 标志以可编辑模式安装,这意味着对源代码的更改会立即生效,无需重新安装。 ### 使用 Docker 使用 [`eth-security-toolbox`](https://github.com/crytic/eth-security-toolbox/) docker 镜像。它在一个镜像中包含我们所有的安全工具和每个主要版本的 Solidity。`/home/share` 将挂载到容器中的 `/share`。 ``` docker pull trailofbits/eth-security-toolbox ``` 在容器中共享目录: ``` docker run -it -v /home/share:/share trailofbits/eth-security-toolbox ``` ### 集成 * 对于 GitHub action 集成,请使用 [slither-action](https://github.com/marketplace/actions/slither-action)。 * 对于 pre-commit 集成,请使用(将 `$GIT_TAG` 替换为真实标签) - repo: https://github.com/crytic/slither rev: $GIT_TAG hooks: - id: slither * 要生成 Markdown 报告,请使用 `slither [target] --checklist`。 * 要生成带有 GitHub 源代码高亮的 Markdown,请使用 `slither [target] --checklist --markdown-root https://github.com/ORG/REPO/blob/COMMIT/`(替换 `ORG`、`REPO`、`COMMIT`) ## 检测器 编号 | 检测器 | 检测内容 | 影响 | 置信度 --- | --- | --- | --- | --- 1 | `abiencoderv2-array` | [存储 abiencoderv2 数组](https://github.com/crytic/slither/wiki/Detector-Documentation#storage-abiencoderv2-array) | 高 | 高 2 | `arbitrary-send-erc20` | [transferFrom 使用任意 `from`](https://github.com/crytic/slither/wiki/Detector-Documentation#arbitrary-from-in-transferfrom) | 高 | 高 3 | `array-by-reference` | [按值修改存储数组](https://github.com/crytic/slither/wiki/Detector-Documentation#modifying-storage-array-by-value) | 高 | 高 4 | `encode-packed-collision` | [ABI encodePacked 冲突](https://github.com/crytic/slither/wiki/Detector-Documentation#abi-encodePacked-collision) | 高 | 高 5 | `incorrect-shift` | [移位指令中的参数顺序不正确。](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-shift-in-assembly) | 高 | 高 6 | `multiple-constructors` | [多个构造函数方案](https://github.com/crytic/slither/wiki/Detector-Documentation#multiple-constructor-schemes) | 高 | 高 7 | `name-reused` | [合约名称被重用](https://github.com/crytic/slither/wiki/Detector-Documentation#name-reused) | 高 | 高 8 | `protected-vars` | [检测到未受保护的变量](https://github.com/crytic/slither/wiki/Detector-Documentation#protected-variables) | 高 | 高 9 | `public-mappings-nested` | [具有嵌套变量的公共映射](https://github.com/crytic/slither/wiki/Detector-Documentation#public-mappings-with-nested-variables) | 高 | 高 10 | `rtlo` | [使用了从右到左覆盖控制字符](https://github.com/crytic/slither/wiki/Detector-Documentation#right-to-left-override-character) | 高 | 高 11 | `shadowing-state` | [状态变量遮蔽](https://github.com/crytic/slither/wiki/Detector-Documentation#state-variable-shadowing) | 高 | 高 12 | `suicidal` | [允许任何人销毁合约的函数](https://github.com/crytic/slither/wiki/Detector-Documentation#suicidal) | 高 | 高 13 | `uninitialized-state` | [未初始化的状态变量](https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-state-variables) | 高 | 高 14 | `uninitialized-storage` | [未初始化的存储变量](https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-storage-variables) | 高 | 高 15 | `unprotected-upgrade` | [未受保护的可升级合约](https://github.com/crytic/slither/wiki/Detector-Documentation#unprotected-upgradeable-contract) | 高 | 高 16 | `arbitrary-send-erc20-permit` | [transferFrom 在 permit 下使用任意 from](https://github.com/crytic/slither/wiki/Detector-Documentation#arbitrary-from-in-transferfrom-used-with-permit) | 高 | 中 17 | `arbitrary-send-eth` | [向任意目的地发送 Ether 的函数](https://github.com/crytic/slither/wiki/Detector-Documentation#functions-that-send-ether-to-arbitrary-destinations) | 高 | 中 18 | `controlled-array-length` | [受污染的数组长度赋值](https://github.com/crytic/slither/wiki/Detector-Documentation#array-length-assignment) | 高 | 中 19 | `controlled-delegatecall` | [受控制的 delegatecall 目标](https://github.com/crytic/slither/wiki/Detector-Documentation#controlled-delegatecall) | 高 | 中 20 | `delegatecall-loop` | [在循环中使用 `delegatecall` 的应付函数](https://github.com/crytic/slither/wiki/Detector-Documentation/#payable-functions-using-delegatecall-inside-a-loop) | 高 | 中 21 | `incorrect-exp` | [不正确的求幂](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-exponentiation) | 高 | 中 22 | `incorrect-return` | [如果在汇编模式下错误地使用了 `return`。](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-return-in-assembly) | 高 | 中 23 | `msg-value-loop` | [循环中的 msg.value](https://github.com/crytic/slither/wiki/Detector-Documentation/#msgvalue-inside-a-loop) | 高 | 中 24 | `reentrancy-eth` | [重入漏洞(以太币被盗)](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities) | 高 | 中 25 | `reentrancy-balance` | [导致余额检查过期的重入漏洞](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-4) | 高 | 中 26 | `return-leave` | [如果使用了 `return` 而不是 `leave`。](https://github.com/crytic/slither/wiki/Detector-Documentation#return-instead-of-leave-in-assembly) | 高 | 中 27 | `storage-array` | [有符号存储整数数组编译器错误](https://github.com/crytic/slither/wiki/Detector-Documentation#storage-signed-integer-array) | 高 | 中 28 | `unchecked-transfer` | [未检查的代币转账](https://github.com/crytic/slither/wiki/Detector-Documentation#unchecked-transfer) | 高 | 中 29 | `weak-prng` | [弱 PRNG](https://github.com/crytic/slither/wiki/Detector-Documentation#weak-PRNG) | 高 | 中 30 | `domain-separator-collision` | [检测具有与 EIP-2612 的 DOMAIN_SEPARATOR() 签名冲突的函数的 ERC20 代币](https://github.com/crytic/slither/wiki/Detector-Documentation#domain-separator-collision) | 中 | 高 31 | `enum-conversion` | [检测危险的枚举转换](https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-enum-conversion) | 中 | 高 32 | `erc20-interface` | [不正确的 ERC20 接口](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-erc20-interface) | 中 | 高 33 | `erc721-interface` | [不正确的 ERC721 接口](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-erc721-interface) | 中 | 高 34 | `incorrect-equality` | [危险的严格相等](https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-strict-equalities) | 中 | 高 35 | `locked-ether` | [锁定以太币的合约](https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether) | 中 | 高 36 | `mapping-deletion` | [删除包含结构的映射](https://github.com/crytic/slither/wiki/Detector-Documentation#deletion-on-mapping-containing-a-structure) | 中 | 高 37 | `pyth-deprecated-functions` | [检测 Pyth 已弃用的函数](https://github.com/crytic/slither/wiki/Detector-Documentation#pyth-deprecated-functions) | 中 | 高 38 | `pyth-unchecked-confidence` | [检测未检查 Pyth 价格置信度的情况](https://github.com/crytic/slither/wiki/Detector-Documentation#pyth-unchecked-confidence-level) | 中 | 高 39 | `pyth-unchecked-publishtime` | [检测未检查 Pyth 价格发布时间的情况](https://github.com/crytic/slither/wiki/Detector-Documentation#pyth-unchecked-publishtime) | 中 | 高 40 | `shadowing-abstract` | [来自抽象合约的状态变量遮蔽](https://github.com/crytic/slither/wiki/Detector-Documentation#state-variable-shadowing-from-abstract-contracts) | 中 | 高 41 | `tautological-compare` | [将变量与自身比较总是返回真或假,具体取决于比较](https://github.com/crytic/slither/wiki/Detector-Documentation#tautological-compare) | 中 | 高 42 | `tautology` | [重言式或矛盾式](https://github.com/crytic/slither/wiki/Detector-Documentation#tautology-or-contradiction) | 中 | 高 43 | `write-after-write` | [未使用的写入](https://github.com/crytic/slither/wiki/Detector-Documentation#write-after-write) | 中 | 高 44 | `boolean-cst` | [布尔常量的误用](https://github.com/crytic/slither/wiki/Detector-Documentation#misuse-of-a-boolean-constant) | 中 | 中 45 | `chronicle-unchecked-price` | [检测未检查 Chronicle 价格的情况。](https://github.com/crytic/slither/wiki/Detector-Documentation#chronicle-unchecked-price) | 中 | 中 46 | `constant-function-asm` | [使用汇编代码的常量函数](https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-using-assembly-code) | 中 | 中 47 | `constant-function-state` | [更改状态的常量函数](https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-changing-the-state) | 中 | 中 48 | `divide-before-multiply` | [不精确的算术运算顺序](https://github.com/crytic/slither/wiki/Detector-Documentation#divide-before-multiply) | 中 | 中 49 | `gelato-unprotected-randomness` | [在未受保护的函数中调用 `_requestRandomness`](https://github.com/crytic/slither/wiki/Detector-Documentation#gelato-unprotected-randomness) | 中 | 中 50 | `out-of-order-retryable` | [乱序可重试交易](https://github.com/crytic/slither/wiki/Detector-Documentation#out-of-order-retryable-transactions) | 中 | 中 51 | `reentrancy-no-eth` | [重入漏洞(无以太币被盗)](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-1) | 中 | 中 52 | `reused-constructor` | [重用的基础构造函数](https://github.com/crytic/slither/wiki/Detector-Documentation#reused-base-constructors) | 中 | 中 53 | `tx-origin` | [`tx.origin` 的危险使用](https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-usage-of-txorigin) | 中 | 中 54 | `unchecked-lowlevel` | [未检查的低级调用](https://github.com/crytic/slither/wiki/Detector-Documentation#unchecked-low-level-calls) | 中 | 中 55 | `unchecked-send` | [未检查的发送](https://github.com/crytic/slither/wiki/Detector-Documentation#unchecked-send) | 中 | 中 56 | `uninitialized-local` | [未初始化的局部变量](https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-local-variables) | 中 | 中 57 | `unused-return` | [未使用的返回值](https://github.com/crytic/slither/wiki/Detector-Documentation#unused-return) | 中 | 中 58 | `chainlink-feed-registry` | [检测使用 chainlink feed registry 的情况](https://github.com/crytic/slither/wiki/Detector-Documentation#chainlink-feed-registry-usage) | 低 | 高 59 | `incorrect-modifier` | [可能返回默认值的修饰符](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-modifier) | 低 | 高 60 | `optimism-deprecation` | [检测使用已弃用的 Optimism 预部署或函数的情况。](https://github.com/crytic/slither/wiki/Detector-Documentation#optimism-deprecated-predeploy-or-function) | 低 | 高 61 | `shadowing-builtin` | [内置符号遮蔽](https://github.com/crytic/slither/wiki/Detector-Documentation#builtin-symbol-shadowing) | 低 | 高 62 | `shadowing-local` | [局部变量遮蔽](https://github.com/crytic/slither/wiki/Detector-Documentation#local-variable-shadowing) | 低 | 高 63 | `uninitialized-fptr-cst` | [构造函数中未初始化的函数指针调用](https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-function-pointers-in-constructors) | 低 | 高 64 | `variable-scope` | [在声明之前使用的局部变量](https://github.com/crytic/slither/wiki/Detector-Documentation#pre-declaration-usage-of-local-variables) | 低 | 高 65 | `void-cst` | [构造函数调用未实现]() | 低 | 高 66 | `calls-loop` | [循环中的多次调用](https://github.com/crytic/slither/wiki/Detector-Documentation/#calls-inside-a-loop) | 低 | 中 67 | `events-access` | [缺少事件访问控制](https://github.com/crytic/slither/wiki/Detector-Documentation#missing-events-access-control) | 低 | 中 68 | `events-maths` | [缺少事件算术](https://github.com/crytic/slither/wiki/Detector-Documentation#missing-events-arithmetic) | 低 | 中 69 | `incorrect-unary` | [危险的一元表达式](https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-unary-expressions) | 低 | 中 70 | `missing-zero-check` | [缺少零地址验证](https://github.com/crytic/slither/wiki/Detector-Documentation#missing-zero-address-validation) | 低 | 中 71 | `reentrancy-benign` | [良性重入漏洞](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-2) | 低 | 中 72 | `reentrancy-events` | [导致事件乱序的重入漏洞](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-3) | 低 | 中 73 | `return-bomb` | [低级被调用者可能会意外消耗调用者所有 gas。](https://github.com/crytic/slither/wiki/Detector-Documentation#return-bomb) | 低 | 中 74 | `timestamp` | [`block.timestamp` 的危险使用](https://github.com/crytic/slither/wiki/Detector-Documentation#block-timestamp) | 低 | 中 75 | `assembly` | [汇编使用](https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage) | 信息 | 高 76 | `assert-state-change` | [断言状态改变](https://github.com/crytic/slither/wiki/Detector-Documentation#assert-state-change) | 信息 | 高 77 | `boolean-equal` | [与布尔常量的比较](https://github.com/crytic/slither/wiki/Detector-Documentation#boolean-equality) | 信息 | 高 78 | `cyclomatic-complexity` | [检测具有高(> 11)循环复杂度的函数](https://github.com/crytic/slither/wiki/Detector-Documentation#cyclomatic-complexity) | 信息 | 高 79 | `deprecated-standards` | [已弃用的 Solidity 标准](https://github.com/crytic/slither/wiki/Detector-Documentation#deprecated-standards) | 信息 | 高 80 | `erc20-indexed` | [未索引的 ERC20 事件参数](https://github.com/crytic/slither/wiki/Detector-Documentation#unindexed-erc20-event-parameters) | 信息 | 高 81 | `function-init-state` | [初始化状态变量的函数](https://github.com/crytic/slither/wiki/Detector-Documentation#function-initializing-state) | 信息 | 高 82 | `incorrect-using-for` | [检测当给定库中没有函数匹配给定类型时使用 using-for 语句的情况](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-usage-of-using-for-statement) | 信息 | 高 83 | `low-level-calls` | [低级调用](https://github.com/crytic/slither/wiki/Detector-Documentation#low-level-calls) | 信息 | 高 84 | `missing-inheritance` | [缺少继承](https://github.com/crytic/slither/wiki/Detector-Documentation#missing-inheritance) | 信息 | 高 85 | `naming-convention` | [符合 Solidity 命名约定](https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions) | 信息 | 高 86 | `pragma` | [如果使用了不同的 pragma 指令](https://github.com/crytic/slither/wiki/Detector-Documentation#different-pragma-directives-are-used) | 信息 | 高 87 | `redundant-statements` | [冗余语句](https://github.com/crytic/slither/wiki/Detector-Documentation#redundant-statements) | 信息 | 高 88 | `solc-version` | [不正确的 Solidity 版本](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-versions-of-solidity) | 信息 | 高 89 | `unimplemented-functions` | [未实现的函数](https://github.com/crytic/slither/wiki/Detector-Documentation#unimplemented-functions) | 信息 | 高 90 | `unindexed-event-address` | [具有地址参数但没有索引参数的事件](https://github.com/crytic/slither/wiki/Detector-Documentation#unindexed-event-address-parameters) | 信息 | 高 91 | `unused-state` | [未使用的状态变量](https://github.com/crytic/slither/wiki/Detector-Documentation#unused-state-variable) | 信息 | 高 92 | `costly-loop` | [循环中的昂贵操作](https://github.com/crytic/slither/wiki/Detector-Documentation#costly-operations-inside-a-loop) | 信息 | 中 93 | `dead-code` | [未使用的函数](https://github.com/crytic/slither/wiki/Detector-Documentation#dead-code) | 信息 | 中 94 | `reentrancy-unlimited-gas` | [通过 send 和 transfer 的重入漏洞](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-4) | 信息 | 中 95 | `too-many-digits` | [符合数字表示法最佳实践](https://github.com/crytic/slither/wiki/Detector-Documentation#too-many-digits) | 信息 | 中 96 | `cache-array-length` | [检测在其循环条件中使用某些存储数组的 `length` 成员并且不修改它的 `for` 循环。](https://github.com/crytic/slither/wiki/Detector-Documentation#cache-array-length) | 优化 | 高 97 | `constable-states` | [可以声明为常量的状态变量](https://github.com/crytic/slither/wiki/Detector-Documentation#state-variables-that-could-be-declared-constant) | 优化 | 高 98 | `external-function` | [可以声明为 external 的 public 函数](https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-external) | 优化 | 高 99 | `immutable-states` | [可以声明为 immutable 的状态变量](https://github.com/crytic/slither/wiki/Detector-Documentation#state-variables-that-could-be-declared-immutable) | 优化 | 高 100 | `var-read-using-this` | [合约使用 `this` 读取自己的变量](https://github.com/crytic/slither/wiki/Detector-Documentation#public-variable-read-in-external-context) | 优化 | 高 欲了解更多信息,请参阅 * [检测器文档](https://github.com/crytic/slither/wiki/Detector-Documentation),了解每个检测器的详细信息 * [检测选择](https://github.com/crytic/slither/wiki/Usage#detector-selection),仅运行选定的检测器。默认情况下,所有检测器都会运行。 * [分类模式](https://github.com/crytic/slither/wiki/Usage#triage-mode),过滤个别结果 ## 打印机 ### 快速审查打印机 * `human-summary`:[打印合约的人类可读摘要](https://github.com/trailofbits/slither/wiki/Printer-documentation#human-summary) * `inheritance-graph`:[将每个合约的继承图导出到 dot 文件](https://github.com/trailofbits/slither/wiki/Printer-documentation#inheritance-graph) * `contract-summary`:[打印合约摘要](https://github.com/trailofbits/slither/wiki/Printer-documentation#contract-summary) * `loc`:[计算在源文件 (SRC)、依赖项 (DEP) 和测试文件 (TEST) 中找到的代码总行数 (LOC)、源代码行数 (SLOC) 和注释代码行数 (CLOC)。](https://github.com/trailofbits/slither/wiki/Printer-documentation#loc) * `entry-points`:[打印所有更改状态的入口点函数及其变量](https://github.com/trailofbits/slither/wiki/Printer-documentation#entry-points) ### 深度审查打印机 * `call-graph`:[将合约的调用图导出到 dot 文件](https://github.com/crytic/slither/wiki/Printer-documentation#call-graph) * `cfg`:[导出每个函数的 CFG](https://github.com/crytic/slither/wiki/Printer-documentation#cfg) * `function-summary`:[打印函数摘要](https://github.com/crytic/slither/wiki/Printer-documentation#function-summary) * `vars-and-auth`:[打印写入的状态变量和函数的授权](https://github.com/crytic/slither/wiki/Printer-documentation#variables-written-and-authorization) * `not-pausable`:[打印不使用 `whenNotPaused` 修饰符的函数](https://github.com/crytic/slither/wiki/Printer-documentation#when-not-paused). 要运行打印机,请使用 `--print` 和逗号分隔的打印机列表。 完整列表请参见[打印机文档](https://github.com/crytic/slither/wiki/Printer-documentation)。 ## 工具 * `slither-check-upgradeability`:[审查基于 `delegatecall` 的可升级性](./docs/src/tools/Upgradeability-Checks.md) * `slither-prop`:[自动单元测试和属性生成](./docs/src/tools/Property-generation.md) * `slither-flat`:[扁平化代码库](./docs/src/tools/Contract-Flattening.md) * `slither-check-erc`:[检查 ERC 的一致性](./docs/src/tools/ERC-Conformance.md) * `slither-read-storage`:[从合约读取存储值](./docs/src/tools/ReadStorage.md) * `slither-interface`:[为合约生成接口](./docs/src/tools/Interface.md) 更多工具请参见[工具文档](./docs/src/tools/README.md)。 [联系我们](https://www.trailofbits.com/contact/) 获取构建自定义工具的帮助。 ## API 文档 Slither 内部机制的文档可在[此处](https://crytic.github.io/slither/slither.html)获取。 ## 获取帮助 欢迎访问我们的 [Slack 频道](https://empireslacking.herokuapp.com) (#ethereum) 获取有关使用或扩展 Slither 的帮助。 * [打印机文档](https://github.com/crytic/slither/wiki/Printer-documentation) 描述了 Slither 能够为每个合约可视化的信息。 * [检测器文档](https://github.com/crytic/slither/wiki/Adding-a-new-detector) 描述了如何编写新的漏洞分析。 * [API 文档](https://github.com/crytic/slither/wiki/Python-API) 描述了可用于自定义分析的方法和对象。 * [SlithIR 文档](https://github.com/crytic/slither/wiki/SlithIR) 描述了 SlithIR 中间表示。 ## 常见问题 如何排除 mocks 或 tests? * 查看我们关于[路径过滤](https://github.com/crytic/slither/wiki/Usage#path-filtering)的文档。 如何修复“未知文件”或编译问题? * 因为 slither 需要 solc AST,它必须拥有所有可用的依赖项。 如果合约具有依赖项,`slither contract.sol` 将失败。 相反,请在 `contracts/` 的父目录中使用 `slither .`(运行 `ls` 时应该看到 `contracts/`)。 如果有 `node_modules/` 文件夹,它必须与 `contracts/` 位于同一目录中。要验证此问题是否与 slither 有关, 请运行你正在使用的框架的编译命令,例如 `npx hardhat compile`。该命令必须成功运行; 否则,slither 的编译引擎 crytic-compile 无法生成 AST。 ## 许可证 Slither 根据 AGPLv3 许可证授权和分发。如果你正在寻找条款的例外情况,请[联系我们](mailto:opensource@trailofbits.com)。 ## 出版物 ### Trail of Bits 出版物 * [Slither:智能合约静态分析框架](https://arxiv.org/abs/1908.09878), Josselin Feist, Gustavo Grieco, Alex Groce - WETSEB '19 ### 外部出版物 标题 | 用途 | 作者 | 出版物 | 代码 --- | --- | --- | --- | --- [ReJection:一种基于 AST 的重入漏洞检测方法](https://www.researchgate.net/publication/339354823_ReJection_A_AST-Based_Reentrancy_Vulnerability_Detection_Method) | 基于 Slither 的 AST 分析 | Rui Ma, Zefeng Jian, Guangyuan Chen, Ke Ma, Yujia Chen | CTCIS 19 | - [MPro:结合静态和符号分析用于智能合约的可扩展测试](https://arxiv.org/pdf/1911.00570.pdf) | 通过 Slither 利用数据依赖 | William Zhang, Sebastian Banescu, Leodardo Pasos, Steven Stewart, Vijay Ganesh | ISSRE 2019 | [MPro](https://github.com/QuanZhang-William/M-Pro) [ETHPLOIT:从模糊测试到针对智能合约的高效漏洞利用生成](https://wcventure.github.io/FuzzingPaper/Paper/SANER20_ETHPLOIT.pdf) | 通过 Slither 利用数据依赖 | Qingzhao Zhang, Yizhuo Wang, Juanru Li, Siqi Ma | SANER 20 | - [以太坊智能合约验证:一种模型检查方法](http://www.ijmlc.org/vol10/977-AM0059.pdf) | 基于 Slither 的 CFG 构建符号执行 | Tam Bang, Hoang H Nguyen, Dung Nguyen, Toan Trieu, Tho Quan | IJMLC 20 | - [智能合约修复](https://arxiv.org/pdf/1912.05823.pdf) | 依赖 Slither 的漏洞检测器 | Xiao Liang Yu, Omar Al-Bataineh, David Lo, Abhik Roychoudhury | TOSEM 20 | [SCRepair](https://github.com/xiaoly8/SCRepair/) [揭秘智能合约中的循环](https://www.microsoft.com/en-us/research/uploads/prod/2020/08/loops_solidity__camera_ready-5f3fec3f15c69.pdf) | 通过 Slither 利用数据依赖 | Ben Mariano, Yanju Chen, Yu Feng, Shuvendu Lahiri, Isil Dillig | ASE 20 | - [智能合约中循环的基于跟踪的动态 Gas 估算](https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=9268144) | 使用 Slither 的 CFG 检测循环 | Chunmiao Li, Shijie Nie, Yang Cao, Yijun Yu, Zhenjiang Hu | IEEE Open J. Comput. Soc. 1 (2020) | - [SAILFISH:在几秒钟内审查智能合约状态不一致错误](https://arxiv.org/pdf/2104.08638.pdf) | 依赖 SlithIR 构建 *存储依赖图* | Priyanka Bose, Dipanjan Das, Yanju Chen, Yu Feng, Christopher Kruegel, and Giovanni Vigna | S&P 22 | [Sailfish](https://github.com/ucsb-seclab/sailfish) [SolType:Solidity 算术溢出的细化类型](https://arxiv.org/abs/2110.00677) | 使用 Slither 作为前端构建细化类型系统 | Bryan Tan, Benjamin Mariano, Shuvendu K. Lahiri, Isil Dillig, Yu Feng | POPL 22 | - [不要对我撤资:利用机器学习技术进行自动诈骗检测](https://www.mdpi.com/2227-7390/10/6/949) | 使用 Slither 提取代币特征(可铸造、可暂停等) | Mazorra, Bruno, Victor Adan, and Vanesa Daza | Mathematics 10.6 (2022) | - [MANDO:用于细粒度检测智能合约漏洞的多级异构图嵌入](https://arxiv.org/abs/2208.13252) | 使用 Slither 提取 CFG 和调用图 | Hoang Nguyen, Nhat-Minh Nguyen, Chunyao Xie, Zahra Ahmadi, Daniel Kudendo, Thanh-Nam Doan and Lingxiao Jiang| IEEE 9th International Conference on Data Science and Advanced Analytics (DSAA, 2022) | [ge-sc](https://github.com/MANDO-Project/ge-sc) [智能合约中价格欺诈 TOD 漏洞的自动审计](https://www.cs.toronto.edu/~fanl/papers/price-icbc22.pdf) | 使用 Slither 提取 CFG 和数据依赖 | Sidi Mohamed Beillahi, Eric Keilty, Keerthi Nelaturu, Andreas Veneris, and Fan Long | 2022 IEEE International Conference on Blockchain and Cryptocurrency (ICBC) | [Smart-Contract-Repair](https://github.com/Veneris-Group/TOD-Location-Rectification) [智能合约访问控制策略的建模与执行](https://publikationen.bibliothek.kit.edu/1000152805/151859658) | 扩展 Slither 的数据依赖 | Jan-Philipp Toberg, Jonas Schiffl, Frederik Reiche, Bernhard Beckert, Robert Heinrich, Ralf Reussner | IEEE International Conference on Decentralized Applications and Infrastructures (DAPPS), 2022 | [SolidityAccessControlEnforcement](https://github.com/KASTEL-CSSDA/SolidityAccessControlEnforcement) [基于深度学习和多模态决策融合的智能合约漏洞检测](https://www.mdpi.com/1424-8220/23/16/7246) | 使用 Slither 提取 CFG | Weich Deng, Huanchun Wei, Teng Huang, Cong Cao, Yun Peng, and Xuan Hu | Sensors 2023, 23, 7246 | - [语义丰富的代码知识图谱揭示智能合约代码重用中的未知数](https://www.researchgate.net/profile/Qing-Huang-26/publication/370638129_Semantic-enriched_Code_Knowledge_Graph_to_Reveal_Unknowns_in_Smart_Contract_Code_Reuse/links/645b7b8639c408339b3a54da/Semantic-Enriched-Code-Knowledge-Graph-to-Reveal-Unknowns-in-Smart-Contract-Code-Reuse.pdf) | 使用 Slither 提取代码特征(CFG、函数、参数类型等) | Qing Huang, Dianshu Liao, Zhenchang Xing, Zhengkang Zuo, Changjing Wang, Xin Xia | ACM Transactions on Software Engineering and Methodology, 2023 | - [具有细粒度状态访问的智能合约并行执行](https://personal.ntu.edu.sg/yi_li/files/Qi2023SCP.pdf) | 使用 Slither 构建状态访问图 | Xiaodong Qi, Jiao Jiao, Yi Li | International Conference on Distributed Computing Systems (ICDCS), 2023 | - [坏苹果:理解去中心化生态系统中的中心化安全风险](https://diaowenrui.github.io/paper/www23-yan.pdf) | 基于 Slither 实现内部分析 | Kailun Yan , Jilian Zhang , Xiangyu Liu , Wenrui Diao , Shanqing Guo | ACM Web Conference April 2023 | - [使用区间分析识别智能合约中的漏洞](https://arxiv.org/pdf/2309.13805.pdf) | 在 Slither 之上创建 4 个检测器 | Ştefan-Claudiu Susan, Andrei Arusoaie | FROM 2023 | - 以太坊区块链智能合约的存储状态分析和提取(无开放访问 PDF) | 依赖 Slither 的 CFG 和 AST | Maha Ayub , Tania Saleem , Muhammad Janjua , Talha Ahmad | TOSEM 2023 | [SmartMuv](https://github.com/WaizKhan7/SmartMuv) 如果你在学术工作中使用 Slither,请考虑申请 [Crytic 1 万美元研究奖](https://blog.trailofbits.com/2019/11/13/announcing-the-crytic-10k-research-prize/)。
标签:DeFi安全, LNA, Python, SE防防, Slither, SlithIR, Solidity, Trail of Bits, Vyper, Web3安全, 云安全监控, 以太坊, 区块链安全, 开发安全, 无后门, 智能合约审计, 智能合约漏洞, 逆向工具, 静态代码分析器, 静态分析