Slither

A popular static analysis tool for Solidity smart contracts, developed by Trail of Bits, that detects vulnerabilities and code quality issues.

Slither is the industry-standard static analysis tool for Solidity smart contracts. Developed by Trail of Bits, it quickly scans code to detect vulnerabilities, optimization opportunities, and code quality issues. Running Slither before an audit is considered essential preparation—a clean Slither report demonstrates codebase maturity and allows auditors to focus on complex issues rather than routine findings.

What Slither Detects

Slither includes 70+ built-in detectors covering:

High-severity vulnerabilities:

  • Reentrancy patterns (various types)
  • Uninitialized storage pointers
  • Arbitrary external calls
  • Unchecked low-level calls

Medium-severity issues:

  • Missing zero-address checks
  • Locked ether
  • Shadowed state variables
  • Incorrect equality comparisons

Low-severity and informational:

  • Naming convention violations
  • Unused state variables
  • Redundant code
  • Optimization opportunities

Usage

Basic usage is straightforward:

1# Install
2pip3 install slither-analyzer
3
4# Run on a project
5slither .
6
7# Run on a specific file
8slither contracts/Token.sol
9
10# Filter by severity
11slither . --filter-paths "test|node_modules"

Slither integrates with common frameworks including Foundry, Hardhat, and Brownie.

Slither Output

Findings are categorized by impact and confidence:

Impact: High, Medium, Low, Informational Confidence: High, Medium, Low

High-impact, high-confidence findings should be addressed immediately. Low-confidence findings may be false positives requiring manual review.

Pre-Audit Requirements

The standard: A clean Slither report (or documented false positives) before engaging auditors.

Why it matters: If Slither finds 50+ warnings, auditors must:

  1. Reproduce each finding
  2. Determine if it's a real vulnerability
  3. Document it in the report

This wastes billable hours on automated-detectable issues. Running Slither yourself costs nothing; having auditors re-discover Slither findings costs premium rates.

False Positives

Not every Slither warning is a real vulnerability. Common false positive scenarios:

  • Intentional patterns: Sometimes code intentionally uses patterns that look risky but are safe in context
  • Framework conventions: Some frameworks trigger warnings due to their structure
  • Test code: Test files may have intentionally unsafe patterns

Handling: Document why each suppressed warning is a false positive. Use // slither-disable-next-line comments with explanations.

Slither vs Aderyn

FeatureSlitherAderyn
LanguagePythonRust
SpeedFastVery fast
MaturityWell-establishedNewer, growing
Detectors70+ built-inGrowing library
Custom detectorsPythonRust

Both are valuable—running multiple static analyzers catches more issues.

CI/CD Integration

Integrate Slither into your development workflow:

1# GitHub Actions example
2- name: Run Slither
3 uses: crytic/slither-action@v0.3.0
4 with:
5 fail-on: high

This catches issues at commit time rather than during expensive audit engagements.

Slither Features Beyond Detection

Printers: Generate useful reports about contract structure, inheritance, function summary.

Upgradeability checks: Detect upgradeability issues in proxy patterns.

Similarity detection: Find code clones and similar functions.

Data dependency analysis: Understand how data flows through contracts.

Best Practices

  1. Run on every commit: Catch issues early in CI/CD
  2. Address all findings: Fix or explicitly document each warning
  3. Keep updated: New detectors are added regularly
  4. Combine with other tools: Slither catches some issues; Aderyn, Mythril catch others
  5. Don't over-rely: Static analysis has limits; manual review is still essential

Slither is the first line of defense in smart contract security—fast, free, and catches issues that would otherwise waste expensive audit time.

Need expert guidance on Slither?

Our team at Zealynx has deep expertise in blockchain security and DeFi protocols. Whether you need an audit or consultation, we're here to help.

Get a Quote

oog
zealynx

Subscribe to Our Newsletter

Stay updated with our latest security insights and blog posts

© 2024 Zealynx