[Paper Review] FuzzerGym: A Competitive Framework for Fuzzing and Learning
FuzzerGym introduces a reinforcement learning (RL)-driven framework that optimizes mutation operator selection in greybox fuzzing by integrating OpenAI Gym with libFuzzer, enabling asynchronous, low-latency RL inference. It achieves superior code coverage—outperforming libFuzzer’s random mutator selection—across five benchmarks, even with significantly more runs, by learning effective mutation strategies through deep neural networks trained on program state features.
Fuzzing is a commonly used technique designed to test software by automatically crafting program inputs. Currently, the most successful fuzzing algorithms emphasize simple, low-overhead strategies with the ability to efficiently monitor program state during execution. Through compile-time instrumentation, these approaches have access to numerous aspects of program state including coverage, data flow, and heterogeneous fault detection and classification. However, existing approaches utilize blind random mutation strategies when generating test inputs. We present a different approach that uses this state information to optimize mutation operators using reinforcement learning (RL). By integrating OpenAI Gym with libFuzzer we are able to simultaneously leverage advancements in reinforcement learning as well as fuzzing to achieve deeper coverage across several varied benchmarks. Our technique connects the rich, efficient program monitors provided by LLVM Santizers with a deep neural net to learn mutation selection strategies directly from the input data. The cross-language, asynchronous architecture we developed enables us to apply any OpenAI Gym compatible deep reinforcement learning algorithm to any fuzzing problem with minimal slowdown.
Motivation & Objective
- To address the inefficiency of random mutator selection in coverage-based greybox fuzzing (CGF) by applying reinforcement learning.
- To overcome the latency mismatch between fast fuzzing (μs) and slow RL inference (ms) through an asynchronous architecture.
- To enable deep reinforcement learning to learn optimal mutation strategies directly from input data and program state, without manual feature engineering.
- To create a flexible, extensible framework that unifies large-scale fuzzing with advanced RL algorithms for improved software testing.
Proposed method
- Integrates libFuzzer with OpenAI Gym to model the fuzzing loop as a reinforcement learning environment, where states are program coverage metrics, actions are mutation operations, and rewards are increases in code coverage.
- Uses compile-time instrumentation (LLVM Sanitizers) to expose rich, low-overhead program state—such as coverage, data flow, and fault detection—to the RL agent.
- Employs a deep neural network to learn a representation of input data and map it to optimal mutation operator selection, enabling automated, data-driven feature engineering.
- Applies asynchronous frame-skipping techniques from Atari RL to decouple the RL inference speed from the fuzzer’s execution speed, minimizing performance overhead.
- Uses GRPC-based asynchronous buffers to coordinate between the fuzzer and RL agent, allowing real-time decision-making despite speed disparities.
- Supports any OpenAI Gym-compatible RL algorithm, enabling plug-and-play integration with state-of-the-art deep RL methods.
Experimental results
Research questions
- RQ1Can reinforcement learning improve mutation operator selection in greybox fuzzing to achieve deeper code coverage than random selection?
- RQ2How can the performance gap between fast fuzzing (μs) and slow RL inference (ms) be effectively bridged in a real-time system?
- RQ3Can a learned RL policy generalize across diverse programs without retraining, based on input data representations alone?
- RQ4To what extent can RL-driven mutator selection outperform baseline random strategies when given fewer total execution runs?
- RQ5Can the integration of RL with existing fuzzing infrastructure (e.g., libFuzzer) be achieved with minimal performance overhead?
Key findings
- The RL-based fuzzer achieved superior average line coverage on four out of five benchmarks compared to libFuzzer’s random mutator selection.
- Even when given substantially more runs than the baseline, the RL-fuzzer achieved deeper coverage, demonstrating the effectiveness of intelligent mutator selection.
- The framework achieved this performance improvement without slowing down the fuzzer, thanks to its asynchronous architecture and frame-skipping mechanism.
- The trained RL policy generalized across different programs, including re2 and sqlite, without retraining, indicating robust feature learning from input data.
- The approach successfully integrated deep RL with production-grade fuzzing tools (libFuzzer) and enabled the use of advanced RL algorithms via the OpenAI Gym interface.
- The reward function can be extended to prioritize fault discovery over coverage by rewarding sanitizer-detected errors, though this is limited to automatically detectable faults.
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.