[Paper Review] Stateful Greybox Fuzzing
This paper proposes SGFuzz, a stateful greybox fuzzer that automatically identifies and tracks state variables in protocol implementations using enum-type state variables to construct a dynamic State Transition Tree (STT). By leveraging runtime instrumentation to record state transitions and guiding fuzzing toward unexplored states, SGFuzz discovers stateful bugs twice as fast as baseline greybox fuzzers, achieving 33x more state transition sequences and 2x faster code coverage.
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.
Motivation & Objective
- Address the challenge of discovering stateful bugs in protocol implementations where bugs only manifest after specific input sequences.
- Overcome the limitations of conventional coverage-guided greybox fuzzing, which lacks awareness of program state and cannot navigate complex state spaces.
- Eliminate reliance on manual protocol specifications or human annotations for state identification in fuzzing.
- Develop an efficient, automatic method to explore and map the unknown state space of reactive protocol systems during fuzzing.
- Improve fuzzing efficiency by guiding input generation toward under-explored state transitions using a dynamically constructed State Transition Tree (STT).
Proposed method
- Instrument protocol binaries to detect assignments to enum-type state variables at runtime, identifying state transitions.
- Construct a global, in-memory State Transition Tree (STT) that records sequences of state variable values across all fuzzing executions.
- Use the STT to guide fuzzing by prioritizing seeds that lead to rarely visited states or new branches in the STT.
- Augment the fuzzer's seed corpus with inputs that trigger new nodes in the STT, improving state space coverage beyond code coverage alone.
- Integrate STT feedback into the fuzzer's mutation strategy to increase the likelihood of exploring novel state transitions.
- Leverage existing greybox fuzzing infrastructure (e.g., LibFuzzer) and extend it with state-aware feedback to enable efficient state space navigation.
Experimental results
Research questions
- RQ1Can state variables in protocol implementations be automatically detected and used to map the state space without protocol specifications or manual annotations?
- RQ2Can a dynamic, runtime-constructed State Transition Tree (STT) effectively represent and guide exploration of the state space in unknown protocol implementations?
- RQ3Does state-aware feedback from the STT improve the efficiency of greybox fuzzing in discovering stateful bugs compared to traditional coverage-guided approaches?
- RQ4To what extent does STT-guided fuzzing increase the diversity and depth of state transition sequences explored during fuzzing?
- RQ5Can STT-guided fuzzing discover zero-day bugs in real-world protocol implementations more effectively than existing tools?
Key findings
- SGFuzz discovered stateful bugs approximately twice as fast as LibFuzzer, the baseline greybox fuzzer it was extended from.
- SGFuzz achieved 33x more state transition sequences than LibFuzzer, 15x more than IJON, and 260x more than AFLNet in the same time frame.
- SGFuzz reached the same level of branch coverage about twice as fast as LibFuzzer, demonstrating improved code coverage efficiency.
- The fuzzer uncovered 12 new zero-day vulnerabilities in widely used protocol implementations, with 8 assigned CVEs.
- The STT construction was effective across all 50 top open-source protocol implementations studied, confirming the prevalence of enum-based state variables.
- SGFuzz’s state-aware guidance significantly outperformed state-of-the-art tools like AFLNet and IJON in exploring complex, multi-step protocol behaviors.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.