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

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

TL;DR

Fuzzing stateful network protocols is notoriously slow because fuzzers must repeatedly send sequences of "prefix messages" over network sockets just to reach deep program states. SNPSFuzzer solves this bottleneck by taking process-level snapshots of the target program at specific states, allowing the fuzzer to instantly restore the state instead of replaying messages. Combined with a novel message chain analysis algorithm, it dramatically speeds up fuzzing (up to 168%) and uncovers deeper vulnerabilities, including a zero-day in the Tinydtls library.

What Problem Does This Paper Address?

Coverage-guided greybox fuzzing (CGF), popularized by tools like AFL, has been incredibly successful at finding bugs in stateless programs (like command-line utilities or library APIs). However, it struggles with stateful network protocols. To fuzz a specific, deep state in a network server (e.g., the state after a successful handshake), the fuzzer must send a specific sequence of valid setup messages.

Existing Stateful Coverage-based Greybox Fuzzers (SCGFs) like AFLNET handle this by literally sending these "prefix messages" over a socket for every single fuzzing iteration. The authors' profiling reveals that this socket communication is a massive bottleneck, consuming over 67% of the total fuzzing time. Because of this high overhead, existing fuzzers tend to favor shorter paths to states, effectively ignoring the deep, complex state transitions where critical vulnerabilities often hide.

Methods

To eliminate the network I/O bottleneck and encourage deep state exploration, the authors introduce SNPSFuzzer, which relies on two main innovations:

  1. Snapshot-based Process Instance Generation: Instead of resending prefix messages, SNPSFuzzer uses CRIU (Checkpoint/Restore In Userspace) to take a process-level snapshot of the Protocol Under Test (PUT) once it reaches a target state. When the fuzzer wants to mutate inputs for that specific state again, it simply restores the snapshot in memory. This bypasses the slow socket communication entirely.
  2. Message Chain Analysis (MCA) & Snapshot Point Analysis (SPA): Traditional fuzzers mutate an entire sequence of messages blindly. SNPSFuzzer's MCA algorithm splits the message chain into prefix (setup), infix (the target state messages), and suffix. It then focuses its mutation energy solely on the infix messages. Furthermore, if a target state appears multiple times in a sequence, MCA intentionally selects the last occurrence to fuzz. Normally, this would incur a massive time penalty due to the long prefix chain, but because SNPSFuzzer uses snapshots, this deep exploration becomes virtually "free."

Datasets

The authors evaluated SNPSFuzzer using two real-world, open-source network protocol programs selected from ProFuzzBench (a standard benchmark for stateful network fuzzing):

  • Tinydtls: A DTLS (Datagram Transport Layer Security) server implementation designed for IoT devices.
  • Kamailio: A widely used SIP (Session Initiation Protocol) signaling server for large deployments.

They compared SNPSFuzzer against AFLNET (the state-of-the-art stateful greybox fuzzer) and AFLNWE (a stateless network fuzzer).

Key Insights and Ideas

  • Network I/O is the real enemy of stateful fuzzing: The realization that simply sending valid setup messages over sockets takes up the vast majority of execution time highlights a critical flaw in current SCGF designs. Bypassing this I/O bottleneck yields massive performance gains.
  • Snapshots change the cost function of exploration: Historically, fuzzers avoided deep protocol states because the setup cost (sending lots of prefix messages) was too high, reducing overall throughput. By reducing the setup cost to a fast memory restore, SNPSFuzzer can afford to aggressively target deep, complex state chains.
  • Process-level granularity is the sweet spot: Full Virtual Machine snapshots are too slow and heavy for tight fuzzing loops, while manual memory-state saving requires too much program-specific engineering. Process-level snapshots (via CRIU) offer the perfect balance of speed and universality for Linux network daemons.

Key Results

  • Massive Speedups: SNPSFuzzer increased the execution speed of fuzzing by 112.0% (Tinydtls) to 168.9% (Kamailio) compared to AFLNET over a 24-hour period.
  • Message Savings: By relying on snapshots, SNPSFuzzer saved an enormous number of redundant network messages. In Kamailio, the number of saved messages was actually 215.4% of the total messages sent by the baseline AFLNET.
  • Improved Coverage: Path coverage improved by 21.4% to 27.5% (average 24.45%) compared to AFLNET.
  • Vulnerability Discovery: SNPSFuzzer found 133.3% more unique crashes than AFLNET. Crucially, it uncovered a previously unreported stack-buffer-overflow vulnerability in Tinydtls (which was subsequently submitted to the developers).

Limitations and Future Work

  • Limitations: The evaluation is currently limited to two UDP-based protocols (DTLS and SIP). Additionally, the reliance on CRIU means the target program must be compatible with CRIU's process dumping capabilities (which generally requires specific Linux kernel versions and might struggle with highly exotic shared-resource architectures, though it handles standard sockets and IPC well).
  • Future Work: The authors plan to expand SNPSFuzzer to support TCP-based network protocols, specifically mentioning plans to target the Real Time Streaming Protocol (RTSP) and File Transfer Protocol (FTP).

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 have slow speed and shallow state depth coverage in fuzzing stateful network protocol programs, which are able to remember and store the details of interactions. The existing greybox fuzzers for network protocol programs first send a series of well-defined prefix sequences of input messages and then send mutated messages to test the target state of a stateful network protocol. This process leads to a high time cost. In this paper, we propose SNPSFuzzer, a fast greybox fuzzer for stateful network protocols using snapshots. SNPSFuzzer dumps the context information when the network protocol program is in 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 improves the message processing speed of network protocol fuzzing by 70.7% and increases the path coverage by 20.9% on average within 24 hours. Moreover, SNPSFuzzer exposes a previously unreported vulnerability in the 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},
}

Loading related content...

Figure