Stateful Fuzzing for Deep Logic Vulnerabilities

This direction is merged into another direction: state-dependent vulnerability discovery. Its last version stays readable and citable here.

Version 1 of 124 papers27 conceptsfrozen 2026-10-04

Traditional fuzzing is often "stateless." It treats a program like a black box where you throw in a random file or a packet and see if it crashes. This works well for simple parsers, but it fails miserably when testing complex systems like operating system kernels, network protocols, or smart contracts. These systems are stateful: their behavior at any given moment depends entirely on what happened before.

If you send a "Delete File" command to a server before sending an "Authenticate" command, the server will simply reject the request. A stateless fuzzer might spend millions of iterations trying to mutate the "Delete File" command, never realizing that the real bug is only reachable after a successful login. This is the core challenge of stateful fuzzing: navigating a complex web of temporal dependencies to reach deep, vulnerable code paths.

The Problem of Temporal Dependency

In stateful systems, the validity of an input is contingent on the system's internal state. Rui Ma and colleagues in Test data generation for stateful network protocol fuzzing using a rule-based state machine point out that out-of-order messages are typically rejected by initial state checks. This creates a "shallow" testing wall.

To break through, researchers like Peter Schrammel propose generating test case chains—continuous sequences of inputs that evolve the system state over time. As explored in Generating test case chains for reactive systems, this approach avoids the overhead of resetting the system between tests and allows the fuzzer to "build" the necessary environment (like opening a socket or allocating memory) required to trigger a bug.

Inferring the Hidden State Machine

The hardest part of stateful fuzzing is knowing which state the system is currently in. Most modern software doesn't come with a handy map of its state machine.

Ruijie Meng and the team behind AFLNet Five Years Later: On Coverage-Guided Protocol Fuzzing pioneered a way to infer this machine automatically. By observing server response codes (like HTTP 200 vs. 403), the fuzzer can build a model of the protocol's states. This allows the fuzzer to prioritize "state coverage" alongside traditional code coverage, ensuring it explores not just new lines of code, but new sequences of interactions.

In more opaque environments like Trusted Execution Environments (TEEs), Qinying Wang developed SyzTrust, which uses "state variable inference" to identify the internal variables that control program flow, allowing the fuzzer to satisfy complex prerequisites that stateless tools would miss.

From Random Mutations to Contextual Sequences

If stateful fuzzing is about sequences, how do we generate meaningful ones? Traditional mutation (flipping bits) is too slow to find the precise sequence of system calls needed to crash a kernel.

Recent breakthroughs have turned to machine learning to provide "context awareness." Jiacheng Xu introduced MOCK, which uses a neural language model to learn the dependencies between system calls. Instead of guessing, MOCK understands that a write() call is only useful after an open() call. Similarly, Myeongsoo Kim demonstrated in LlamaRestTest that small language models can be fine-tuned to generate valid, multi-step sequences for REST API testing, outperforming even massive models like GPT-3.5 by staying grounded in the API's specific state requirements.

Scaling to Hardware and Beyond

The stateful challenge isn't limited to software. Modern processors use speculative execution, a highly stateful process where the CPU "guesses" future instructions. Evan Lai and the creators of SpecRL framed the search for hardware vulnerabilities like Spectre as a reinforcement learning problem. By treating the fuzzer as an agent making a sequence of decisions, they can train it to manipulate internal hardware components—like branch predictors—into vulnerable states that "one-shot" fuzzers could never reach.

As summarized by Mingming Zhang in their comprehensive taxonomy of kernel fuzzing, the field is moving away from simple input generation toward environment orchestration. Whether it's a kernel, a smart contract, or a network protocol, the goal is the same: understanding the history of the system to unlock the bugs of its future.

Papers in this version

History & citationVersion 1 · 2026-10-04

Merged into another direction · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_stateful_fuzzing_for_deep_logic_vulnerab_cb93b4f4,
  title = {Stateful Fuzzing for Deep Logic Vulnerabilities},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/stateful-fuzzing-for-deep-logic-vulnerabilities/rdr_cb93b4f45f1c4820b28302187e5cf08a},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-12-05},
}

This exact version (version 1, frozen text):

@misc{lacuna_stateful_fuzzing_for_deep_logic_vulnerab_cb93b4f4_v1,
  title = {Stateful Fuzzing for Deep Logic Vulnerabilities},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/stateful-fuzzing-for-deep-logic-vulnerabilities/rdr_cb93b4f45f1c4820b28302187e5cf08a/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-12-05},
}