Adaptive Grey-Box Fuzz-Testing with Thompson Sampling

Siddharth Karamcheti, Gideon Mann, David S. Rosenberg

Introduction

Grey-box fuzzers, such as American Fuzzy Lop (AFL), are the workhorses of modern vulnerability discovery. These tools maintain a queue of interesting inputs and apply mutation operators—such as bit flips, arithmetic additions, or cloning—to generate new test cases. Traditionally, AFL selects these operators uniformly at random. However, this approach is inherently inefficient; different programs have different structural requirements. A binary parser might respond best to bit-level arithmetic, while a text-based protocol like HTTP requires string-level operations. By ignoring these program-specific needs, standard fuzzers waste significant computational resources on unproductive mutations.

Methodology: Thompson Sampling for Mutation Selection

This research reframes mutation selection as a Multi-Armed Bandit (MAB) problem. Each of the 16 mutation operators available in AFL is treated as a "bandit arm." The goal is to maximize the "reward," defined as the discovery of a new code path.

To achieve this, the authors implement Thompson Sampling using a Beta-Bernoulli model. The fuzzer begins with a uniform prior, treating all mutators as equally likely. As the fuzzing process continues, the system tracks the success rate of each mutator. Every 10 minutes, the posterior probability distribution is updated. This mechanism elegantly balances exploration (testing underutilized mutators) with exploitation (prioritizing mutators that have successfully expanded coverage for the specific target program).

The Credit Assignment Problem

A significant challenge in applying MAB to fuzzing is "credit assignment." Standard AFL applies a random stack of up to 128 mutations to a single input. If a new path is found, it is impossible to determine which specific mutation in the stack was responsible. To resolve this, the authors constrained the fuzzer to apply a small, fixed number of mutations ($n$) per input.

Performance comparison across different mutation counts (n).

Empirical testing demonstrated that $n=4$ provided the optimal balance between allowing the algorithm to learn mutator effectiveness and maintaining the fuzzer's ability to reach complex states. As shown in Figure 2, the $n=4$ configuration consistently outperformed other variants in terms of coverage and "wins" against the baseline.

Key Results

The Thompson Sampling approach was evaluated against the DARPA Cyber Grand Challenge (CGC) binaries, a suite of 150 complex C programs containing natural bugs.

Comparison of Thompson Sampling against baseline fuzzers on CGC binaries.

As detailed in Figure 3, the results indicate a substantial improvement over existing methods. In 24-hour runs on 75 test binaries, the Thompson Sampling fuzzer discovered 1,336 unique crashes—nearly double the 780 crashes found by the strongest baseline, FidgetyAFL. Furthermore, the adaptive approach achieved the highest relative code coverage, winning on 52 out of 75 binaries compared to FidgetyAFL and significantly outperforming the "Empirical" static distribution.

Discussion and Limitations

While Thompson Sampling significantly improves performance on natural bugs, results on synthetic benchmarks like LAVA-M were more varied. The authors noted that LAVA-M bugs often require exact 4-byte "magic value" matches, a task where symbolic execution often outperforms random mutation, even when optimized.

Additionally, the current implementation uses a global distribution for the entire program. Future work could explore input-conditional distributions, learning which mutators work best for specific types of inputs within the queue. Despite these areas for growth, the transition from uniform random selection to adaptive Thompson Sampling represents a major leap in fuzzing efficiency.

Summary updated

BibTeX
@inproceedings{karamcheti2018adaptive,
  author = {Siddharth Karamcheti and Gideon Mann and David S. Rosenberg},
  title = {{Adaptive Grey-Box Fuzz-Testing with Thompson Sampling}},
  booktitle = {AISec@CCS},
  year = {2018},
  url = {https://openreview.net/forum?id=GQcBAJvBnoT},
}
Figure