FuzzCoder: Byte-level Fuzzing Test via Large Language Model

Liqun Yang, Jian Yang, Chaoren Wei, Guanglin Niu, Ge Zhang, Yunli Wang, Linzheng Chai, Wanxu Xia, Hongcheng Guo, Shun Zhang, Jiaheng Liu, Yuwei Yin, Junran Peng, Jiaxin Ma, Liang Sun, Zhoujun LiarXiv 2024 · DOI

Introduction

Software fuzzing is a critical security testing technique that involves bombarding programs with malformed data to identify vulnerabilities. Traditional tools, such as American Fuzzy Lop (AFL), rely on heuristic or random mutations—like bit-flipping—to generate test cases. While effective, these "blind" methods often produce "garbage" inputs that are immediately rejected by a program's initial sanity checks, wasting computational resources. FuzzCoder addresses this inefficiency by training Large Language Models (LLMs) to predict "fruitful" mutation locations and strategies, effectively teaching them the "art" of breaking software.

Methodology

FuzzCoder reformulates the fuzzing process as a sequence-to-sequence (seq2seq) task. Instead of performing random mutations, the system uses a fine-tuned LLM to analyze hexadecimal byte sequences and predict optimal (position, strategy) pairs.

The FuzzCoder workflow: an iterative loop where an LLM predicts byte-level mutations to discover new execution paths.

The framework supports 12 distinct mutation strategies derived from traditional fuzzers, including bit-flipping (1, 2, or 4 bits), arithmetic operations, and boundary-case integer replacement. To enable this "byte-level literacy," the authors created the Fuzz-Instruct dataset, which consists of approximately 30,000 supervised fine-tuning (SFT) pairs. These pairs were harvested from successful historical fuzzing runs where mutations led to new code coverage or crashes. By training on this "success history," models like DeepSeek-Coder and CodeQwen learn to recognize the underlying grammar of binary files, such as targeting metadata headers in JPEGs rather than raw pixel data.

Evaluation and Results

The performance of FuzzCoder was evaluated using Fuzz-Bench, a benchmark of eight diverse programs handling formats like ELF, XML, MP3, and various image types. The study focuses on the Effective Proportion of Mutation (EPM) and Input Gain (the discovery of new execution paths).

Input Gain comparison across various benchmarks, showing FuzzCoder variants significantly outperforming traditional AFL baselines.

The experimental results demonstrate significant improvements over traditional AFL baselines:

  • Crash Detection: In the MP3GAIN benchmark, the DeepSeek-Coder variant of FuzzCoder discovered 230 crashes, compared to only 68 by the original AFL.
  • Code Coverage: FuzzCoder consistently achieved higher line and branch coverage. For example, in READ_ELF tests, average coverage improved from ~8.4% (AFL) to ~15.6% (FuzzCoder).
  • Path Discovery: As illustrated in the Input Gain chart, FuzzCoder variants often doubled or tripled the path discovery rate of heuristic-based baselines across nearly all datasets, particularly in complex formats like LINT_XML and READ_ELF.

Discussion and Limitations

Despite its success, FuzzCoder introduces new challenges, primarily regarding inference latency. Generating mutations via an LLM is computationally more expensive than simple bit-flipping. Therefore, the "intelligence" of the mutation must be high enough to justify the additional time spent. Furthermore, the model's effectiveness is currently dependent on the quality of the initial "seed" mutations provided during training. Future research will focus on "mixture-of-adapter" strategies to enhance instruction tuning and applying the framework to proprietary file formats where human-defined mutation rules are unavailable.

Summary updated

BibTeX
@misc{yang2024fuzzcoder,
  author = {Liqun Yang and Jian Yang and Chaoren Wei and Guanglin Niu and Ge Zhang and Yunli Wang and Linzheng Chai and Wanxu Xia and Hongcheng Guo and Shun Zhang and Jiaheng Liu and Yuwei Yin and Junran Peng and Jiaxin Ma and Liang Sun and Zhoujun Li},
  title = {{FuzzCoder: Byte-level Fuzzing Test via Large Language Model}},
  year = {2024},
  eprint = {2409.01944},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.01944},
}
Figure