Smart contract fuzzing for ethereum
Install dependencies for smart-fuzz:
pip install -r requirements.txt
Download solc versions (run only once on new machine):
python scripts/download_solc_compilers.py
Modified library to analyze result of SolidiFI:
git clone https://github.com/cassc/SolidiFI-benchmarkgit checkout result-novpython scripts/smart_fuzz_inspector.py --help- Example
python scripts/smart_fuzz_inspector.py -t Overflow-Underflow -i 1 --print-misc
There are several parameters, to see the list of parameters:
python main.py --help
Run with the number of trials, lower it if fuzzing takes long time:
python main.py [solidifi-path]/Overflow-Underflow/buggy_1.sol --trials 40000 -r
Run with timeout:
python main.py [solidifi-path]/Overflow-Underflow/buggy_1.sol --time 10 -r
./script/benchmark.sh
- Build docker image:
docker build -t smart-fuzz --build-arg GIT_ACCESS_TOKEN=[YOUR_GITHUB_TOKEN] .
# Build image for fuzzing etherscan contracts
docker build -f Dockerfile.etherscan -t smart-fuzz-etherscan --build-arg GIT_ACCESS_TOKEN=[YOUR_GITHUB_TOKEN] .- Usage
# Use -v to mount local volumes in docker
docker run --rm -v $(pwd)/sample_contracts:/smart-fuzz/contracts -it smart-fuzz python3 /smart-fuzz/main.py --path /smart-fuzz/contracts/full_bug_sample.sol -t 25000 --rust-evm -r
# Run with etherscan contracts
docker run --rm -v contracts:/smart-fuzz/contracts -v $(pwd)/target:/smart-fuzz/target smart-fuzz-etherscan
# Inside docker, run the fuzzing tool:
python main.py -h
# For example:
python main.py --path sample_contracts/test_struct.sol --rust-evm --trials 1000