A Bytecode Alliance project
Usage
Add wasm-mutate to your Cargo.toml:
$ cargo add wasm-mutate
You can also mutate a WebAssembly binary by using the cli tool:
Features
-
semantically equivalent transformations:
wasm-mutatehas the ability to only apply semantics-preserving changes to the input Wasm module. When it is used in this mode, the mutated Wasm computes identical results when given the same inputs as the original Wasm module. -
determinism:
wasm-mutateis deterministic, i.e., given the same input Wasm module and the same seed, it always produces the same mutated output Wasm module. -
libfuzzer integration:
wasm-mutateintegrates well with mutation-based fuzzers like libFuzzer. It reuses the fuzzer's raw input strings.wasm-mutateworks with theLLVMFuzzerCustomMutatorhook and thelibfuzzer_sys::fuzz_mutator!macro.Example
use ; use ; use WasmFeatures; fuzz_target!; fuzz_mutator!; -
test case reduction (WIP):
wasm-mutatecan have the ability to restrict mutations to only those that shrink the size of the Wasm module. If it is used in this mode,wasm-mutateessentially becomes a Wasm test-case reducer. We are currently working to provide a prototype of this feature as a separate binary. The following pseudo-Rust provides the general picture of it as an standard hill-climbing algorithm.let wasmmutate = default .seed .fuel .preserve_semantics .reduce; while MAX_ITERATIONS > 0 return wasm
License
This project is licensed under the Apache 2.0 license with the LLVM exception. See LICENSE for more details.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.
Special contribution
- Javier Cabrera Arteaga (Phd. student at KTH)