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.
Run Slither on a Truffle/Embark/Dapp/Etherlime application:
Run Slither on a single file:
$ slither tests/uninitialized.sol
By default, all the detectors are run.
Num | Detector | What it Detects | Impact | Confidence
rtlo | Right-To-Left-Override control character is used | High | High
shadowing-state | State variables shadowing | High | High
suicidal | Functions allowing anyone to destruct the contract | High | High
uninitialized-state | Uninitialized state variables | High | High
uninitialized-storage | Uninitialized storage variables | High | High
arbitrary-send | Functions that send ether to arbitrary destinations | High | Medium
controlled-delegatecall | Controlled delegatecall destination | High | Medium
reentrancy-eth | Reentrancy vulnerabilities (theft of ethers) | High | Medium
erc20-interface | Incorrect ERC20 interfaces | Medium | High
erc721-interface | Incorrect ERC721 interfaces | Medium | High
incorrect-equality | Dangerous strict equalities | Medium | High
locked-ether | Contracts that lock ether | Medium | High
shadowing-abstract | State variables shadowing from abstract contracts | Medium | High
constant-function | Constant functions changing the state | Medium | Medium
reentrancy-no-eth | Reentrancy vulnerabilities (no theft of ethers) | Medium | Medium
tx-origin | Dangerous usage of
tx.origin | Medium | Medium
unchecked-lowlevel | Unchecked low-level calls | Medium | Medium
unchecked-send | Unchecked send | Medium | Medium
uninitialized-local | Uninitialized local variables | Medium | Medium
unused-return | Unused return values | Medium | Medium
shadowing-builtin | Built-in symbol shadowing | Low | High
shadowing-local | Local variables shadowing | Low | High
void-cst | Constructor called not implemented | Low | High
calls-loop | Multiple calls in a loop | Low | Medium
reentrancy-benign | Benign reentrancy vulnerabilities | Low | Medium
timestamp | Dangerous usage of
block.timestamp | Low | Medium
assembly | Assembly usage | Informational | High
deprecated-standards | Deprecated Solidity Standards | Informational | High
erc20-indexed | Un-indexed ERC20 event parameters | Informational | High
low-level-calls | Low level calls | Informational | High
naming-convention | Conformance to Solidity naming conventions | Informational | High
pragma | If different pragma directives are used | Informational | High
solc-version | Incorrect Solidity version (< 0.4.24 or complex pragma) | Informational | High
unused-state | Unused state variables | Informational | High
too-many-digits | Conformance to numeric notation best practices | Informational | Medium
constable-states | State variables that could be declared constant | Optimization | High
external-function | Public function that could be declared as external | Optimization | High
Contact us to get access to additional detectors.
To run a printer, use
Num | Printer | Description
call-graph | Export the call-graph of the contracts to a dot file
cfg | Export the CFG of each functions
constructor-calls | Print the constructors executed
contract-summary | Print a summary of the contracts
data-dependency | Print the data dependencies of the variables
echidna | Export Echidna guiding information
function-id | Print the keccack256 signature of the functions
function-summary | Print a summary of the functions
human-summary | Print a human-readable summary of the contracts
inheritance | Print the inheritance relations between contracts
inheritance-graph | Export the inheritance graph of each contract to a dot file
modifiers | Print the modifiers called by each function
require | Print the require and assert calls of each function
slithir | Print the slithIR representation of the functions
slithir-ssa | Print the slithIR representation of the functions
variable-order | Print the storage order of the state variables
vars-and-auth | Print the state variables written and the authorization of the functions
How to install
Slither requires Python 3.6+ and solc , the Solidity compiler.
$ pip install slither-analyzer
$ git clone https://github.com/crytic/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.
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.