我想用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)。
答案 0 :(得分:0)
内存限制可能太低。尝试设置更多的内存大小或将其设置为无。
afl-analyze -m none -i foo.txt ./main