CLFuzz is a generation-based fuzzer on cryptographic algorithms. It extracts the semantic information including cryptographic-specific constraints and function signatures of targeted algorithms, and conducts a three-stage cross-check for bug detection.
Introduction of some files and directories
README.md
: basic information about CLFuzzentry.cpp
: the fuzzing entrydriver.cpp
: driver for invoking targeted algorithmsinput_generator.cpp
: the input generator for generating high-quality test inputrecyclepool.cpp
: the oracle recycling poolsmodules/
: the driver for targeted libraries
Set the sanitizers and fuzzing engine link.
export CFLAGS="-fsanitize=address,undefined,fuzzer-no-link -O2 -g"
export CXXFLAGS="-fsanitize=address,undefined,fuzzer-no-link -D_GLIBCXX_DEBUG -O2 -g"
export LIBFUZZER_LINK="-fsanitize=fuzzer"
Run:
python gen_repository.py
To build the driver for each targeted module, follow the steps:
- Compile the library into a static library file.
- Specify the required environment variables.
- Enter the directory for each library under
modules/
- Make the driver
For example, when building Cryptopp, the steps are:
- Compile Cryptopp:
git clone --depth 1 https://github.com/weidai11/cryptopp/
cd cryptopp/
make libcryptopp.a -j$(nproc)
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_CRYPTOPP"
export LIBCRYPTOPP_A_PATH=`realpath libcryptopp.a`
export CRYPTOPP_INCLUDE_PATH=`realpath .`
- Build the Driver:
cd CLFuzz/modules/cryptopp/
make
Enter the root location of CLFuzz and execute:
make
This operation will generate the executable file CLFuzz
.
Execute it through:
./CLFuzz
For some supported options, see Libfuzzer.