SNPSFuzzer: A Fast Greybox Fuzzer for Stateful Network Protocols using Snapshots

Junqiang Li, Senyi Li, Gang Sun, Ting Chen, Hongfang Yu

Abstract

Greybox fuzzing has been widely used in stateless programs and has achieved great success. However, most state-of-the-art greybox fuzzers generally have the problems of slow speed and shallow state depth coverage in the process of fuzzing stateful network protocol programs which are able to remember and store details of the interactions. The existing greybox fuzzers for network protocol programs send a series of well-defined prefix sequences of input messages first and then send mutated messages to test the target state of a stateful network protocol. The process mentioned above causes a high time cost. In this paper, we propose SNPSFuzzer, a fast greybox fuzzer for stateful network protocol using snapshots. SNPSFuzzer dumps the context information when the network protocol program is under a specific state and restores it when the state needs to be fuzzed. Furthermore, we design a message chain analysis algorithm to explore more and deeper network protocol states. Our evaluation shows that, compared with the state-of-the-art network protocol greybox fuzzer AFLNET, SNPSFuzzer increases the speed of network protocol fuzzing by 112.0%-168.9% and improves path coverage by 21.4%-27.5% within 24 hours. Moreover, SNPSFuzzer exposes a previously unreported vulnerability in program Tinydtls.

Introduction

Coverage-guided greybox fuzzing (CGF) has revolutionized software security by efficiently identifying vulnerabilities in stateless applications. However, extending these techniques to stateful network protocols remains a significant challenge. Unlike stateless programs, network servers maintain internal states that depend on the history of received messages. To test a specific state, a fuzzer must navigate a complex state machine by sending a precise sequence of "prefix messages."

Interaction between a network protocol fuzzer and a protocol state machine.

Current state-of-the-art stateful fuzzers, such as AFLNET, rely on replaying these message sequences over network sockets for every fuzzing iteration. Profiling reveals that this network I/O is a massive bottleneck, often accounting for over 67% of total execution time. This overhead discourages the exploration of deep protocol states, where critical bugs often reside, as the time cost to reach them becomes prohibitive.

Methodology: SNPSFuzzer

SNPSFuzzer addresses the I/O bottleneck through two primary technical contributions: snapshot-based process restoration and advanced message chain analysis.

Snapshot-based Process Instance Generation

Instead of re-executing the entire prefix sequence for every test case, SNPSFuzzer leverages Checkpoint/Restore In Userspace (CRIU) to take a process-level snapshot of the target program once it reaches a desired state. When the fuzzer needs to test that state again, it restores the process from the snapshot in memory. This approach bypasses the slow socket communication required for state setup, significantly increasing throughput.

Message Chain Analysis (MCA)

To effectively explore deep states, SNPSFuzzer employs a Message Chain Analysis (MCA) algorithm. This algorithm maps sequences of messages to the corresponding transitions in the protocol state machine.

Mapping of a message chain to a corresponding state chain in a protocol.

MCA decomposes a message sequence into prefix, infix (target), and suffix components. By focusing mutations on the infix messages while using snapshots to reach the target state instantly, SNPSFuzzer can explore deep state transitions that are typically ignored by traditional fuzzers due to their high computational cost.

Evaluation

The performance of SNPSFuzzer was evaluated against AFLNET and AFLNWE using the ProFuzzBench benchmark, specifically targeting the Tinydtls (DTLS) and Kamailio (SIP) servers.

Performance and Coverage

Over a 24-hour period, SNPSFuzzer demonstrated substantial improvements in both speed and coverage:

  • Execution Speed: Increased by 112.0% for Tinydtls and 168.9% for Kamailio.
  • Path Coverage: Improved by an average of 24.45% (21.4% to 27.5%) compared to AFLNET.
  • Message Efficiency: In the case of Kamailio, the number of network messages saved by using snapshots was over 200% of the total messages sent by the baseline fuzzer.

Vulnerability Discovery

SNPSFuzzer identified 133.3% more unique crashes than AFLNET. Notably, it discovered a previously unknown stack-buffer-overflow vulnerability in the Tinydtls library, demonstrating its ability to find real-world security flaws in complex, stateful software.

Conclusion

SNPSFuzzer demonstrates that network I/O is the primary bottleneck in stateful protocol fuzzing. By utilizing process-level snapshots and intelligent message chain analysis, it fundamentally changes the cost-benefit analysis of deep state exploration. Future work will extend this snapshot-based approach to TCP-based protocols such as RTSP and FTP to further validate its generalizability across diverse network environments.

Summary updated

Abstract

Greybox fuzzing has been widely used in stateless programs and has achieved great success. However, most state-of-the-art greybox fuzzers generally have the problems of slow speed and shallow state depth coverage in the process of fuzzing stateful network protocol programs which are able to remember and store details of the interactions. The existing greybox fuzzers for network protocol programs send a series of well-defined prefix sequences of input messages first and then send mutated messages to test the target state of a stateful network protocol. The process mentioned above causes a high time cost. In this paper, we propose SNPSFuzzer, a fast greybox fuzzer for stateful network protocol using snapshots. SNPSFuzzer dumps the context information when the network protocol program is under a specific state and restores it when the state needs to be fuzzed. Furthermore, we design a message chain analysis algorithm to explore more and deeper network protocol states. Our evaluation shows that, compared with the state-of-the-art network protocol greybox fuzzer AFLNET, SNPSFuzzer increases the speed of network protocol fuzzing by 112.0%-168.9% and improves path coverage by 21.4%-27.5% within 24 hours. Moreover, SNPSFuzzer exposes a previously unreported vulnerability in program Tinydtls.
BibTeX
@article{li2022snpsfuzzer,
  author = {Junqiang Li and Senyi Li and Gang Sun and Ting Chen and Hongfang Yu},
  title = {{SNPSFuzzer: A Fast Greybox Fuzzer for Stateful Network Protocols using Snapshots}},
  journal = {IEEE Trans. Inf. Forensics Secur.},
  year = {2022},
  url = {https://openreview.net/forum?id=pFKGaxkrim},
}
Figure