Fuzzing
Created: 2021-05-28 09:09:58
Modified: 2021-11-15 19:17:10
AFL
Technical “whitepaper” for afl-fuzz.
quick use
installation.
git clone git@github.com:google/AFL.git
cd AFL
make
sudo make install
# check installation
afl-gccfuzzing test.
cd ~/Documents
mkdir test
cd test
mkdir ipnut output
# prepare targeted file imgRead.c, refer to Appendix A
touch imgRead.c
# after writing imgRead.c, compile the program using afl-gcc
afl-gcc -fsanitize=address -fsanitize=undefined imgRead.c -o imgRed
# prepare input, refer to https://www.youtube.com/watch?v=NiGC1jxFx78&list=PLHGgqcJIME5koI76OlBdBj7sCid1hbjf-&index=3
echo "aaaa" > input/image.img
echo "IMG" > input/image.img
xxd input/image.img
afl-fuzz -i input/ -o output -m none -- ./imgRed @@
# for troubleshooting refer to Appendix B
# press Ctrl + C to exit from afl-fuzz
analysis.
xxd id:000000,sig:06,src:000000,op:havoc,rep:64
# or use crashwalk, refer to https://www.freebuf.com/articles/system/197678.html
sudo apt-get install gdb golang
cd ~
mkdir tools
cd tools
git clone https://github.com/jfoote/exploitable.git
mkdir go
export GOPATH=~/tools/go
export CW_EXPLOITABLE=~/tools/exploitable/exploitable/exploitable.py
go get -u github.com/bnagy/crashwalk/cmd/...
# wait for downloading, then use cwtriage
~/tools/go/bin/cwtriage -root ~/Documents/mycode/test/ -aflCode Coverage.
# use afl-cov, refer to https://www.freebuf.com/articles/system/197678.html
Concept
CFG
CFG, control flow graph, consists of node(block) and edge.
Code Coverage
refer to SanitizerCoverage.
Appendix
A. targeted file
|
B. troubleshooting
- for the first time
|
*Ctrl + D
: exit from root
or refer to https://i-m.dev/posts/20191001-225746.html, https://blog.csdn.net/qysh123/article/details/114794833
|