Proof of concept implementation of code coverage guided fuzzing for scrypto blueprints #1780
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a proof of concept implementation of honggfuzz fuzzer with data coverage information for scrypto blueprints and WASM projects in general.
The create
scrypto-wasm-fuzzer
is building scrypto blueprintfuzz_blueprint
withsanitizer-coverage-inline-8bit-counters
flag used to track program coverage. After the execution, the coverage is delivered to honggfuzz fuzzer to prepare new test cases.FuzzBlueprint contains a bug which would be very hard to find just by guessing the inputs to it. With the coverage data the fuzzer is able to find this bug within few minutes.
To run the fuzzer on Debian on Ubuntu you need to have rust installed and do the following steps:
This is only a proof of concept that fuzzing WASM smart contracts is possible. To make this feature useful the following steps should be done:
wasmer
instead ofwasmi
with ahead of time compilation, preferably using LLVM backend. Everything related to execution of program, like loading and compiling the WASM code should be done just once and then cached. I believe that 10x speedup would be achievable in this case.trace-cmp
flag.There's a lot to be done, but in short summary - it would be possible to create equivalent of Echidna or something even better for scrypto blueprints in reasonable time period, maybe just 2-3 months. At some point of scrypto and Radix development, it will be important thing to have such a feature.