MCPcopy Index your code
hub / github.com/crytic/slither

github.com/crytic/slither @0.11.5 sqlite

repository ↗ · DeepWiki ↗ · release 0.11.5 ↗
3,340 symbols 13,387 edges 612 files 887 documented · 27%
README

Slither, the smart contract static analyzer

Slither Static Analysis Framework Logo

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 slither-analyzer <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) ```YAML
  • 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

Num Detector What it Detects Impact Confidence
1 abiencoderv2-array Storage abiencoderv2 array High High
2 arbitrary-send-erc20 transferFrom uses arbitrary from High High
3 array-by-reference Modifying storage array by value High High
4 encode-packed-collision ABI encodePacked Collision High High
5 incorrect-shift The order of parameters in a shift instruction is incorrect. High High
6 multiple-constructors Multiple constructor schemes High High
7 name-reused Contract's name reused High High
8 protected-vars Detected unprotected variables High High
9 public-mappings-nested Public mappings with nested variables High High
10 rtlo Right-To-Left-Override control character is used High High
11 shadowing-state State variables shadowing High High
12 suicidal Functions allowing anyone to destruct the contract High High
13 uninitialized-state Uninitialized state variables High High
14 uninitialized-storage Uninitialized storage variables High High
15 unprotected-upgrade Unprotected upgradeable contract High High
16 arbitrary-send-erc20-permit transferFrom uses arbitrary from with permit High Medium
17 arbitrary-send-eth Functions that send Ether to arbitrary destinations High Medium
18 controlled-array-length Tainted array length assignment High Medium
19 controlled-delegatecall Controlled delegatecall destination High Medium
20 delegatecall-loop Payable functions using delegatecall inside a loop High Medium
21 incorrect-exp Incorrect exponentiation High Medium
22 incorrect-return If a return is incorrectly used in assembly mode. High Medium
23 msg-value-loop msg.value inside a loop High Medium
24 reentrancy-eth Reentrancy vulnerabilities (theft of ethers) High Medium
25 reentrancy-balance Reentrancy vulnerabilities leading to outdated balance checks High Medium
26 return-leave If a return is used instead of a leave. High Medium
27 storage-array Signed storage integer array compiler bug High Medium
28 unchecked-transfer Unchecked tokens transfer High Medium
29 weak-prng Weak PRNG High Medium
30 domain-separator-collision Detects ERC20 tokens that have a function whose signature collides with EIP-2612's DOMAIN_SEPARATOR() Medium High
31 enum-conversion Detect dangerous enum conversion Medium High
32 erc20-interface Incorrect ERC20 interfaces Medium High
33 erc721-interface Incorrect ERC721 interfaces Medium High
34 incorrect-equality Dangerous strict equalities Medium High
35 locked-ether Contracts that lock ether Medium High
36 mapping-deletion Deletion on mapping containing a structure Medium High
37 pyth-deprecated-functions Detect Pyth deprecated functions Medium High
38 pyth-unchecked-confidence Detect when the confidence level of a Pyth price is not checked Medium High
39 pyth-unchecked-publishtime Detect when the publishTime of a Pyth price is not checked Medium High
40 shadowing-abstract State variables shadowing from abstract contracts Medium High
41 tautological-compare Comparing a variable to itself always returns true or false, depending on comparison Medium High
42 tautology Tautology or contradiction Medium High
43 write-after-write Unused write Medium High
44 boolean-cst Misuse of Boolean constant Medium Medium
45 chronicle-unchecked-price Detect when Chronicle price is not checked. Medium Medium
46 constant-function-asm Constant functions using assembly code Medium Medium
47 constant-function-state Constant functions changing the state Medium Medium
48 divide-before-multiply [Imprecise arithmetic operations

Core symbols most depended-on inside this repo

info
called by 165
slither/printers/abstract_printer.py
get_contract_from_name
called by 122
slither/core/scope/scope.py
set_offset
called by 119
slither/core/source_mapping/source_mapping.py
generate_result
called by 114
slither/detectors/abstract_detector.py
add
called by 107
slither/utils/output.py
set_expression
called by 94
slither/slithir/operations/operation.py
add
called by 83
slither/detectors/reentrancy/reentrancy.py
get_state_variable_from_name
called by 66
slither/core/declarations/contract.py

Shape

Method 2,038
Function 829
Class 471
Route 2

Languages

Python100%

Modules by API surface

slither/core/declarations/function.py144 symbols
slither/core/declarations/contract.py130 symbols
slither/core/cfg/node.py82 symbols
slither/solc_parsing/yul/parse_yul.py66 symbols
slither/solc_parsing/declarations/function.py54 symbols
slither/solc_parsing/declarations/contract.py54 symbols
slither/visitors/expression/expression.py52 symbols
slither/utils/standard_libraries.py48 symbols
slither/vyper_parsing/ast/ast.py47 symbols
slither/vyper_parsing/ast/types.py43 symbols
tests/unit/slithir/test_ssa_generation.py42 symbols
slither/solc_parsing/slither_compilation_unit_solc.py40 symbols

Dependencies from manifests, versioned

@openzeppelin/contracts4.9.3 · 1×
hardhat2.13.0 · 1×
eth-abi5.0.1 · 1×
eth-typing5.0.0 · 1×
eth-utils5.0.0 · 1×
packaging
prettytable3.10.2 · 1×
pycryptodome3.4.6 · 1×
slither-analyzer0.6.0 · 1×

For agents

$ claude mcp add slither \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact