C 一个简单的例子说明了美国模糊Lop的失败
我一直在尝试使用美国模糊Lop,但我无法使用这样一个简单的示例:C 一个简单的例子说明了美国模糊Lop的失败,c,gcc,american-fuzzy-lop,C,Gcc,American Fuzzy Lop,我一直在尝试使用美国模糊Lop,但我无法使用这样一个简单的示例: #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; } 但它不起作用 [*] Attempting dry
#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;
}
但它不起作用
[*] Attempting dry run with 'id:000000,orig:a.out'...
[*] Spinning up the fork server...
[-] Whoops, the target binary crashed suddenly, before receiving any input
from the fuzzer! There are several probable explanations:
- The current memory limit (2.00 GB) is too restrictive, causing the
target to hit an OOM condition in the dynamic linker. Try bumping up
the limit with the -m setting in the command line. A simple way confirm
this diagnosis would be:
( ulimit -Sv $[2047 << 10]; /path/to/fuzzed_app )
Tip: you can use http://jwilk.net/software/recidivm to quickly
estimate the required amount of virtual memory for the binary.
- The binary is just buggy and explodes entirely on its own. If so, you
need to fix the underlying problem or find a better replacement.
- Less likely, there is a horrible bug in the fuzzer. If other options
fail, poke <lcamtuf@coredump.cx> for troubleshooting tips.
[-] PROGRAM ABORT : Fork server crashed with signal 6
Location : init_forkserver(), afl-fuzz.c:2056
[*]正在尝试使用“id:000000,orig:a.out”进行试运行。。。
[*]启动fork服务器。。。
[-]哎呀,目标二进制文件在收到任何输入之前突然崩溃了
来自毛绒人!有几种可能的解释:
-当前内存限制(2.00 GB)太严格,导致
目标以达到动态链接器中的OOM条件。试着往上爬
命令行中带有-m设置的限制。一种简单的确认方法
这一诊断将是:
(ulimit-Sv$[2047第一个问题是,当程序接受命令行参数时,您使用'@@'命令将输入作为文件传递给afl fuzz。afl接受来自stdin或文件的输入。
导致启动时崩溃的第二个问题是afl给testcase文件名的自动名称:
[*] Attempting dry run with 'id:000000,orig:a.out'...
这足以使缓冲区溢出并导致segfault。第一个问题是,当程序接受命令行参数时,您正在使用“@@”命令将输入作为文件传递给afl fuzz。afl接受来自stdin或文件的输入。
导致启动时崩溃的第二个问题是afl给testcase文件名的自动名称:
[*] Attempting dry run with 'id:000000,orig:a.out'...
这足以使缓冲区溢出并导致segfault。要完成wintermute响应,如果您想尝试AFL或演示其工作原理,可以执行以下操作:
path
变量是@参数的路径
char *buff;
if ((buff = malloc(10)) == NULL)
abort();
if ((fd = fopen(path, "r")) == NULL)
abort();
fread(buff, 10, 1, fd);
if (strncmp(buff, "h", 1) == 0)
{
if (strncmp(buff, "he", 2) == 0)
{
if (strncmp(buff, "hel", 3) == 0)
{
if (strncmp(buff, "hell", 4) == 0)
{
if (strncmp(buff, "hello", 5) == 0)
{
buff[9] = 0; //just to be sure...
fprintf(stderr, "Nailed it ! input file is %s\n", buff);
abort();
}
}
else
{
abort(); // it should be found quick
}
}
}
}
free(buff);
fclose(fd);
使用<代码>流产()/<代码>将导致非法指令,这被认为是AFL的崩溃。因此,在这个例子中,您将得到多个不同的崩溃。
< P>完成WestMuter响应,如果您想尝试AFL或演示它工作,您可以做类似的事情:
path
变量是@参数的路径
char *buff;
if ((buff = malloc(10)) == NULL)
abort();
if ((fd = fopen(path, "r")) == NULL)
abort();
fread(buff, 10, 1, fd);
if (strncmp(buff, "h", 1) == 0)
{
if (strncmp(buff, "he", 2) == 0)
{
if (strncmp(buff, "hel", 3) == 0)
{
if (strncmp(buff, "hell", 4) == 0)
{
if (strncmp(buff, "hello", 5) == 0)
{
buff[9] = 0; //just to be sure...
fprintf(stderr, "Nailed it ! input file is %s\n", buff);
abort();
}
}
else
{
abort(); // it should be found quick
}
}
}
}
free(buff);
fclose(fd);
使用<代码>中止()/代码>将导致非法指令,这被认为是AFL的崩溃。因此,在这个例子中,您将得到多个不同的崩溃。
我不太知道实际传递给程序的参数。AFL必须有一个可以尝试的规范代码示例。<代码>字符名称〔10〕。
可能太短,无法保存传入的实际参数。使用而不是strcpy
的想法是在那里有一个溢出。一个容易捕获的溢出。我试图增加数组大小,但得到了相同的结果。不要使用strncpy
,因为它不会在溢出情况下终止缓冲区。我不太了解一个参数是什么re实际传递给程序。AFL必须有一个规范的代码示例,您可以尝试。char name[10]
可能太短,无法保存传入的实际参数。使用而不是strcpy
的想法是在那里有一个溢出。一个容易捕获的溢出。我尝试增加数组大小,但得到了相同的结果。不要使用strncpy
,因为它不会在溢出情况下终止缓冲区