1

我是一名正在复制论文结果的硕士生:https ://www.microsoft.com/en-us/research/publication/not-all-bytes-are-equal-neural-byte-sieve-for-模糊测试/

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

我为增强的模糊器创建了一个简单的 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,我的程序如何仍然能够找到崩溃?

4

2 回答 2

0

要回答我自己的问题:我必须发送out_file到 Python 函数而不是queue_cur->fname.

PyTuple_SetItem(pArgs, 0, PyUnicode_FromString(out_file));

同样skip_requested = 1;在上面的代码中是多余的。

现在模糊器将运行并且不会发现崩溃

于 2019-02-12T14:38:02.463 回答
0

如果您决定此输入是否有用仅取决于输入本身(而不是突变),据我所知,您可以使用这些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.
于 2019-02-06T17:47:58.390 回答