TL;DR
Fuzz4All is the first universal fuzzer capable of targeting multiple programming languages and features without requiring language-specific engineering. By leveraging Large Language Models (LLMs) as both prompt distillers and iterative mutation engines, it achieves an average code coverage increase of 36.8% over state-of-the-art fuzzers and has uncovered 98 real-world bugs in systems like GCC, Clang, and Z3.
What Problem Does This Paper Address?
Fuzz testing (generating random or mutated inputs to crash a system) is highly effective at finding software vulnerabilities. However, fuzzing language processors—such as compilers (GCC, Clang), runtime engines, and constraint solvers (Z3)—presents a massive challenge. These systems require highly structured, syntactically valid inputs to get past initial parsing stages and stress the deep semantic logic.
Traditional fuzzers solve this in two ways, both of which have severe limitations:
- Tight Coupling (C1): They are hardcoded for a specific language grammar. Building them requires immense manual effort (e.g., the C compiler fuzzer Csmith is over 80,000 lines of code) and cannot be easily ported to other languages.
- Lack of Evolution Support (C2): As programming languages evolve (e.g., C++11 to C++23), traditional fuzzers become obsolete because they cannot generate code for newly introduced features.
- Restricted Generation (C3): To ensure validity, grammar-based fuzzers often restrict themselves to a safe subset of the language, missing complex edge cases.
Methods
Fuzz4All replaces handcrafted grammars with the implicit, multi-lingual understanding of pre-trained LLMs. To balance cost and performance, it uses a dual-model architecture consisting of two main phases:
1. Autoprompting (Distillation Phase)
Users provide arbitrary documentation, code examples, or formal specifications of the system under test (SUT). Because raw documentation is often too verbose for an LLM's context window, Fuzz4All uses a high-end Distillation LLM (GPT-4) to compress this information into a concise, fuzzing-optimized prompt. To ensure quality, Fuzz4All samples multiple candidate prompts, runs a mini-fuzzing trial, and selects the prompt that yields the highest number of valid code snippets.
2. The Fuzzing Loop (Generation & Mutation Phase)
A smaller, faster Generation LLM (StarCoder) executes the actual fuzzing. Instead of repeatedly sampling from the same static prompt—which causes LLMs to produce repetitive outputs—Fuzz4All dynamically updates the prompt in a loop.
In each iteration, it takes a valid code snippet generated in a previous round and appends it to the prompt alongside one of three natural language instructions:
generate-new: Instructs the model to create a brand-new program based on the specification.mutate-existing: Asks the model to modify the provided example.semantic-equiv: Commands the model to rewrite the example while preserving its original meaning (differential testing).
Datasets
The approach was evaluated directly on nine real-world Systems Under Test (SUTs) spanning six different input languages:
- C / C++: GCC, G++, Clang, Clang++
- SMT2 (Constraint Solving): Z3, CVC5
- Go: Go toolchain
- Java: javac (OpenJDK)
- Python: Qiskit (IBM's quantum computing framework)
Rather than using pre-existing fuzzing benchmarks, the authors used official language documentation (such as standard library docs and language specifications) as the raw input for the autoprompter.
Key Insights and Ideas
- LLMs as Universal Mutators: Because LLMs are trained on billions of lines of diverse code, they inherently understand the syntax and type constraints of dozens of languages. This allows a single tool to fuzz everything from C++ to quantum computing APIs.
- Prompt Dynamics Prevent Plateaus: Traditional fuzzers quickly hit a "coverage plateau." Fuzz4All avoids this by feeding its own generated code back into the prompt (as shown in Figure 3). This forces the LLM to continuously shift its generation distribution and explore new code paths.
- Targeted Fuzzing via Documentation: If a developer wants to test a brand-new language feature (e.g.,
std::expectedin C++23), they don't need to update the fuzzer's source code. They simply feed the feature's documentation page into Fuzz4All, and the system automatically isolates and stress-tests that specific component.
Key Results
- Superior Code Coverage: Fuzz4All outperformed all language-specific baselines (including Csmith, YARPGen, and TypeFuzz), improving line coverage by an average of 36.8% across all targets.
- Real-World Bug Discovery: The tool discovered 98 bugs across the evaluated systems. At the time of publication, 64 had already been confirmed by developers as previously unknown, and many have been fixed.
- Effective Feature Targeting: In targeted fuzzing campaigns, Fuzz4All achieved an average hit rate of 83.0% (meaning 83% of generated inputs successfully utilized the specific keyword or API being targeted), compared to nearly 0% for general fuzzers.
Limitations and Future Work
- Throughput Bottleneck: Because Fuzz4All relies on GPU inference to generate test cases, it produces fewer total inputs per hour than highly optimized, native C-based fuzzers. It trades quantity for higher-quality, semantic diversity.
- Validity Rates: While the generated code is highly diverse, the validity rate (the percentage of inputs that compile successfully) is lower than strict grammar-based fuzzers, particularly in strict languages like Go.
- LLM Hallucinations: As with all LLM pipelines, the distillation model can occasionally generate inaccurate summaries of the documentation, an area the authors hope to address in future work.
Summary updated