SKIP TO CONTENT
Security

Fuzzing

Automated testing that generates random inputs to discover unexpected contract behaviors.

What is Fuzzing?

Fuzzing, also called fuzz testing, is an automated testing technique that generates random or semi-random inputs to discover unexpected behaviors, crashes, and vulnerabilities in smart contracts. By exploring vast input spaces that manual testing cannot cover, fuzzing finds edge cases and corner conditions that often contain exploitable bugs.

How it Works

Fuzzers repeatedly call contract functions with generated inputs, monitoring for assertion failures, reverts, or invariant violations. Modern fuzzers use guidance from code coverage to explore more code paths.

Fuzzing approaches include:

  1. Black-box Fuzzing: Random input generation without code knowledge
  2. Coverage-guided Fuzzing: Use execution feedback to explore new paths
  3. Grammar-based Fuzzing: Generate structured inputs matching expected formats
  4. Mutation Fuzzing: Modify known-valid inputs to find edge cases
  5. Stateful Fuzzing: Maintain state across sequences of calls

Popular Solidity fuzzers include Echidna, Foundry's built-in fuzzer, and Medusa.

Practical Example

Trail of Bits' Echidna fuzzer has discovered vulnerabilities in numerous DeFi protocols before deployment. Foundry's native fuzzing capabilities have become standard in development workflows, automatically testing property-based assertions. The Ethereum consensus layer implementation was extensively fuzzed, discovering several edge cases before mainnet deployment that could have caused consensus failures.

Why it Matters

Fuzzing catches bugs that pass code review and traditional testing. It scales testing coverage beyond what humans can achieve manually and finds the unexpected edge cases attackers often exploit. Combining fuzzing with invariant testing and formal verification provides comprehensive automated security testing.

Fensory evaluates protocol testing practices including fuzzing coverage, helping users identify projects with thorough automated testing that reduces the likelihood of undiscovered vulnerabilities.

Examples

  • Trail of Bits Echidna fuzzer has found vulnerabilities in major DeFi protocols
  • Foundry native fuzzing is now standard in Solidity development

From definition to application. Explore real opportunities.

Track live yields, compare protocols, and build your DeFi portfolio with Fensory.

GET EARLY ACCESSArrow right