Not all bytes are equal: Neural byte sieve for fuzzing

Mohit Rajpal, William Blum, Rishabh SingharXiv 2017

Abstract: Greybox fuzzing is a critical tool for software security, yet it remains computationally expensive due to the vast search space of possible mutations. This paper describes a "neural byte sieve" approach that uses deep learning to identify high-value mutation targets within input files. By augmenting the American Fuzzy Lop (AFL) fuzzer with a predictive model and a veto mechanism, we demonstrate significant efficiency gains. Our approach, Augmented-AFL, successfully discovered dozens of unique crashes in complex programs like readelf and libxml where standard fuzzing often stalled.

The Fuzzing Search Problem

Fuzzing works by feeding a target program millions of slightly modified "seed" files to see if any cause a crash. Greybox fuzzers like American Fuzzy Lop (AFL) are the industry standard, using lightweight instrumentation to track code execution. However, fuzzing is essentially a massive search problem. Most random mutations—such as flipping a bit in a raw pixel data block—are "uninteresting" because they do not alter the program's control flow. Currently, AFL spends significant computational power on these unpromising mutations. The challenge lies in intelligently selecting which bytes to mutate to maximize the discovery of new code paths.

Augmented-AFL Architecture

To address this, we propose Augmented-AFL, a framework that combines traditional greybox fuzzing with a neural network "sieve." The core of this system is a Veto Mechanism.

The Augmented-AFL architecture integrates an ML model to veto unpromising mutations before execution.
  1. The Heatmap Model: We trained several Recurrent Neural Network (RNN) architectures—including LSTMs and Sequence-to-Sequence (Seq2Seq) with Attention—to act as a "heatmap" generator. Given a seed file, the model predicts a probability distribution across all byte locations, highlighting which bytes are "useful" to mutate.
  2. The Veto Mechanism: During a fuzzing run, when AFL proposes a mutation, the system checks the heatmap. If the mutation targets "useless" bytes (defined by a threshold $\alpha$), the mutation is vetoed and never executed. This saves CPU time that would have been wasted on low-probability executions.
  3. Exploration vs. Exploitation: To prevent the fuzzer from getting stuck in a local optimum defined by the model, we employ a 50/50 strategy: half the time we use neural-guided mutations, and the other half we use standard random fuzzing.

Training and Datasets

To train the models, we first ran standard AFL for 24 hours to collect a dataset of (input, code coverage) pairs. We used a "strictly less than" scoring function to label mutations that successfully reached previously unvisited code. The approach was evaluated on four open-source programs representing different file formats: readelf (ELF), readpng (PNG), mupdf (PDF), and libxml (XML).

Key Results and Insights

The neural-augmented approach showed dramatic improvements over the baseline AFL benchmark in a 24-hour evaluation. The core insight is that file headers and metadata are far more critical for control flow than raw data payloads; the neural network naturally learns to identify these structural components without manual templates.

Comparison of code coverage over time across different programs. Augmented-AFL models consistently outperform the benchmark.
  • Crash Discovery: For readelf, Augmented-AFL found over 20 unique crashes, while the baseline AFL found zero. For libxml, the augmented version found roughly 110 unique crashes compared to AFL's ~80.
  • Efficiency: By vetoing unpromising mutations, the fuzzer spends more time executing inputs that actually move the needle on code exploration. Interestingly, simpler models (unidirectional LSTMs) often outperformed complex Seq2Seq models because they are faster to query.

Limitations and Future Work

The technique encountered a bottleneck with large file formats like PDF (mupdf), where the time taken to query the neural model slowed down the execution rate. Future work will focus on performance engineering for large files and moving toward online learning, where the model updates its heatmap in real-time as the fuzzer discovers new information. Additionally, we aim to move from filtering mutations to using generative models that create high-value mutations directly.

Summary updated

BibTeX
@misc{rajpal2017not,
  author = {Mohit Rajpal and William Blum and Rishabh Singh},
  title = {{Not all bytes are equal: Neural byte sieve for fuzzing}},
  year = {2017},
  eprint = {1711.04596},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1711.04596},
}
Figure