[论文解读] Stateful Greybox Fuzzing
该论文提出 SGFuzz,一种有状态的灰盒模糊测试工具,通过使用枚举类型的状态变量自动识别并追踪协议实现中的状态变量,构建动态状态转换树(STT)。通过运行时插桩记录状态转换,并引导模糊测试探索未探索的状态,SGFuzz 发现有状态错误的速度比基线灰盒模糊测试工具快一倍,实现的协议状态转换序列多出33倍,代码覆盖率提升速度也快两倍。
Many protocol implementations are reactive systems, where the protocol process is in continuous interaction with other processes and the environment. If a bug can be exposed only in a certain state, a fuzzer needs to provide a specific sequence of events as inputs that would take protocol into this state before the bug is manifested. We call these bugs as "stateful" bugs. Usually, when we are testing a protocol implementation, we do not have a detailed formal specification of the protocol to rely upon. Without knowledge of the protocol, it is inherently difficult for a fuzzer to discover such stateful bugs. A key challenge then is to cover the state space without an explicit specification of the protocol. In this work, we posit that manual annotations for state identification can be avoided for stateful protocol fuzzing. Specifically, we rely on a programmatic intuition that the state variables used in protocol implementations often appear in enum type variables whose values (the state names) come from named constants. In our analysis of the Top-50 most widely used open-source protocol implementations, we found that every implementation uses state variables that are assigned named constants (with easy to comprehend names such as INIT, READY) to represent the current state. In this work, we propose to automatically identify such state variables and track the sequence of values assigned to them during fuzzing to produce a "map" of the explored state space. Our experiments confirm that our stateful fuzzer discovers stateful bugs twice as fast as the baseline greybox fuzzer that we extended. Starting from the initial state, our fuzzer exercises one order of magnitude more state/transition sequences and covers code two times faster than the baseline fuzzer. Several zero-day bugs in prominent protocol implementations were found by our fuzzer, and 8 CVEs have been assigned.
研究动机与目标
- 解决在协议实现中发现有状态错误的挑战,因为这些错误仅在特定输入序列后才会显现。
- 克服传统基于覆盖率的灰盒模糊测试的局限性,后者缺乏对程序状态的感知,无法有效导航复杂的状态空间。
- 消除在模糊测试中依赖手动协议规范或人工标注来识别状态的需要。
- 开发一种高效、自动的方法,在模糊测试过程中探索并映射反应式协议系统的未知状态空间。
- 通过使用动态构建的状态转换树(STT)指导输入生成,优先探索未充分探索的状态转换,从而提升模糊测试效率。
提出的方法
- 对协议二进制文件进行插桩,以在运行时检测对枚举类型状态变量的赋值操作,识别状态转换。
- 构建一个全局的、内存中的状态转换树(STT),记录所有模糊测试执行过程中状态变量值的序列。
- 利用 STT 指导模糊测试,优先选择能引导至访问频率较低状态或 STT 中新分支的种子。
- 通过添加能触发 STT 中新节点的输入来扩充模糊测试的种子语料库,从而在仅依赖代码覆盖率之外,进一步提升状态空间的覆盖度。
- 将 STT 的反馈整合进模糊测试器的变异策略中,以提高探索新型状态转换的可能性。
- 重用现有的灰盒模糊测试基础设施(如 LibFuzzer),并扩展其功能以支持状态感知反馈,从而实现高效的状态空间导航。
实验结果
研究问题
- RQ1是否能够自动检测协议实现中的状态变量,并在无需协议规范或人工标注的情况下,利用其映射状态空间?
- RQ2动态构建的、基于运行时的“状态转换树”(STT)是否能有效表示并指导对未知协议实现状态空间的探索?
- RQ3与传统的基于覆盖率的模糊测试方法相比,STT 提供的状态感知反馈是否能显著提升灰盒模糊测试在发现有状态错误方面的效率?
- RQ4STT 引导的模糊测试在多大程度上增加了探索的状态转换序列的多样性与深度?
- RQ5STT 引导的模糊测试是否能比现有工具更有效地在真实世界协议实现中发现零日漏洞?
主要发现
- SGFuzz 发现有状态错误的速度约为其基线工具 LibFuzzer(SGFuzz 所基于的灰盒模糊测试器)的两倍。
- 在相同时间内,SGFuzz 实现的协议状态转换序列是 LibFuzzer 的33倍,是 IJON 的15倍,也是 AFLNet 的260倍。
- SGFuzz 达到相同分支覆盖率的速度约为 LibFuzzer 的两倍,表明其在代码覆盖率方面的效率更高。
- 该模糊测试器在广泛使用的协议实现中发现了12个新的零日漏洞,其中8个已分配CVE编号。
- STT 构建机制在所研究的50个顶级开源协议实现中均表现有效,证实了基于枚举的状态变量的普遍性。
- SGFuzz 的状态感知引导策略在探索复杂、多步骤的协议行为方面,显著优于当前最先进的工具如 AFLNet 和 IJON。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。