教材 P239,15 题
综合实验:使用 American Fuzzy Lop(http:/lcamtuf.coredump.cx/afl/)工具挖掘 C/C++程序漏洞。完成实验报告。
实验环境:WSL2
配置 American Fuzzy Lop
1 2 3 4 5 6
| wget http://lcamtuf.coredump.cx/afl/releases/afl-2.52b.tgz tar -zxvf afl-2.52b.tgz cd afl-2.52b/ make sudo make install afl-fuzz
|
创建 test.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| #include <stdio.h>
int main() { char buf[100] = {0};
gets(buf);
if (buf[0] == 'A') { printf("Hello A\n"); } else { printf("No A\n"); }
return 0; }
|
创建 AFL 输入和输出目录,并运行 afl-fuzz
1 2 3 4
| mkdir fuzz_in fuzz_out echo "hello" > fuzz_in/testcase afl-gcc test.c -o test afl-fuzz -i fuzz_in -o fuzz_out ./test
|