Skip to main content
QUICK REVIEW

[论文解读] Building Fast Fuzzers

Rahul Gopinath, Andreas Zeller|arXiv (Cornell University)|Nov 18, 2019
Software Testing and Debugging Techniques参考文献 43被引用 9
一句话总结

本文提出 F1,一种高性能语法模糊测试工具,通过应用函数式编程和虚拟机实现中的优化技术,其速度比现有基于语法的模糊测试工具(如 Dharma)快达 300 倍。通过将语法生成建模为纯函数式程序,并将其编译为自定义虚拟机,F1 实现了超过 100 MB/s 的吞吐量——甚至超过随机模糊测试工具——同时确保生成的输入在语法上完全有效。

ABSTRACT

Fuzzing is one of the key techniques for evaluating the robustness of programs against attacks. Fuzzing has to be effective in producing inputs that cover functionality and find vulnerabilities. But it also has to be efficient in producing such inputs quickly. Random fuzzers are very efficient, as they can quickly generate random inputs; but they are not very effective, as the large majority of inputs generated is syntactically invalid. Grammar-based fuzzers make use of a grammar (or another model for the input language) to produce syntactically correct inputs, and thus can quickly cover input space and associated functionality. Existing grammar-based fuzzers are surprisingly inefficient, though: Even the fastest grammar fuzzer Dharma still produces inputs about a thousand times slower than the fastest random fuzzer. So far, one can have an effective or an efficient fuzzer, but not both. In this paper, we describe how to build fast grammar fuzzers from the ground up, treating the problem of fuzzing from a programming language implementation perspective. Starting with a Python textbook approach, we adopt and adapt optimization techniques from functional programming and virtual machine implementation techniques together with other novel domain-specific optimizations in a step-by-step fashion. In our F1 prototype fuzzer, these improve production speed by a factor of 100--300 over the fastest grammar fuzzer Dharma. As F1 is even 5--8 times faster than a lexical random fuzzer, we can find bugs faster and test with much larger valid inputs than previously possible.

研究动机与目标

  • 解决基于语法的模糊测试中的关键性能瓶颈问题,尽管现有工具在有效性方面优于随机模糊测试,但其速度却比随机模糊测试慢几个数量级。
  • 通过结合函数式编程优化与虚拟机编译技术,加速基于语法的输入生成,实现快速而高效的模糊测试。
  • 弥合有效性(通过语法感知输入)与效率(通过高速生成)之间的差距,使基于语法的模糊测试在大规模和性能敏感的测试场景中更具实用性。
  • 通过从系统编程角度重新思考实现栈,证明基于语法的模糊测试可以兼具高度有效性与与纯随机模糊测试相当甚至更快的速度。

提出的方法

  • 将基于语法的输入生成建模为纯函数式程序,从而可应用函数式编程优化技术,如去函数化(defunctionalization)与超编译(supercompilation)。
  • 将语法模糊测试器编译为支持直接执行与上下文线程执行的自定义虚拟机(VM),以减少解释开销。
  • 将随机数流视为虚拟机的指令序列,从而实现对模糊测试行为与路径探索的确定性与可组合控制。
  • 应用领域特定优化,包括记忆化与早期终止,以减少语法展开过程中的冗余计算。
  • 采用两阶段编译管道:首先将语法转换为函数式中间表示;其次将其编译为优化后的虚拟机代码,以实现高速执行。
  • 对生成的虚拟机代码应用超优化技术,以进一步减少指令数量并提升运行时性能,尽管此部分工作留待未来完成。

实验结果

研究问题

  • RQ1基于语法的模糊测试能否在保持语法正确性的同时,实现与随机模糊测试相当的性能?
  • RQ2函数式编程与虚拟机实现中的优化技术,在多大程度上能提升基于语法的模糊测试生成速度?
  • RQ3如何将语法模糊测试器重构为函数式程序,并编译为虚拟机,以实现高吞吐量?
  • RQ4通过将随机数流视为领域特定虚拟机的指令,能带来多大的性能提升?
  • RQ5函数式编程抽象与虚拟机编译的结合,能否弥合基于语法模糊测试与随机模糊测试之间的性能差距?

主要发现

  • F1 相较于现有最快语法模糊测试工具 Dharma,实现了 100–300 倍的性能提升,证明了高性能语法模糊测试的可行性。
  • F1 的输入生成速度超过 100 MB/s,比词法级随机模糊测试工具快 5–8 倍,是目前已知生成语法有效输入速度最快的模糊测试工具。
  • 尽管增加了语法感知生成的复杂性,F1 的性能仍超过随机模糊测试,证明效率与有效性不再相互排斥。
  • 使用函数式编程技术(如去函数化与超编译)可通过静态分析与代码变换实现显著的性能提升。
  • 虚拟机抽象支持高效执行,并为通过超优化进一步优化打开大门,实验证明该技术高度适用于生成的虚拟机代码。
  • 整个系统以自包含的 Jupyter 笔记本形式实现,确保了完全可复现性,并为未来研究与工具开发提供了可扩展性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。