slither

cryticAGPL-3.0活跃维护

针对 Solidity 和 Vyper 智能合约的静态分析器,能在部署前自动检测漏洞、代码异味和规范问题,帮审计和开发人员提前排雷。

Static Analyzer for Solidity and Vyper

0.11.6发布于 2026-07-28 21:32 UTC6,412star +1 / 7 天1,170fork同步于 2026-11-10 11:34 UTC

怎么上手

由 README 提炼,执行前请确认
uv tool install slither-analyzer
slither .
硬件要求按 README 说明

README 未说明硬件要求;需 Python 3.10+,不使用支持的编译框架时还需安装 solc

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

Python 写的 Solidity/Vyper 静态分析框架,跑漏洞检测器并输出合约结构信息

针对 Solidity 和 Vyper 智能合约的静态分析器,能在部署前自动检测漏洞、代码异味和规范问题,帮审计和开发人员提前排雷。

核心能力

  • 内置数十个漏洞检测器,覆盖重入、未初始化状态变量等
  • 用 SlithIR 中间表示做高精度分析
  • 提供 printers 快速输出合约关键信息
  • 提供 Python API 编写自定义检测规则
  • 可接入 CI 与 Hardhat/Foundry 构建流程

容易踩的坑

需 Python 3.10+;不用 Hardhat/Foundry 等编译框架时要自行安装 solc 并建议用 solc-select 切换版本;分析带依赖的项目应在项目根目录运行 slither . 而非单文件

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本0.11.6
  1. 0.11.6最新正式版2026-07-28 · 2026-07-28 21:32 UTC

    This release supports Hardhat v3 and Sourcify, it contains performance improvements and a reduction of false positives for some detectors.

    What's Changed

  2. 0.11.52026-01-16 · 2026-01-16 19:46 UTC
    查看更新说明

    This minor release upgrades the minimum Python version to 3.10, adds one new detector reentrancy-balance and various other fixes.

    What's Changed

    New Contributors

    Full Changelog: https://github.com/crytic/slither/compare/0.11.4...0.11.5

  3. 0.11.42026-01-15 · 2026-01-15 18:59 UTC
    查看更新说明

    This release adds support for the CLZ EVM opcode, for solidity custom storage layout, adds 1 new detector unindexed-event-address and various fixes. Additionally it changes the development environment to using uv and ruff for linting.

    What's Changed

  4. 0.11.32025-04-18 · 2025-04-18 11:59 UTC
    查看更新说明

    This minor release updates some dependencies.

    What's Changed

    Full Changelog: https://github.com/crytic/slither/compare/0.11.2...0.11.3

  5. 0.11.22025-04-16 · 2025-04-16 20:43 UTC
    查看更新说明

    This minor release fixes a bug in the storage pointer analysis.

    What's Changed

    Full Changelog: https://github.com/crytic/slither/compare/0.11.1...0.11.2

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Slither, the smart contract static analyzer

    Build Status PyPI Slither - Read the Docs Slither - Wiki

    Join the Empire Hacking Slack

    Slack Status

    - Discussions and Support

    Slither is a Solidity & Vyper static analysis framework written in Python3. It runs a suite of vulnerability detectors, prints visual information about contract details, and provides an API to easily write custom analyses. Slither enables developers to find vulnerabilities, enhance their code comprehension, and quickly prototype custom analyses.

    Features

    • Detects vulnerable Solidity code with low false positives (see the list of trophies)
    • Identifies where the error condition occurs in the source code
    • Easily integrates into continuous integration and Hardhat/Foundry builds
    • Built-in 'printers' quickly report crucial contract information
    • Detector API to write custom analyses in Python
    • Ability to analyze contracts written with Solidity >= 0.4
    • Intermediate representation (SlithIR) enables simple, high-precision analyses
    • Correctly parses 99.9% of all public Solidity code
    • Average execution time of less than 1 second per contract
    • Integrates with Github's code scanning in CI
    • Support for Vyper smart contracts

    Usage

    Run Slither on a Hardhat/Foundry/Dapp/Brownie application:

    slither .
    

    This is the preferred option if your project has dependencies as Slither relies on the underlying compilation framework to compile source code.

    However, you can run Slither on a single file that does not import dependencies:

    slither tests/uninitialized.sol
    

    How to install

    Note Slither requires Python 3.10+. If you're not going to use one of the supported compilation frameworks, you need solc, the Solidity compiler; we recommend using solc-select to conveniently switch between solc versions.

    Using uv (Recommended)

    uv is a fast Python package manager that's 10-100x faster than pip.

    # Install uv if you haven't already
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # Install slither as a tool
    uv tool install slither-analyzer
    
    # Or run slither without installation
    uvx --from slither-analyzer slither <target>
    

    To upgrade:

    uv tool upgrade slither-analyzer
    

    Using Pip

    python3 -m pip install slither-analyzer
    

    To upgrade:

    python3 -m pip install --upgrade slither-analyzer
    

    Using Brew

    brew install slither-analyzer
    

    Using Git (Development)

    git clone https://github.com/crytic/slither.git && cd slither
    
    # Install as editable for development
    uv tool install -e .
    
    # Or use uv run for testing without installation
    uv run slither <target>
    

    The -e flag installs in editable mode, meaning changes to the source code are immediately reflected without reinstalling.

    Using Docker

    Use the eth-security-toolbox docker image. It includes all of our security tools and every major version of Solidity in a single image. /home/share will be mounted to /share in the container.

    docker pull trailofbits/eth-security-toolbox
    

    To share a directory in the container:

    docker run -it -v /home/share:/share trailofbits/eth-security-toolbox
    

    Integration

    • For GitHub action integration, use slither-action.
    • For pre-commit integration, use (replace $GIT_TAG with real tag)
      - repo: https://github.com/crytic/slither
        rev: $GIT_TAG
        hooks:
          - id: slither
      
    • To generate a Markdown report, use slither [target] --checklist.
    • To generate a Markdown with GitHub source code highlighting, use slither [target] --checklist --markdown-root https://github.com/ORG/REPO/blob/COMMIT/ (replace ORG, REPO, COMMIT)

    Detectors

    NumDetectorWhat it DetectsImpactConfidence
    1abiencoderv2-arrayStorage abiencoderv2 arrayHighHigh
    2arbitrary-send-erc20transferFrom uses arbitrary fromHighHigh
    3array-by-referenceModifying storage array by valueHighHigh
    4encode-packed-collisionABI encodePacked CollisionHighHigh
    5incorrect-shiftThe order of parameters in a shift instruction is incorrect.HighHigh
    6multiple-constructorsMultiple constructor schemesHighHigh
    7name-reusedContract's name reusedHighHigh
    8protected-varsDetected unprotected variablesHighHigh
    9public-mappings-nestedPublic mappings with nested variablesHighHigh
    10rtloRight-To-Left-Override control character is usedHighHigh
    11shadowing-stateState variables shadowingHighHigh
    12suicidalFunctions allowing anyone to destruct the contractHighHigh
    13uninitialized-stateUninitialized state variablesHighHigh
    14uninitialized-storageUninitialized storage variablesHighHigh
    15unprotected-upgradeUnprotected upgradeable contractHighHigh
    16arbitrary-send-erc20-permittransferFrom uses arbitrary from with permitHighMedium
    17arbitrary-send-ethFunctions that send Ether to arbitrary destinationsHighMedium
    18controlled-array-lengthTainted array length assignmentHighMedium
    19controlled-delegatecallControlled delegatecall destinationHighMedium
    20delegatecall-loopPayable functions using delegatecall inside a loopHighMedium
    21incorrect-expIncorrect exponentiationHighMedium
    22incorrect-returnIf a return is incorrectly used in assembly mode.HighMedium
    23msg-value-loopmsg.value inside a loopHighMedium
    24reentrancy-ethReentrancy vulnerabilities (theft of ethers)HighMedium
    25reentrancy-balanceReentrancy vulnerabilities leading to outdated balance checksHighMedium
    26return-leaveIf a return is used instead of a leave.HighMedium
    27storage-arraySigned storage integer array compiler bugHighMedium
    28unchecked-transferUnchecked tokens transferHighMedium
    29weak-prngWeak PRNGHighMedium
    30domain-separator-collisionDetects ERC20 tokens that have a function whose signature collides with EIP-2612's DOMAIN_SEPARATOR()MediumHigh
    31enum-conversionDetect dangerous enum conversionMediumHigh
    32erc20-interfaceIncorrect ERC20 interfacesMediumHigh
    33erc721-interfaceIncorrect ERC721 interfacesMediumHigh
    34incorrect-equalityDangerous strict equalitiesMediumHigh
    35locked-etherContracts that lock etherMediumHigh
    36mapping-deletionDeletion on mapping containing a structureMediumHigh
    37pyth-deprecated-functionsDetect Pyth deprecated functionsMediumHigh
    38pyth-unchecked-confidenceDetect when the confidence level of a Pyth price is not checkedMediumHigh
    39pyth-unchecked-publishtimeDetect when the publishTime of a Pyth price is not checkedMediumHigh
    40shadowing-abstractState variables shadowing from abstract contractsMediumHigh
    41tautological-compareComparing a variable to itself always returns true or false, depending on comparisonMediumHigh
    42tautologyTautology or contradictionMediumHigh
    43write-after-writeUnused writeMediumHigh
    44boolean-cstMisuse of Boolean constantMediumMedium
    45chronicle-unchecked-priceDetect when Chronicle price is not checked.MediumMedium
    46constant-function-asmConstant functions using assembly codeMediumMedium
    47constant-function-stateConstant functions changing the stateMediumMedium
    48divide-before-multiplyImprecise arithmetic operations orderMediumMedium
    49gelato-unprotected-randomnessCall to _requestRandomness within an unprotected functionMediumMedium
    50out-of-order-retryableOut-of-order retryable transactionsMediumMedium
    51reentrancy-no-ethReentrancy vulnerabilities (no theft of ethers)MediumMedium
    52reused-constructorReused base constructorMediumMedium
    53tx-originDangerous usage of tx.originMediumMedium
    54unchecked-lowlevelUnchecked low-level callsMediumMedium
    55unchecked-sendUnchecked sendMediumMedium
    56uninitialized-localUninitialized local variablesMediumMedium
    57unused-returnUnused return valuesMediumMedium
    58chainlink-feed-registryDetect when chainlink feed registry is usedLowHigh
    59incorrect-modifierModifiers that can return the default valueLowHigh
    60optimism-deprecationDetect when deprecated Optimism predeploy or function is used.LowHigh
    61shadowing-builtinBuilt-in symbol shadowingLowHigh
    62shadowing-localLocal variables shadowingLowHigh
    63uninitialized-fptr-cstUninitialized function pointer calls in constructorsLowHigh
    64variable-scopeLocal variables used prior their declarationLowHigh
    65void-cstConstructor called not implementedLowHigh
    66calls-loopMultiple calls in a loopLowMedium
    67events-accessMissing Events Access ControlLowMedium
    68events-mathsMissing Events ArithmeticLowMedium
    69incorrect-unaryDangerous unary expressionsLowMedium
    70missing-zero-checkMissing Zero Address ValidationLowMedium
    71reentrancy-benignBenign reentrancy vulnerabilitiesLowMedium
    72reentrancy-eventsReentrancy vulnerabilities leading to out-of-order EventsLowMedium
    73return-bombA low level callee may consume all callers gas unexpectedly.LowMedium
    74timestampDangerous usage of block.timestampLowMedium
    75assemblyAssembly usageInformationalHigh
    76assert-state-changeAssert state changeInformationalHigh
    77boolean-equalComparison to boolean constantInformationalHigh
    78cyclomatic-complexityDetects functions with high (> 11) cyclomatic complexityInformationalHigh
    79deprecated-standardsDeprecated Solidity StandardsInformationalHigh
    80erc20-indexedUn-indexed ERC20 event parametersInformationalHigh
    81function-init-stateFunction initializing state variablesInformationalHigh
    82incorrect-using-forDetects using-for statement usage when no function from a given library matches a given typeInformationalHigh
    83low-level-callsLow level callsInformationalHigh
    84missing-inheritanceMissing inheritanceInformationalHigh
    85naming-conventionConformity to Solidity naming conventionsInformationalHigh
    86pragmaIf different pragma directives are usedInformationalHigh
    87redundant-statementsRedundant statementsInformationalHigh
    88solc-versionIncorrect Solidity versionInformationalHigh
    89unimplemented-functionsUnimplemented functionsInformationalHigh
    90unindexed-event-addressEvents with address parameters but no indexed parametersInformationalHigh
    91unused-stateUnused state variablesInformationalHigh
    92costly-loopCostly operations in a loopInformationalMedium
    93dead-codeFunctions that are not usedInformationalMedium
    94reentrancy-unlimited-gasReentrancy vulnerabilities through send and transferInformationalMedium
    95too-many-digitsConformance to numeric notation best practicesInformationalMedium
    96cache-array-lengthDetects for loops that use length member of some storage array in their loop condition and don't modify it.OptimizationHigh
    97constable-statesState variables that could be declared constantOptimizationHigh
    98external-functionPublic function that could be declared externalOptimizationHigh
    99immutable-statesState variables that could be declared immutableOptimizationHigh
    100var-read-using-thisContract reads its own variable using thisOptimizationHigh

    For more information, see

    Printers

    Quick Review Printers

    In-Depth Review Printers

    To run a printer, use --print and a comma-separated list of printers.

    See the Printer documentation for the complete lists.

    Tools

    See the Tool documentation for additional tools.

    Contact us to get help on building custom tools.

    API Documentation

    Documentation on Slither's internals is available here.

    Getting Help

    Feel free to stop by our Slack channel (#ethereum) for help using or extending Slither.

    FAQ

    How do I exclude mocks or tests?

    How do I fix "unknown file" or compilation issues?

    • Because slither requires the solc AST, it must have all dependencies available. If a contract has dependencies, slither contract.sol will fail. Instead, use slither . in the parent directory of contracts/ (you should see contracts/ when you run ls). If you have a node_modules/ folder, it must be in the same directory as contracts/. To verify that this issue is related to slither, run the compilation command for the framework you are using e.g npx hardhat compile. That must work successfully; otherwise, slither's compilation engine, crytic-compile, cannot generate the AST.

    License

    Slither is licensed and distributed under the AGPLv3 license. Contact us if you're looking for an exception to the terms.

    Publications

    Trail of Bits publication

    External publications

    TitleUsageAuthorsVenueCode
    ReJection: A AST-Based Reentrancy Vulnerability Detection MethodAST-based analysis built on top of SlitherRui Ma, Zefeng Jian, Guangyuan Chen, Ke Ma, Yujia ChenCTCIS 19-
    MPro: Combining Static and Symbolic Analysis for Scalable Testing of Smart ContractLeverage data dependency through SlitherWilliam Zhang, Sebastian Banescu, Leodardo Pasos, Steven Stewart, Vijay GaneshISSRE 2019MPro
    ETHPLOIT: From Fuzzing to Efficient Exploit Generation against Smart ContractsLeverage data dependency through SlitherQingzhao Zhang, Yizhuo Wang, Juanru Li, Siqi MaSANER 20-
    Verification of Ethereum Smart Contracts: A Model Checking ApproachSymbolic execution built on top of Slither’s CFGTam Bang, Hoang H Nguyen, Dung Nguyen, Toan Trieu, Tho QuanIJMLC 20-
    Smart Contract RepairRely on Slither’s vulnerabilities detectorsXiao Liang Yu, Omar Al-Bataineh, David Lo, Abhik RoychoudhuryTOSEM 20SCRepair
    Demystifying Loops in Smart ContractsLeverage data dependency through SlitherBen Mariano, Yanju Chen, Yu Feng, Shuvendu Lahiri, Isil DilligASE 20-
    Trace-Based Dynamic Gas Estimation of Loops in Smart ContractsUse Slither’s CFG to detect loopsChunmiao Li, Shijie Nie, Yang Cao, Yijun Yu, Zhenjiang HuIEEE Open J. Comput. Soc. 1 (2020)-
    SAILFISH: Vetting Smart Contract State-Inconsistency Bugs in SecondsRely on SlithIR to build a storage dependency graphPriyanka Bose, Dipanjan Das, Yanju Chen, Yu Feng, Christopher Kruegel, and Giovanni VignaS&P 22Sailfish
    SolType: Refinement Types for Arithmetic Overflow in SolidityUse Slither as frontend to build refinement type systemBryan Tan, Benjamin Mariano, Shuvendu K. Lahiri, Isil Dillig, Yu FengPOPL 22-
    Do Not Rug on Me: Leveraging Machine Learning Techniques for Automated Scam DetectionUse Slither to extract tokens' features (mintable, pausable, ..)Mazorra, Bruno, Victor Adan, and Vanesa DazaMathematics 10.6 (2022)-
    MANDO: Multi-Level Heterogeneous Graph Embeddings for Fine-Grained Detection of Smart Contract VulnerabilitiesUse Slither to extract the CFG and call graphHoang Nguyen, Nhat-Minh Nguyen, Chunyao Xie, Zahra Ahmadi, Daniel Kudendo, Thanh-Nam Doan and Lingxiao JiangIEEE 9th International Conference on Data Science and Advanced Analytics (DSAA, 2022)ge-sc
    Automated Auditing of Price Gouging TOD Vulnerabilities in Smart ContractsUse Slither to extract the CFG and data dependenciesSidi Mohamed Beillahi, Eric Keilty, Keerthi Nelaturu, Andreas Veneris, and Fan Long2022 IEEE International Conference on Blockchain and Cryptocurrency (ICBC)Smart-Contract-Repair
    Modeling and Enforcing Access Control Policies for Smart ContractsExtend Slither's data dependenciesJan-Philipp Toberg, Jonas Schiffl, Frederik Reiche, Bernhard Beckert, Robert Heinrich, Ralf ReussnerIEEE International Conference on Decentralized Applications and Infrastructures (DAPPS), 2022SolidityAccessControlEnforcement
    Smart Contract Vulnerability Detection Based on Deep Learning and Multimodal Decision FusionUse Slither to extract the CFGWeichu Deng, Huanchun Wei, Teng Huang, Cong Cao, Yun Peng, and Xuan HuSensors 2023, 23, 7246-
    Semantic-enriched Code Knowledge Graph to Reveal Unknowns in Smart Contract Code ReuseUse Slither to extract the code features (CFG, function, parameters types, ..)Qing Huang, Dianshu Liao, Zhenchang Xing, Zhengkang Zuo, Changjing Wang, Xin XiaACM Transactions on Software Engineering and Methodology, 2023-
    Smart Contract Parallel Execution with Fine-Grained State AccessesUse Slither to build state access graphsXiaodong Qi, Jiao Jiao, Yi LiInternational Conference on Distributed Computing Systems (ICDCS), 2023-
    Bad Apples: Understanding the Centralized Security Risks in Decentralized EcosystemsImplement an internal analysis on top of SlitherKailun Yan , Jilian Zhang , Xiangyu Liu , Wenrui Diao , Shanqing GuoACM Web Conference April 2023-
    Identifying Vulnerabilities in Smart Contracts using Interval AnalysisCreate 4 detectors on top of SlitherŞtefan-Claudiu Susan, Andrei ArusoaieFROM 2023-
    Storage State Analysis and Extraction of Ethereum Blockchain Smart Contracts (no PDF in open access)Rely on Slither's CFG and ASTMaha Ayub , Tania Saleem , Muhammad Janjua , Talha AhmadTOSEM 2023SmartMuv

    If you are using Slither on an academic work, consider applying to the Crytic $10k Research Prize.