Slither is a Solidity static analysis framework written in Python 3. 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.
- Detects vulnerable Solidity code with low false positives
- Identifies where the error condition occurs in the source code
- Easily integrates into continuous integration and Truffle 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
Run Slither on a Truffle/Embark/Dapp/Etherlime application:
slither .
Run Slither on a single file:
$ slither tests/uninitialized.sol
For additional configuration, see the usage documentation.
Use solc-select if your contracts require older versions of solc.
Slither has more than 30 public detectors, including:
shadowing-state
: State variables shadowingreentrancy-eth
: Reentrancy vulnerabilitieserc20-interface
: Incorrect ERC20 interfacesincorrect-equality
: Dangerous strict equalitiesconstable-states
: State variables that could be declared constant
See the Detectors Documentation for the complete list. By default, all the detectors are run.
Check out Crytic to get access to additional Slither's detectors and GitHub integration.
human-summary
: Print a human-readable summary of the contractsinheritance-graph
: Export the inheritance graph of each contract to a dot filecontract-summary
: Print a summary of the contracts
call-graph
: Export the call-graph of the contracts to a dot filecfg
: Export the CFG of each functionsfunction-summary
: Print a summary of the functionsvars-and-auth
: Print the state variables written and the authorization of the functions
To run a printer, use --print
and a comma-separated list of printers.
See the Printer documentation for the complete lists.
slither-check-upgradeability
: Reviewdelegatecall
-based upgradeabilityslither-flat
: Flatten a codebaseslither-erc
: Check the ERC's conformanceslither-format
: Automatic patches generation
See the Tool documentation for additional tools.
Contact us to get help on building custom tools.
Slither requires Python 3.6+ and solc, the Solidity compiler.
$ pip3 install slither-analyzer
$ git clone https://github.com/crytic/slither.git && cd slither
$ python3 setup.py install
We recommend using an Python virtual environment, as detailed in the Developer Installation Instructions, if you prefer to install Slither via git.
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
Feel free to stop by our Slack channel (#ethereum) for help using or extending Slither.
-
The Printer documentation describes the information Slither is capable of visualizing for each contract.
-
The Detector documentation describes how to write a new vulnerability analyses.
-
The API documentation describes the methods and objects available for custom analyses.
-
The SlithIR documentation describes the SlithIR intermediate representation.
Slither is licensed and distributed under the AGPLv3 license. Contact us if you're looking for an exception to the terms.
- Slither: A Static Analysis Framework For Smart Contracts, Josselin Feist, Gustavo Grieco, Alex Groce - WETSEB '19
If you are using Slither on an academic work, consider applying to the Crytic $10k Research Prize.