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

用于发现和修复软件漏洞的大语言模型思维链提示

Chain-of-Thought Prompting of Large Language Models for Discovering and Fixing Software Vulnerabilities

Yu Nong, Mohammed Aldeen, Long Cheng, Hongxin Hu, Feng Chen, Haipeng Cai

AI总结:

本文提出漏洞语义引导的思维链提示方法VSP,利用大语言模型完成漏洞识别、发现与修补三项任务,实验显示其在CVE数据集上F1准确率显著优于基线。

摘要:

安全漏洞在现代软件中日益普遍,并对社会产生广泛影响。针对这些漏洞,人们提出了多种防御方法,其中利用深度学习的方法避免了其他技术的主要障碍,因此近年来吸引了更多关注。然而,基于深度学习的方法面临关键挑战,包括缺乏规模足够且高质量标注的特定任务数据集,以及难以很好地泛化到未见过的真实世界场景。最近,大语言模型通过克服这些挑战,在各个领域展现出令人瞩目的潜力,尤其是通过思维链提示。在本文中,我们探索如何利用大语言模型和思维链来解决三个关键的软件漏洞分析任务:识别给定类型的漏洞、发现任意类型的漏洞以及修补检测到的漏洞。我们通过VSP——一种统一的、以漏洞语义为指导的提示方法,在这些任务的背景下实例化通用思维链方法,并针对三个大语言模型和两个数据集,对三个任务进行了广泛实验,评估VSP与五个基线的表现。结果表明,我们受思维链启发的提示方法在CVE数据集上的漏洞识别、发现和修补F1准确率分别比基线高出553.3%、36.5%和30.8%,具有显著优势。通过深入分析VSP失败案例,我们还揭示了大语言模型/思维链在具有挑战性的漏洞案例中当前的不足,同时提出并验证了相应的改进。

英文摘要:

Security vulnerabilities are increasingly prevalent in modern software and they are widely consequential to our society. Various approaches to defending against these vulnerabilities have been proposed, among which those leveraging deep learning (DL) avoid major barriers with other techniques hence attracting more attention in recent years. However, DL-based approaches face critical challenges including the lack of sizable and quality-labeled task-specific datasets and their inability to generalize well to unseen, real-world scenarios. Lately, large language models (LLMs) have demonstrated impressive potential in various domains by overcoming those challenges, especially through chain-of-thought (CoT) prompting. In this paper, we explore how to leverage LLMs and CoT to address three key software vulnerability analysis tasks: identifying a given type of vulnerabilities, discovering vulnerabilities of any type, and patching detected vulnerabilities. We instantiate the general CoT methodology in the context of these tasks through VSP , our unified, vulnerability-semantics-guided prompting approach, and conduct extensive experiments assessing VSP versus five baselines for the three tasks against three LLMs and two datasets. Results show substantial superiority of our CoT-inspired prompting (553.3%, 36.5%, and 30.8% higher F1 accuracy for vulnerability identification, discovery, and patching, respectively, on CVE datasets) over the baselines. Through in-depth case studies analyzing VSP failures, we also reveal current gaps in LLM/CoT for challenging vulnerability cases, while proposing and validating respective improvements.

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

↑