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 comphrehension, and quickly prototype custom analyses.
Run Slither on a Truffle application:
slither .
Run Slither on a single file:
$ slither tests/uninitialized.sol
For additional configuration, see the usage documentation.
By default, all the detectors are run.
Contact us to get access to additional detectors.
To run a printer, use --print and a comma-separated list of printers.
| Num | Printer | Description |
|---|---|---|
| 1 | call-graph | Export the call-graph of the contracts to a dot file |
| 2 | cfg | Export the CFG of each functions |
| 3 | contract-summary | Print a summary of the contracts |
| 4 | data-dependency | Print the data dependencies of the variables |
| 5 | function-id | Print the keccack256 signature of the functions |
| 6 | function-summary | Print a summary of the functions |
| 7 | human-summary | Print a human-readable summary of the contracts |
| 8 | inheritance | Print the inheritance relations between contracts |
| 9 | inheritance-graph | Export the inheritance graph of each contract to a dot file |
| 10 | modifiers | Print the modifiers called by each function |
| 11 | require | Print the require and assert calls of each function |
| 12 | slithir | Print the slithIR representation of the functions |
| 13 | slithir-ssa | Print the slithIR representation of the functions |
| 14 | variable-order | Print the storage order of the state variables |
| 15 | vars-and-auth | Print the state variables written and the authorization of the functions |
Slither requires Python 3.6+ and solc, the Solidity compiler.
$ pip install slither-analyzer
$ git clone https://github.com/trailofbits/slither.git && cd slither
$ python 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. Use solc-select to switch the Solidity version.
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.
Content type
Image
Digest
Size
122.4 MB
Last updated
over 7 years ago
docker pull trailofbits/slither