Slither, the Solidity source analyzer
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
- Easy integration 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
Changelog v0.6 2019-02-15
This release adds 3 new detectors, 5 new printers, improves the overall usability of Slither, and introduces a new tool:
slither-check-upgradability to help to review upradable contracts. A large effort has been made to improve our user documentation and developper documentation. This release brings also several bugfixes, API enhancements and lowers the rate of false positives for several detectors.
data-dependency: Print the data dependencies of the variables
function-id: Print the keccack256 signature of the functions
modifiers: Print the modifiers called by each function
require: Print the require and assert calls of each function
variable-order: Print the storage order of the state variables
- Command line usage:
--ignore-truffle-compile: do not run
--disable-color: disable output colorization
--triage-mode: run slither in its triage mode. For every finding, Slither will ask if the result should be shown for the next run.
--filter-paths: exclude all the results that are only related to the given paths.
- Configuration file: Slither options can be configured through a JSON file. See the documentation
slither-check-upgradability: Utility to help reviewing upgradable contracts
- Dependency: require
- Reduce the false alarms rates of:
- Improve Truffle integration: Slither will automatically switch to the truffle version provided in
- Improve SSA conversion: Use of an interprocedural sensitive analysis (follow parameters) (#156 (comment))
- Improve data dependency: Compute a fix-point on function context (#171)
- Improve inheritance printer output (#162, #166)
- Add support of
- Several minors bugs, including:
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
Run Slither on a Truffle application:
Run Slither on a single file:
Slither can be run on:
- A Truffle directory
- A directory containing
*.solfiles (all the
*.solfiles will be analyzed)
- A glob (be sure to quote the argument when using a glob)
--solc SOLC: Path to
--solc-args SOLC_ARGS: Add custom solc arguments.
SOLC_ARGScan contain multiple arguments
--disable-solc-warnings: Do not print solc warnings
--solc-ast: Use the solc AST file as input (
solc file.sol --ast-json > file.ast.json)
--json FILE: Export results as JSON
By default, all the detectors are run.
To run a printer, use –print and a comma-separated list of printers.
|1||Export the call-graph of the contracts to a dot file|
|2||Print a summary of the contracts|
|3||Print a summary of the functions|
|4||Print a human-readable summary of the contracts|
|5||Print the inheritance relations between contracts|
|6||Export the inheritance graph of each contract to a dot file|
|7||Print the slithIR representation of the functions|
|8||Print the state variables written and the authorization of the functions|
Copyright (C) 2018