0

我想用 afl 模糊我的应用程序,但替换gccafl-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)。

4

1 回答 1

0

可能内存限制太低了。尝试设置更多内存大小或将其设置为无。

afl-analyze -m none -i foo.txt ./main
于 2018-07-20T10:56:05.450 回答