【发布时间】:2018-05-24 13:30:13
【问题描述】:
我想用 afl 对我的应用程序进行模糊测试,但是在将 gcc 替换为 afl-gcc 后,我仍然收到错误消息:[-] PROGRAM ABORT : No instrumentation detected.
我创建了一个简单的 C 程序来调试问题:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
static int do_stuff(int fd) {
char buffer[3];
read(fd, buffer, sizeof(buffer));
int size = atoi(buffer);
char* str = malloc(size);
read(fd, str, size);
printf("'%s'\n", str);
free(str);
return 0;
}
int main(int argc, char** argv) {
if (argc < 2)
return 1;
int fd = open(argv[1], O_RDONLY);
if (fd < 0)
return 2;
int ret = do_stuff(fd);
close(fd);
return ret;
}
我用afl-gcc main.c -o main 编译它。
作为输入文件,我使用echo "12 Hello World.foobar" > foo.txt
当我现在运行 afl-analyze -i foo.txt ./main 时,我得到了
afl-analyze 2.52b by <lcamtuf@google.com>
[+] Read 22 bytes from 'foo.txt'.
[*] Performing dry run (mem limit = 50 MB, timeout = 1000 ms)...
[-] PROGRAM ABORT : No instrumentation detected.
Location : main(), afl-analyze.c:1068
我错过了什么吗? 我直接从 Ubuntu 存储库 (18.04) 安装了 afl (2.52b-2)。
【问题讨论】:
-
当我使用
afl-clang时它可以工作,所以我想这是 Ubuntu 包中的一个错误。
标签: c gcc american-fuzzy-lop