Here's the presentation.
The prerequisite for the session would be to complete the steps from below till "Installing QEMU mode".
Note: The setup requires Ubuntu 17.04 or lower
- Installing Prerequisites
- Installing AFL
- Working with AFL
- Miscellaneous
- Hands-on
- Optimising the fuzzing process
- Fuzzing binaries without source
- Install required compilers with the following commands:
sudo apt install gcc
sudo apt install clang- Install
GDBwith the following command:
sudo apt install gdb- Install
exploitablewith the following commands:
git clone https://github.com/jfoote/exploitable.git
cd exploitable/
python setup.py install- Install
screenwith the following command:
sudo apt install screen- To run
QEMUmode, we'd need to install a bunch of dependencies. Install the dependencies by running the following commands:
sudo apt install libtool-bin
sudo apt install automake
sudo apt install bison
sudo apt install libglib2.0-dev
sudo apt install qemu- Install
AFLwith these commands:
wget http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz
tar -xzvf afl-latest.tgz
cd afl-2.52b/
make
sudo make install- Install llvm compiler with these commands:
cd afl-2.51b/llvm_mode/
sudo apt-get install llvm-dev llvm
make
cd ..
make
sudo make install- Install QEMU mode with the following commands:
cd afl-2.52b/qemu_mode
./build_qemu_support.sh
cd ..
sudo make install- Compile the application with the following commands:
export CC=afl-clang-fast
export AFL_HARDEN=1
export AFL_INST_RATIO=100
./configure
make- Build
test corpuswitht the following command:
cp /bin/ps afl_in/- Download
binutils(or any binary):
wget http://ftp.gnu.org/gnu/binutils/binutils-2.25.tar.gz- Build binary for
binutils:
tar -xvzf binutils-2.25.tar.gz
cd ~/binutils-2.25
CC=afl-clang-fast ./configure
make- System configuration change to avoid false-negatives:
sudo bash -c "echo core > /proc/sys/kernel/core_pattern"- Build required directories for AFL with the following commands:
cd ~/binutils-2.25
mkdir afl_in afl_out
cp /bin/ps afl_in/- Start fuzzing with the following command:
cd ~/binutils-2.25
afl-fuzz -i afl_in -o afl_out -- ./binutils/readelf -a @@- To check available cores use the following command:
afl-gotcpu- To run parallel fuzzers on
binutilswithscreen, use the following commands:
screen -dmS fuzzer1 /bin/bash -c "afl-fuzz -i afl_in -o alf_out -M fuzzer1 -- ./binutils/readelf -a @@"
screen -dmS fuzzer2 /bin/bash -c "afl-fuzz -i afl_in -o alf_out -S fuzzer2 -- ./binutils/readelf -a @@"
screen -dmS fuzzer3 /bin/bash -c "afl-fuzz -i afl_in -o alf_out -S fuzzer3 -- ./binutils/readelf -a @@"
screen -dmS fuzzer4 /bin/bash -c "afl-fuzz -i afl_in -o alf_out -S fuzzer4 -- ./binutils/readelf -a @@"- To read from the specified fuzzer, use the following command:
screen -rd <session name>- To detach from a
screensession and return back to the terminal, use the following key combination:
Ctrl + a
d
- Clone
fuzzgoatwith the following command:
git clone https://github.com/fuzzstati0n/fuzzgoat- Compile
fuzzgoatwith the following command:
cd fuzzgoat
CC=afl-clang-fast
make- To make required directories for
fuzzgoat(it already has ainput-filesdirectory), use the following command:
mkdir afl_out- To starting the fuzzers in parallel with
screen, use the following commands:
screen -dmS fuzzer1 /bin/bash -c "afl-fuzz -i input-files -o alf_out -M fuzzer1 -- ./fuzzgoat @@"
screen -dmS fuzzer2 /bin/bash -c "afl-fuzz -i input-files -o alf_out -S fuzzer2 -- ./fuzzgoat @@"
screen -dmS fuzzer3 /bin/bash -c "afl-fuzz -i input-files -o alf_out -S fuzzer3 -- ./fuzzgoat @@"
screen -dmS fuzzer4 /bin/bash -c "afl-fuzz -i input-files -o alf_out -S fuzzer4 -- ./fuzzgoat @@"- To reading AFL output, use the following command:
screen -rd fuzzer1- To check status of fuzzers, use the following command:
afl-whatsup afl_out- To examine crash with
GDB, use the following command:
gdb ../../../fuzzgoat- To check for exploitable bug, use the following command:
(gdb) source ../../../../exploitable/exploitable/exploitable.py
--- snipped ---
(gdb) exploitable- To minimise the number of test cases, use the following command:
afl-cmin -i afl_in -o afl_out -- ./fuzzgoat @@- To minimise the individual test cases, use the following command:
afl-tmin -i afl_in -o afl_out -- ./fuzzgoat @@- To fuzz binaries without source with QEMU mode, use the following command:
afl-fuzz -Q -i afl_in -o alf_out -- <Binary> <options> @@