一、安装AFL
sudo apt-get install clang
sudo apt-get install llvm
官网下载最新安装包
解压后进入该目录
make
sudo make install
*error:
原因:新开的虚拟机没安装make :)
二、原理
https://paper.seebug.org/496/ AFL(American Fuzzy Lop)实现细节与文件变异
https://www.wxnmh.com/thread-5948378.htm AFL afl_fuzz.c 详细分析
三、测试案例
Bind
官网下载 http://www.linuxfromscratch.org/blfs/view/svn/basicnet/bind-utils.html
安装
./configure --prefix=/usr --without-python && make -C lib/dns && make -C lib/isc && make -C lib/bind9 && make -C lib/isccfg && make -C lib/irs && make -C bin/dig
make -C bin/dig install
命令说明
--without-python
:使用此选项,无需使用未使用的python模块。
make -C lib / ...:这些命令将构建客户端程序所需的库。
make -C bin / dig:此命令生成客户端程序。
然鹅!!!上面是正常使用的操作
测试应该:
一定要替换CC(或者CXX)再编译
--without-python 是必要的,不然就会。。。(如下图)
编译过程发现新虚拟机各种缺包
pkg-config
libuv(直接安装libuv没有包,需要手动编译)
下载并编译libuv
libuv需要自己手动下载源码,并手动编译。
当前目录为:/home/xlz/test/github/,在后面,会用$PATH来代替,我的系统的Debian8,64bit.
$git clone https://github.com/libuv/libuv.git
即可下载到libuv源码
然后$cd libuv 进入到libuv源码目录下,准备编译。
依次运行如下命令:
$ sh autogen.sh
$ ./configure
$ make
$ make check
$ sudo make install
备注:
如果提示缺少一些库,请自行安装,apt-get install packagename
如,我运行autogen.sh的时候,就提示缺少automake,libtoolize库:
xlz@debian:~/test/github/libuv$ sh autogen.sh
autogen.sh: 1: autogen.sh: automake: not found
autogen.sh: 33: test: Illegal number:
autogen.sh: 34: test: Illegal number:
- libtoolize --copy
autogen.sh: 43: autogen.sh: libtoolize: not found
运行如下命令,手动安装,即可:
$ sudo apt-get install automake
$ sudo apt-get install libtool
没有尽头的最后。。。
不玩了QAQ
换一个
测试binutils:
重写CC编译环境变量的值(如果是C++程序,且用g++而不是gcc进行编译,则修改CXX),修改后即可运行configure脚本,然后编译。
CC=afl-gcc ./configure
make
编译完成后,要修改一下配置,使系统将coredump输出到文件,而不是上报给系统的处理程序:echo core > /proc/sys/kernel/core_pattern
建一个input文件夹作为afl fuzz的输入,再建立一个out文件夹,作为afl fuzz的输出,afl fuzz会将崩溃、挂起等问题记录到输出文件中
mkdir afl_in afl_out
cp /bin/ps afl_in/
接下来,就可以使用afl fuzz进行模糊测试了:
cd ~/binutils-2.25
afl-fuzz -i afl_in -o afl_out ./binutils/readelf -a @@
afl fuzz启动后,我们将看到如下界面:

