Greybox fuzzing has achieved success in revealing bugs and vulnerabilities in programs. However, randomized mutation strategies have limited the fuzzer's performance on structured data. Specialized fuzzers can handle complex structured data, but require additional efforts in grammar and suffer from low throughput. In this paper, we explore the potential of utilizing the Large Language Model to enhance greybox fuzzing for structured data. We utilize the pre-trained knowledge of LLM about data conversion and format to generate new valid inputs. We further fine-tuned it with paired mutation seeds to learn structured format and mutation strategies effectively. Our LLM-based fuzzer, LLAMAFUZZ, integrates the power of LLM to understand and mutate structured data to fuzzing. We conduct experiments on the standard bug-based benchmark Magma and a wide variety of real-world programs. LLAMAFUZZ outperforms our top competitor by 41 bugs on average. We also identified 47 unique bugs across all trials. Moreover, LLAMAFUZZ demonstrated consistent performance on both bug trigger and bug reached. Compared to AFL++, LLAMAFUZZ achieved 27.19% more branches in real-world program sets on average. We also demonstrate a case study to explain how LLMs enhance the fuzzing process in terms of code coverage.
翻译:灰盒模糊测试在揭示程序中的错误和漏洞方面已取得显著成功。然而,随机化变异策略限制了模糊测试器在处理结构化数据时的性能。专用模糊测试器能够处理复杂的结构化数据,但需要额外的语法工作且吞吐量较低。本文探索了利用大语言模型增强结构化数据灰盒模糊测试的潜力。我们利用LLM在数据转换和格式方面的预训练知识生成新的有效输入,并进一步使用成对变异种子对其微调,以有效学习结构化格式和变异策略。基于LLM的模糊测试器LLAMAFUZZ将LLM理解与变异结构化数据的能力整合到模糊测试中。我们在标准基于错误的基准测试Magma及多种真实世界程序上开展实验。LLAMAFUZZ平均比最优竞争对手多发现41个错误,并在所有试验中识别出47个独特错误。此外,LLAMAFUZZ在错误触发与错误到达方面均表现稳定。与AFL++相比,LLAMAFUZZ在真实世界程序集上平均多覆盖27.19%的分支。我们还通过案例研究解释了LLM如何从代码覆盖率角度增强模糊测试流程。