[Paper Review] Greybox fuzzing as a contextual bandits problem
This paper proposes a contextual bandit framework to replace heuristic-based energy assignment in AFL greybox fuzzing, using a learned policy via policy gradient methods to dynamically assign fuzzing iterations based on fixed-length substrings of test cases. The approach improves coverage over baseline AFL in most binaries, demonstrating the feasibility of reinforcement learning for intelligent fuzzing energy allocation.
Greybox fuzzing is one of the most useful and effective techniques for the bug detection in large scale application programs. It uses minimal amount of instrumentation. American Fuzzy Lop (AFL) is a popular coverage based evolutionary greybox fuzzing tool. AFL performs extremely well in fuzz testing large applications and finding critical vulnerabilities, but AFL involves a lot of heuristics while deciding the favored test case(s), skipping test cases during fuzzing, assigning fuzzing iterations to test case(s). In this work, we aim at replacing the heuristics the AFL uses while assigning the fuzzing iterations to a test case during the random fuzzing. We formalize this problem as a `contextual bandit problem' and we propose an algorithm to solve this problem. We have implemented our approach on top of the AFL. We modify the AFL's heuristics with our learned model through the policy gradient method. Our learning algorithm selects the multiplier of the number of fuzzing iterations to be assigned to a test case during random fuzzing, given a fixed length substring of the test case to be fuzzed. We fuzz the substring with this new energy value and continuously updates the policy based upon the interesting test cases it produces on fuzzing.
Motivation & Objective
- To address the limitations of heuristic-based energy assignment in AFL, which often leads to over- or under-fuzzing due to ignoring test case content.
- To formalize the energy assignment problem in greybox fuzzing as a contextual bandit problem for optimal decision-making.
- To develop and integrate a learnable policy using policy gradient methods that selects energy multipliers based on local test case substrings.
- To evaluate the approach on real-world binaries and compare its coverage performance against standard AFL configurations.
- To explore the potential of replacing multiple AFL heuristics with learned models for improved fuzzing efficiency.
Proposed method
- Formalize the energy assignment problem as a contextual bandit problem, where the context is a fixed-length substring of a test case.
- Use a neural network policy to predict the energy multiplier (fuzzing iterations) for a given test case substring.
- Train the policy using policy gradient methods, updating it based on feedback from new branches discovered during fuzzing.
- Integrate the learned model into AFL’s fuzzing loop, replacing its heuristic-based energy assignment mechanism.
- Use a reward signal based on new branch coverage discovered after fuzzing a test case with the assigned energy.
- Implement the system using TensorFlow and evaluate on multiple large-scale binaries, including cross-binary experiments.
Experimental results
Research questions
- RQ1Can a contextual bandit framework effectively replace AFL’s heuristic-based energy assignment in greybox fuzzing?
- RQ2Does learning from local substrings of test cases lead to better coverage than fixed heuristic energy assignment?
- RQ3How does the learned policy compare to standard AFL configurations in terms of branch coverage over time?
- RQ4Can the model generalize across different binaries, especially those from the same software suite like binutils?
- RQ5To what extent can reinforcement learning reduce reliance on handcrafted heuristics in fuzzing?
Key findings
- The proposed contextual bandit approach achieves better branch coverage than standard AFL with deterministic phase across most evaluated binaries.
- The model performs comparably or better than baseline AFL in coverage over time, particularly when trained on relevant binaries.
- Cross-binary experiments show the model generalizes reasonably well across binutils binaries, suggesting transferability across similar software.
- The system successfully integrates with AFL and leverages TensorFlow, enabling extensibility for future RL-based fuzzing enhancements.
- While the model outperforms standard AFL in coverage on many targets, performance is slightly worse than AFL without the deterministic phase, indicating room for hyperparameter tuning.
- The results suggest that replacing AFL’s heuristics with learned policies is feasible and can lead to improved fuzzing efficiency.
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.