arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.04312cs.SE
收藏

你的修复就是我的漏洞利用:利用大语言模型实现全面的深度学习库 API 模糊测试

Your Fix Is My Exploit: Enabling Comprehensive DL Library API Fuzzing with Large Language Models

Kunpeng Zhang, Shuai Wang, Jitao Han, Xiaogang Zhu, Xian Li, Shaohua Wang, Sheng Wen

AI总结:

本文提出 LLM 驱动的 DFUZZ,通过 API 白盒信息引导边界情况推理与测试程序生成,提升 TensorFlow 和 PyTorch 的 API 覆盖率并发现 37 个 bug。

摘要:

深度学习(DL)库被广泛用于 AI 应用,却常常包含缓冲区溢出和释放后使用等漏洞。传统模糊测试难以应对 TensorFlow 和 PyTorch 等 DL 库的复杂性与 API 多样性,这些库拥有超过 1,000 个 API。由于输入复杂且使用模式多样,测试所有这些 API 颇具挑战。尽管大语言模型(LLM)在代码理解和生成方面展现出潜力,但现有基于 LLM 的模糊测试工具缺乏对 API 边界情况的深入认识,也难以生成测试输入。为此,我们提出 DFUZZ,这是一种由 LLM 驱动的 DL 库模糊测试方法。DFUZZ 利用两点洞察:(1)LLM 能够根据 API 代码推理触发错误的边界情况,并将这种知识应用于未经测试的 API;(2)LLM 能够准确合成测试程序,以自动化 API 测试。通过向 LLM 提供 API 的“白盒视图”,DFUZZ 增强了推理与生成能力,从而实现全面模糊测试。实验结果表明,在 TensorFlow 和 PyTorch 的 API 覆盖率方面,DFUZZ 优于最先进的模糊测试工具,共发现 37 个 bug,其中 8 个已修复,19 个正在接受开发者调查。

英文摘要:

Deep learning (DL) libraries, widely used in AI applications, often contain vulnerabilities like buffer overflows and use-after-free errors. Traditional fuzzing struggles with the complexity and API diversity of DL libraries such as TensorFlow and PyTorch, which feature over 1,000 APIs. Testing all these APIs is challenging due to complex inputs and varied usage patterns. While large language models (LLMs) show promise in code understanding and generation, existing LLM-based fuzzers lack deep knowledge of API edge cases and struggle with test input generation. To address this, we propose DFUZZ, an LLM-driven fuzzing approach for DL libraries. DFUZZ leverages two insights: (1) LLMs can reason about error-triggering edge cases from API code and apply this knowledge to untested APIs, and (2) LLMs can accurately synthesize test programs to automate API testing. By providing LLMs with a "white-box view" of APIs, DFUZZ enhances reasoning and generation for comprehensive fuzzing. Experimental results show that DFUZZ outperforms state-of-the-art fuzzers in API coverage for TensorFlow and PyTorch, uncovering 37 bugs, with 8 fixed and 19 under developer investigation.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