Abstract
Automated fuzzing is a cornerstone of modern software security, yet its effectiveness is often hampered by the manual effort required to develop high-quality fuzz drivers. We present CKGFuzzer, a novel system that synergizes Large Language Models (LLMs) with a Code Knowledge Graph (CKG) to automate fuzz driver generation. By providing LLMs with deep structural context, CKGFuzzer achieves superior code coverage and significantly reduces the manual overhead of crash analysis. Our evaluation demonstrates that CKGFuzzer discovered 11 real-world vulnerabilities in popular open-source libraries.
Introduction
Fuzz testing remains the gold standard for vulnerability discovery. However, the "fuzz driver"—the interface between the fuzzer and the target library's APIs—represents a significant bottleneck. Manually crafting these drivers requires intimate knowledge of API interdependencies. While LLMs have been proposed to automate this task, they frequently suffer from a lack of global repository context, resulting in drivers that fail to compile or misuse APIs. Furthermore, distinguishing between legitimate library bugs and driver-induced crashes (noise) remains a labor-intensive process.
Methodology
CKGFuzzer addresses these challenges through a multi-agent architecture anchored by a Code Knowledge Graph.
1. Code Knowledge Graph (CKG) Construction
Using static analysis tools like Tree-sitter and CodeQL, CKGFuzzer maps the entire codebase into a graph where nodes represent functions and files, and edges represent call or containment relationships. This graph serves as an external memory, providing the LLM with the structural context necessary to understand complex API interactions.
2. API Combination and Driver Generation
Instead of selecting APIs in isolation, a Combination Agent queries the CKG to identify APIs that naturally interact, ensuring generated drivers follow realistic execution paths. If a driver fails to compile, a Compilation Repair Agent iteratively fixes the code by analyzing error messages and querying a "Library Usage Knowledge Base."
3. Coverage-Guided Mutation and Crash Analysis
The system employs a feedback loop where an LLM mutates API combinations to target low-coverage areas identified during fuzzing. When crashes occur, a Crash Analysis Agent utilizes Chain-of-Thought reasoning and a database of Common Weakness Enumerations (CWEs) to filter out driver-related errors, allowing researchers to focus on genuine library vulnerabilities.
Experimental Evaluation
We evaluated CKGFuzzer on eight widely-used C/C++ libraries, including curl, zlib, and libpcap. These libraries provide a diverse set of API patterns and are part of the Google OSS-Fuzz project, providing a rigorous baseline for comparison.
Key Results
CKGFuzzer demonstrated significant improvements over state-of-the-art tools like PromptFuzz and the baseline OSS-Fuzz.
- Increased Coverage: CKGFuzzer achieved an average 8.73% increase in code coverage compared to existing automated tools.
- Efficiency in Triage: The automated crash analysis module reduced the manual workload for reviewing reports by 84.4%.
- Vulnerability Discovery: The system identified 11 real-world bugs, 9 of which were previously unknown, including critical buffer overflows and out-of-memory (OOM) errors.
Discussion and Insights
The success of CKGFuzzer underscores two critical insights. First, contextual awareness is king; providing LLMs with structural "chunks" of a repository via a CKG is far more effective than zero-shot generation. Second, iterative refinement is vital; the inclusion of a dedicated repair loop increased the compilation success rate from 57.39% to 93.99%.
Conclusion
CKGFuzzer represents a significant step forward in automated security testing. While currently optimized for C libraries, future work will focus on extending support to languages like Rust and Java and further refining the CKG to capture deeper semantic relationships. By reducing the "human-in-the-loop" requirement, CKGFuzzer enables more scalable and effective vulnerability research.
Summary updated