信息网络安全 ›› 2026, Vol. 26 ›› Issue (7): 1128-1148.doi: 10.3969/j.issn.1671-1122.2026.07.010

• AI安全防御 • 上一篇    下一篇

基于大语言模型的语义知晓的模糊测试驱动生成方案

杨乔炀, 范希明, 贾鹏()   

  1. 四川大学网络空间安全学院成都 610065
  • 收稿日期:2026-05-20 出版日期:2026-07-10 发布日期:2026-09-03
  • 通讯作者: 贾鹏 E-mail:pengjia@scu.edu.cn
  • 作者简介:杨乔炀(2000—),男,福建,硕士研究生,主要研究方向为模糊测试|范希明(1993—),男,新疆,博士研究生,主要研究方向为模糊测试|贾鹏(1988—),男,河南,副研究员,博士,CCF会员,主要研究方向为漏洞挖掘、软件动静态分析和社交网络分析
  • 基金资助:
    国家自然科学基金(62472296);四川省科技厅项目(2024ZHCG0197);科学挑战项目(TZ2025002)

LLM-based semantic-aware fuzz driver generation

Yang Qiaoyang, Fan Ximing, Jia Peng()   

  1. School of Cyber Science and Engineering, Sichuan University, Chengdu 610065, China
  • Received:2026-05-20 Online:2026-07-10 Published:2026-09-03
  • Contact: Jia Peng E-mail:pengjia@scu.edu.cn

摘要:

模糊测试是软件漏洞挖掘领域的关键技术和研究热点之一。编写高质量的模糊测试驱动一直是一项艰难且易出错的任务,不但耗时耗力,还要求编写者具备对被测库的深层理解。传统的模糊测试驱动自动化生成方案尝试以不同方式提取使用者代码中的API之间存在的数据流、控制流依赖关系,但无法表征部分API复杂的使用范式约束,导致低覆盖率和较多的API误用情况。随着大语言模型技术的兴起,近年来出现了许多基于大模型的模糊测试驱动生成方案,但其提示词构建往往只围绕函数和相关类型进行,缺乏与被测项目相关的语义元素,浪费了大语言模型的语义理解能力。为解决上述挑战,文章提出一种基于大语言模型的语义知晓的模糊测试驱动生成方案StageFuzz。该方案通过向大模型进行启发式提问,获取库流水线和语义阶段两种语义元素,然后基于流水线、语义阶段和API这3种元素,结合现有的模糊测试驱动执行三级不同的驱动生成和变异,以提升驱动程序质量并缩短生成时间。在8个开源库上对 StageFuzz进行评估,实验结果表明,StageFuzz只需消耗12.73%的大语言模型Token和1.79%的生成时间,且覆盖率提升了10.40%。

关键词: 模糊测试, 漏洞挖掘, 驱动生成, 大语言模型, 库模糊测试

Abstract:

Fuzz testing is regarded as one of the key technologies and major research hotspots in the field of software vulnerability discovery. Writing high-quality fuzz testing drivers has long been a difficult and error-prone task. It is not only time-consuming and labor-intensive, but also requires developers to possess a deep understanding of the target library. Traditional automated fuzz driver generation approaches attempt to extract data-flow and control-flow dependencies among API from client code in different ways, but they fail to capture the complex usage-pattern constraints of some API, resulting in low coverage and frequent API misuse. With the rise of large language models, many LLM-based fuzz driver generation approaches have recently emerged. However, their prompt construction is typically centered only on functions and related types, lacking semantic elements associated with the target project and thus underutilizing the semantic reasoning capabilities of LLM. To address these challenges, this paper proposed StageFuzz, a fuzz driver generation approach that incorporated both semantic and syntactic library elements. StageFuzz heuristically queried the LLM to obtain two types of semantic elements, namely library pipelines and semantic stages. It then performed three levels of driver generation and mutation based on pipelines, semantic stages, and API, together with existing fuzz drivers, in order to improve driver quality and reduce generation time. This paper evaluats StageFuzz on eight open-source libraries. Experimental results show that, compared with the current state-of-the-art tool, StageFuzz achieves a 10.40% coverage improvement while consuming only 12.73% of the LLM tokens and 1.79% of the generation time.

Key words: fuzz testing, vulnerability detection, driver generation, large language model, library fuzzing

中图分类号: