[Paper Review] sFuzz: An Efficient Adaptive Fuzzer for Solidity Smart Contracts
sFuzz is an AFL-based adaptive fuzzer for Ethereum Solidity smart contracts that combines seed-based adaptive search with lightweight multi-objective optimization to improve code coverage and vulnerability discovery, outperforming state-of-the-art tools by up to two orders of magnitude in speed while handling over 4,000 contracts.
Smart contracts are Turing-complete programs that execute on the infrastructure of the blockchain, which often manage valuable digital assets. Solidity is one of the most popular programming languages for writing smart contracts on the Ethereum platform. Like traditional programs, smart contracts may contain vulnerabilities. Unlike traditional programs, smart contracts cannot be easily patched once they are deployed. It is thus important that smart contracts are tested thoroughly before deployment. In this work, we present an adaptive fuzzer for smart contracts on the Ethereum platform called sFuzz. Compared to existing Solidity fuzzers, sFuzz combines the strategy in the AFL fuzzer and an efficient lightweight multi-objective adaptive strategy targeting those hard-to-cover branches. sFuzz has been applied to more than 4 thousand smart contracts and the experimental results show that (1) sFuzz is efficient, e.g., two orders of magnitude faster than state-of-the-art tools; (2) sFuzz is effective in achieving high code coverage and discovering vulnerabilities; and (3) the different fuzzing strategies in sFuzz complement each other.
Motivation & Objective
- Motivate thorough testing of Solidity smart contracts before deployment due to their immutability on the blockchain.
- Develop an automatic testing engine that maximizes code coverage, particularly branch coverage, for smart contracts.
- Leverage a lightweight, adaptive, multi-objective seed selection strategy to overcome hard-to-cover branches.
- Complement existing symbolic-execution based tools by providing efficient fuzzing-based testing.
- Demonstrate scalability by applying the approach to thousands of contracts and evaluating performance gains.
Proposed method
- Adopt AFL-inspired feedback-guided fuzzing as the core framework and integrate an adaptive seed-selection strategy targeting just-missed branches.
- Define a lightweight multi-objective distance-based fitness to guide seed selection, focusing on proximity to uncovered branches.
- Represent test cases as bit-vector-encoded configurations and function-call sequences, enabling genetic-operator-based crossover and mutation.
- Compute a distance measure distance(t, br_n) for each just-missed branch br_n to quantify how close a seed t is to covering that branch; simplify to distance only for just-missed branches to maintain efficiency.
- Employ crossover and mutation strategies from AFL, with contract-specific mutations and validity checks to ensure syntactic/semantic consistency of test cases.
- Implement an on-the-fly CFG construction and oracle framework (Gasless Send, Exception Disorder, Timestamp/Block/DelegateCall vulnerabilities, Reentrancy, Integer Overflow/Underflow, Freezing Ether) to drive vulnerability detection.
Experimental results
Research questions
- RQ1How can adaptive fuzzing improve branch coverage and vulnerability discovery in Solidity smart contracts compared to existing fuzzers?
- RQ2What seed-selection strategy best navigates hard-to-cover branches within the Ethereum Virtual Machine constraints?
- RQ3Can an AFL-based fuzzing approach be effectively extended with lightweight, contract-specific objectives for efficiency?
- RQ4To what extent do fuzzing-based methods complement symbolic-execution based tools in uncovering smart contract vulnerabilities?
Key findings
- sFuzz is, on average, more than two orders of magnitude faster than ContractFuzzer.
- sFuzz achieves higher code coverage and discovers more vulnerabilities than competing tools.
- The adaptive seed-selection strategy improves code coverage over prolonged fuzzing runs.
- The different fuzzing strategies in sFuzz complement each other in practice.
- sFuzz is applied to more than 4,000 smart contracts, demonstrating scalability and effectiveness.
- The framework is publicly available and has been adopted by multiple companies.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.