Coverage-guided fuzzing has proven effective for software testing, but targeting library code requires specialized fuzz harnesses that translate fuzzer-generated inputs into valid API invocations. Manual harness creation is time-consuming and requires deep understanding of API semantics, initialization sequences, and exception handling contracts. We present a multi-agent architecture that automates fuzz harness generation for Java libraries through specialized LLM-powered agents. Five ReAct agents decompose the workflow into research, synthesis, compilation repair, coverage analysis, and refinement. Rather than preprocessing entire codebases, agents query documentation, source code, and callgraph information on demand through the Model Context Protocol, maintaining focused context while exploring complex dependencies. To enable effective refinement, we introduce method-targeted coverage that tracks coverage only during target method execution to isolate target behavior, and agent-guided termination that examines uncovered source code to distinguish productive refinement opportunities from diminishing returns. We evaluated our approach on seven target methods from six widely-deployed Java libraries totaling 115,000+ Maven dependents. Our generated harnesses achieve a median 26\% improvement over OSS-Fuzz baselines and outperform Jazzer AutoFuzz by 5\% in package-scope coverage. Generation costs average \$3.20 and 10 minutes per harness, making the approach practical for continuous fuzzing workflows. During a 12-hour fuzzing campaign, our generated harnesses discovered 3 bugs in projects that are already integrated into OSS-Fuzz, demonstrating the effectiveness of the generated harnesses.
翻译:覆盖率引导的模糊测试已被证明对软件测试有效,但针对库代码测试需要专门的模糊测试工具,以将模糊测试生成的输入转换为有效的API调用。手动创建测试工具耗时且需要深入理解API语义、初始化序列和异常处理约定。本文提出一种多智能体架构,通过专门的基于大语言模型的智能体自动生成Java库的模糊测试工具。五个ReAct智能体将工作流分解为研究、综合、编译修复、覆盖率分析和优化阶段。智能体通过模型上下文协议按需查询文档、源代码和调用图信息,而非预处理整个代码库,在探索复杂依赖关系的同时保持聚焦的上下文。为实现有效优化,我们引入了方法定向覆盖率机制——仅在目标方法执行期间跟踪覆盖率以隔离目标行为,以及智能体引导的终止机制——通过检查未覆盖的源代码来区分有效的优化机会与收益递减的情况。我们在六个广泛部署的Java库中的七个目标方法上评估了该方法,这些库总计拥有超过115,000个Maven依赖项。生成的测试工具相比OSS-Fuzz基线实现了26%的中位数覆盖率提升,在包范围覆盖率上优于Jazzer AutoFuzz 5%。每个测试工具的平均生成成本为3.20美元和10分钟,使得该方法适用于持续模糊测试工作流。在12小时的模糊测试活动中,生成的测试工具在已集成至OSS-Fuzz的项目中发现了3个错误,证明了所生成测试工具的有效性。