我是第一次尝试 AFL,因此我发现了一个非常简单的易受攻击的 C 代码,我可以用它来测试 AFL。
问题中的C代码是
#include <stdio.h>
#include <string.h>
int main(int argc, char * argv[]){
char name[10];
if ( argc > 1 ){
strcpy(name, argv[1]);
printf("HELLO %s\n", name);
}
return 0;
}
我通过运行编译该代码afl-gcc test.c -o test
并对其进行了测试,以确保它在假设的情况下崩溃(运行./test $(python3 -c "print('A'*26)")
将按预期给出分段错误)
这里的问题是,我创建了一个测试用例echo -en "test\x00" > input/testcase
并运行 AFL afl-fuzz -i afl_in -o afl_out -- ./test
,但一天后它仍然没有发现任何崩溃。
我还尝试创建一个会强制它崩溃的测试用例,python3 -c "print('A'*26)" > input/testcase
但它仍然运行并且没有找到任何东西。
这被认为是最简单的例子,所以我可以更好地了解 AFL,但事实证明这是一个挑战。任何人都可以帮忙吗?