polardbxengine/extra/openssl-1.1.0l/fuzz
dengwendi 1d6524707e INIT 2023-11-15 15:04:10 +08:00
..
README.md INIT 2023-11-15 15:04:10 +08:00
asn1.c INIT 2023-11-15 15:04:10 +08:00
asn1parse.c INIT 2023-11-15 15:04:10 +08:00
bignum.c INIT 2023-11-15 15:04:10 +08:00
bndiv.c INIT 2023-11-15 15:04:10 +08:00
build.info INIT 2023-11-15 15:04:10 +08:00
cms.c INIT 2023-11-15 15:04:10 +08:00
conf.c INIT 2023-11-15 15:04:10 +08:00
crl.c INIT 2023-11-15 15:04:10 +08:00
ct.c INIT 2023-11-15 15:04:10 +08:00
driver.c INIT 2023-11-15 15:04:10 +08:00
fuzzer.h INIT 2023-11-15 15:04:10 +08:00
helper.py INIT 2023-11-15 15:04:10 +08:00
server.c INIT 2023-11-15 15:04:10 +08:00
test-corpus.c INIT 2023-11-15 15:04:10 +08:00
x509.c INIT 2023-11-15 15:04:10 +08:00

README.md

I Can Haz Fuzz?

LibFuzzer

Or, how to fuzz OpenSSL with libfuzzer.

Starting from a vanilla+OpenSSH server Ubuntu install.

Use Chrome's handy recent build of clang. Older versions may also work.

$ sudo apt-get install git
$ mkdir git-work
$ git clone https://chromium.googlesource.com/chromium/src/tools/clang
$ clang/scripts/update.py

You may want to git pull and re-run the update from time to time.

Update your path:

$ PATH=~/third_party/llvm-build/Release+Asserts/bin/:$PATH

Get and build libFuzzer (there is a git mirror at https://github.com/llvm-mirror/llvm/tree/master/lib/Fuzzer if you prefer):

$ cd
$ sudo apt-get install subversion
$ mkdir svn-work
$ cd svn-work
$ svn co http://llvm.org/svn/llvm-project/llvm/trunk/lib/Fuzzer
$ cd Fuzzer
$ clang++ -c -g -O2 -std=c++11 *.cpp
$ ar r libFuzzer.a *.o
$ ranlib libFuzzer.a

Configure for fuzzing:

$ CC=clang ./config enable-fuzz-libfuzzer \
        --with-fuzzer-include=../../svn-work/Fuzzer \
        --with-fuzzer-lib=../../svn-work/Fuzzer/libFuzzer \
        -DPEDANTIC enable-asan enable-ubsan no-shared
$ sudo apt-get install make
$ LDCMD=clang++ make -j
$ fuzz/helper.py $FUZZER

Where $FUZZER is one of the executables in fuzz/.

If you get a crash, you should find a corresponding input file in fuzz/corpora/$FUZZER-crash/. You can reproduce the crash with

$ fuzz/$FUZZER <crashfile>

AFL

Configure for fuzzing:

$ sudo apt-get install afl-clang
$ CC=afl-clang-fast ./config enable-fuzz-afl no-shared
$ make

Run one of the fuzzers:

$ afl-fuzz -i fuzz/corpora/$FUZZER -o fuzz/corpora/$FUZZER/out fuzz/$FUZZER

Where $FUZZER is one of the executables in fuzz/.