/libprotobuf-mutator_fuzzing_learning

Learn how to combine libprotobuf-mutator with libfuzzer & AFL++

Primary LanguageC++

libprotobuf-mutator_fuzzing_learning

Learn how to combine libprotobuf-mutator with libfuzzer & AFL++

Environment Settings

  • Ubuntu Linux 18.04 64 bit
  • Clang 9.0.0

Install Clang/LLVM & libfuzzer

  • Follow the step in this article and add the toolchain's apt repository in Ubuntu.
  • sudo apt-get install clang-9 libfuzzer-9-dev

Install libprotobuf-mutator

Follow the step in libprotobuf-mutator's readme

Install dependencies

sudo apt-get update
sudo apt-get install protobuf-compiler libprotobuf-dev binutils cmake \
  ninja-build liblzma-dev libz-dev pkg-config autoconf libtool

Compile and test everything:

cd libprotobuf-mutator
mkdir build
cd build
cmake .. -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DLIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF=ON
ninja check # test
ninja # build
sudo ninja install # install

Notice
Use the following cmake command to build libprotobuf-mutator-libfuzzer.so.0 and libprotobuf-mutator.so.0 shared library

 cmake .. -GNinja -DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9 -DCMAKE_BUILD_TYPE=Debug -DLIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF=ON -DBUILD_SHARED_LIBS=ON

Learning

Reference