Introduction
Fuzz testing is a critical technique for identifying security vulnerabilities, yet its effectiveness is often limited by the manual effort required to create fuzz drivers. These drivers act as the "glue code" that translates raw fuzzer data into valid API calls. This paper presents the first large-scale empirical study on using Large Language Models (LLMs) to automate this process, evaluating five state-of-the-art models across 736,430 generated drivers.
The Fuzz Driver Challenge
Writing drivers is labor-intensive and requires deep knowledge of library internals. Traditional automated tools often fail to capture the nuanced usage or "intent" of an API. LLMs offer a promising alternative due to their ability to synthesize information from documentation and existing codebases. However, until this study, their actual effectiveness and the best strategies for prompting them remained largely unquantified.
Methodology and Prompt Design
The researchers developed a framework to test various prompting strategies and evaluation metrics. The core of their approach involved three primary design dimensions:
- Information Richness (Design I): Testing context levels ranging from simple API declarations to full documentation and real-world usage examples.
- Repetition (Design II): Querying the model multiple times to exploit its probabilistic nature.
- Iterative Refinement (Design III): A "generate-and-fix" workflow where the model receives error feedback (e.g., compilation errors) to repair the driver.
Drivers were validated through a rigorous pipeline: compilation checks, short-term fuzzing to filter immediate crashes, target bug filtering, and semantic tests to ensure the API was exercised as intended.
Key Insights
- The Power of Examples: Providing example code snippets was significantly more effective than providing text documentation. LLMs excel at mimicking patterns rather than translating abstract instructions.
- Temperature Sensitivity: A temperature of 0.5 was identified as the optimal balance between creative problem-solving and logical correctness.
- The Cost of Success: While high success rates are achievable, they are computationally expensive. Approximately 45% of solved questions required more than 10 attempts, suggesting that "brute-forcing" outputs is a viable but costly necessity.
- Semantic Blindness: A major hurdle remains "semantic correctness." A driver might compile and run but still be logically flawed (e.g., passing a filename where file contents are expected). The study found that 34% of APIs required manual checks to verify semantic utility.
Key Results and Model Performance
Using GPT-4 with an iterative strategy (ALL-ITER-K), the researchers solved 91% (78/86) of the benchmark questions derived from real-world OSS-Fuzz projects.
As illustrated in the performance comparison, GPT-4 emerged as the clear leader. Surprisingly, the open-source WizardCoder-15B outperformed some proprietary models like Google’s Text-Bison. In long-term fuzzing marathons, LLM-generated drivers achieved code coverage and crash-finding capabilities comparable to human-written industrial drivers.
Conclusion and Future Work
The findings of this study have already been integrated into OSS-Fuzz-Gen, Google's tool for scaling open-source fuzzing. While LLMs struggle with complex environmental dependencies and lack "semantic oracles" (logical assertions), they represent a transformative shift in automating security testing. Future research will likely focus on improving token efficiency and developing more autonomous agentic workflows.
Summary updated