python - 如何创建跳过某些种子的增强型 AFL 模糊器?

标签 python c fuzzing fuzzer american-fuzzy-lop

我是一名硕士生,致力于复制论文的结果:https://www.microsoft.com/en-us/research/publication/not-all-bytes-are-equal-neural-byte-sieve-for-fuzzing/

我想创建一个增强型模糊器,它拒绝对它认为无用的种子进行修改。实现这一目标的任何帮助都将非常有帮助。

我为增强模糊器创建了一个简单的 python 函数。为了测试实现,我采用了简单的“deadbeef”程序并编写了 python 函数,这样每当种子被修改为“deadbeef”时,该函数就会向 AFL 的“common_fuzz_stuff()”函数发送一个“无用”的返回值- 模糊代码。这应该意味着模糊器不应该能够找到崩溃。但它仍然能够找到崩溃,我无法确定哪里出了问题。

这是 AFL 的 python 函数:

 def check_useful(seed):

  my_string = str.encode('deadbeef')

  file = open(seed, 'rb')

  value = file.read()


  if (value == my_string):

    print('[*] Crash Found!')

    return True


 else:

   return False 

这是 afl-fuzz.c 代码片段:

/* Write a modified test case, run program, process results. Handle

error conditions, returning 1 if it's time to bail out. This is

a helper function for fuzz_one(). */


EXP_ST u8 common_fuzz_stuff(char** argv, u8* out_buf, u32 len) {


if (PyCallable_Check(pFuncCheckModel)){


pArgs = PyTuple_New(1);

PyTuple_SetItem(pArgs, 0, PyUnicode_FromString(queue_cur->fname));

pFuncReturn = PyObject_CallObject(pFuncCheckModel, pArgs);

if (PyObject_IsTrue(pFuncReturn)){

skip_requested = 1;

return 1;

}

} else

{

PyErr_Print();

}

即使种子“deadbeef”的 common_fuzz_stuff() 函数的返回值为 1,我的程序如何仍然能够找到崩溃?

最佳答案

如果您决定此输入是否有用仅取决于输入本身(而不是突变),据我所知,您可以使用experimental/post_library 东西。该文档包含在示例 post_library 中,并包含一条注释,这可能不是您想要的——不是您的特定需要,这是该文档的近似引用。 :)

另一方面,此单功能 API 描述包含以下内容:

2) If you want to skip this test case altogether and have AFL generate a
   new one, return NULL. Use this sparingly - it's faster than running
   the target program with patently useless inputs, but still wastes CPU
   time.

关于python - 如何创建跳过某些种子的增强型 AFL 模糊器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54277963/

相关文章:

Python:我想检查行是否对数据框中的任何列具有多个相同的值,如果是,则将重复的值替换为 null

c - 有没有办法在 Windows 7 上以编程方式激活 Windows

c++ - PostgreSql 查询中的参数数据类型错误

c - LLVM libFuzzer rss 内存增加

python - 在 python 中,我如何只打印 shell 命令产生的 stdout 的第一行

python - 如果我将 MongoDB 作为我的根工厂,是否还需要使用 Configurator 注册它?

python - 使用wxPython.FileDialog保存文件

c - 这是正确的吗? (在 C 中读入文件)

testing - 我应该避免模糊错误处理代码吗

linux - 模糊测试 Linux 内核 : A student in peril.