The GNU Binutils are a collection of binary tools widely used in GNU/Linux. We use this to demonstrate how to use Hakweye to fuzz with binaries with a given build script. In this case, we deal with the CVE-2016-4487 case, where the target site is according to the bug report page.
mkdir 4487export INFO_DIR=$PWD/4487wget https://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.gz && tar xf binutils-2.26.tar.gzexport SRC_DIR=$PWD/binutils-2.26$INFO_DIR:# llvm.toml
[tgt]infile = "tgt_lines.in"out_dir = "."[ins]proj_name = "binutils-4487"dist_file = "bb.dist"# tgt_lines.in
/home/hawkeye/test-ccs/binutils-2.26/libiberty/cplus-dem.c:4300cd $SRC_DIRexport CFLAGS="-Wno-error -g $HE_FLAGS"export CXXFLAGS="-Wno-error -g $HE_FLAGS"export LDFLAGS="-ldl"../configure --disable-shared --disable-werror --prefix=$PWD/installmake -jThere will be an LLVM Bitcode file "cxxfilt.0.0.preopt.bc".
cp cxxfilt.0.0.preopt.bc $INFO_DIRcd $INFO_DIRopt-6.0 -mem2reg -load /usr/local/lib/hawkeye/libhe-tgt.so -he-conf ./llvm.toml -he-analyze ./cxxfilt.0.0.preopt.bc -o /dev/nullhe-dists -b ./cxxfilt.0.0.preopt.bc -i $PWDexport HE_FLAGS="-he-conf=$INFO_DIR/llvm.toml"cd $SRC_DIRmake cleanexport CFLAGS="-Wno-error -g $HE_FLAGS"export CXXFLAGS="-Wno-error -g $HE_FLAGS"export LDFLAGS="-ldl"../configure --disable-shared --disable-werror --prefix=$PWD/installmakecd $INFO_DIRhe-funcs extract -p binutils-4487he-funcs score -d funcs.dist -m funcs.txt -p proj_trace_funcs.json -o trace_funcs.json[io]in_folder = "in"out_folder = "out"[exec]use_forkserver = truemem_limit = 200timeout = 50qemu_mode = false[exec.sa]trace_func_file = "trace_funcs.json"callgraph_file = "callgraph.yaml"tgt_func_file = "tgt_funcs.txt"[record]proj_name = "binutils-4487"interval = 2000url = "redis://127.0.0.1/"log_entry_info = false[calibration]# for simple regular case calibrationnormal_cycles = 7# for variable behaviors calibrationvar_behavior_cycles = 37[minimize]ck_redundant_file = false[mutation]# ops = ["det", "dict", "havoc", "splice"]# ops = ["havoc", "splice", "sem"]max_file_length = 128#dict_folder = "dicts_test"dict_level = 0# max_token_length: 64# min_token_length: 2# max_dict_size: 256# in minuteshavoc_adjust_duration = 12[fz]workers = 1bind_cpu = false# "normal"/"crash"keep_mode = "normal"# "simple"/...scorer = "simple"exit_nonzero_as_crash = falseignored_signals = [][fz.conductor]# in minutesreport_duration = 3[fz.sync]duration = 200execs = 5mkdir inecho "" > in/filehe-fuzz -c ./Config.toml -- $SRC_DIR/binutils/cxxfilt# cxxfilt accepts input from stdin