———————————————————— 资料总结 ——————————————————————
https://www.jianshu.com/p/b1182441d8ef AFL Fuzz安装及完成一次简单的模糊测试
安装使用
1. AFL入门
https://www.cnblogs.com/0xHack/p/9414444.html
2. [原创][新手向] 使用AFL来fuzz upx
https://bbs.pediy.com/thread-249179.htm
3. [翻译]使用AFL进行fuzz
https://bbs.pediy.com/thread-250866.htm
4. AFL漏洞挖掘技术漫谈(一):用AFL开始你的第一次Fuzzing
https://paper.seebug.org/841/
5. AFL 漏洞挖掘技术漫谈(二):Fuzz 结果分析和代码覆盖率
https://paper.seebug.org/842/
6. afl-fuzz技术初探
https://www.cnblogs.com/WangAoBo/p/8280352.html
7. AFL使用指南
http://zeroyu.xyz/2019/05/15/how-to-use-afl-fuzz/
8. Fuzz Testing with afl-fuzz (American Fuzzy Lop)
https://spin.atomicobject.com/2015/08/23/fuzz-testing-american-fuzzy-lop/
白皮书及文档翻译
1. 使用Afl-fuzz (American Fuzzy Lop) 进行fuzzing测试(一)——使用初体验
https://blog.csdn.net/youkawa/article/details/45696317
2. 使用Afl-fuzz (American Fuzzy Lop) 进行fuzzing测试(二)——详细使用说明(README.txt )
https://blog.csdn.net/youkawa/article/details/76405468
3. 使用Afl-fuzz (American Fuzzy Lop) 进行fuzzing测试(三)——技术白皮书(technical whitepaper)
https://blog.csdn.net/youkawa/article/details/76615480
4. afl技术白皮书笔记(1)
https://ljie.space/2018/01/22/afl%E6%8A%80%E6%9C%AF%E7%99%BD%E7%9A%AE%E4%B9%A6%E7%AC%94%E8%AE%B0-1/
5. afl-fuzz技术白皮书
https://blog.csdn.net/gengzhikui1992/article/details/50844857
技术分析
1. ★★ 漏洞挖掘技术之 AFL 项目分析
https://bbs.pediy.com/thread-249912.htm
2. [原创]afl-fuzz源码情景分析,详细读码笔记,freemind版本和word版本
https://bbs.pediy.com/thread-218671.htm
3. AFL技术实现分析
https://blog.csdn.net/qq_32464719/article/details/80592902#comments
4. ★★ AFL内部实现细节小记
http://rk700.github.io/2017/12/28/afl-internals/
5. ★★ AFL文件变异一览
http://rk700.github.io/2018/01/04/afl-mutations/
6. AFL改进小试
http://rk700.github.io/2018/02/02/afl-enhancement/
7. ★★ AFL-fuzz工具分析
https://blog.csdn.net/Chen_zju/article/details/80791268
8. AFL源码分析笔记(一)
https://xz.aliyun.com/t/4628
9. AFL源码分析1——afl-gcc.c源码分析
https://ch4r1l3.github.io/2019/03/05/AFL%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%901%E2%80%94%E2%80%94afl-gcc-c%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90/
10. AFL源码分析2——afl-as.c源码分析
https://ch4r1l3.github.io/2019/03/06/AFL%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%902%E2%80%94%E2%80%94afl-as-c%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90/
11. AFL源码分析3——afl-as.h源码分析
https://ch4r1l3.github.io/2019/03/08/AFL%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%903%E2%80%94%E2%80%94afl-as-h%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90/
12. AFL源码分析4——afl-fuzz.c源码分析1
https://ch4r1l3.github.io/2019/03/09/AFL%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%904%E2%80%94%E2%80%94afl-fuzz-c%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%901/
13. AFL源码分析5——afl-fuzz.c源码分析2
https://ch4r1l3.github.io/2019/03/10/AFL%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%905%E2%80%94%E2%80%94afl-fuzz-c%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%902/
14. afl fuzzer 源代码阅读
https://www.cnblogs.com/jg01/p/9772700.html
15. AFL不同文件结构
https://barro.github.io/2018/06/afl-fuzz-on-different-file-systems/
16. Fuzzing workflows; a fuzz job from start to finish
https://foxglovesecurity.com/2016/03/15/fuzzing-workflows-a-fuzz-job-from-start-to-finish/
AFL 项目
1. AFL最原始版本,源码地址
https://github.com/google/AFL
2. [翻译]AFL生态圈 (这篇文章有很多关于AFL的开源项目地址和简单介绍)
https://bbs.pediy.com/thread-251051.htm
3. AFLplusplus(该工具做了一些集成)
https://github.com/vanhauser-thc/AFLplusplus
4. [分享]关于 fuzz 的 一点总结
https://bbs.pediy.com/thread-249986.htm