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

基于ChatGPT的提示增强软件漏洞检测

Prompt-Enhanced Software Vulnerability Detection Using ChatGPT

Chenyuan Zhang, Hao Liu, Jiutian Zeng, Kejing Yang, Yuhong Li, Hui Li

AI总结:

针对现有ChatGPT漏洞检测研究提示词设计简单的问题,本文通过改进基础提示、引入辅助信息、利用多轮对话记忆优化提示词,在两个数据集上验证了提示增强方法的有效性,并分析了其优缺点。

摘要:

随着会造成重大经济与社会损失的软件漏洞数量不断增加,自动化漏洞检测已成为软件开发与维护中的关键环节。近年来,GPT等大语言模型(LLMs)凭借其惊人的智能表现受到广泛关注,已有部分研究尝试将ChatGPT用于漏洞检测,但这些研究并未充分考虑LLMs的特性,其向ChatGPT提出的问题较为简单,未针对漏洞检测任务设计专门的提示词。本文针对不同提示词设计下ChatGPT的软件漏洞检测性能展开研究。首先,我们对基础提示词进行了多项改进,补充了已有研究的不足;此外,我们引入结构与序列辅助信息优化提示词设计;同时,我们利用ChatGPT的多轮对话记忆能力,设计适配漏洞检测任务的提示词。我们在两个漏洞数据集上开展了大量实验,验证了基于ChatGPT的提示增强漏洞检测方法的有效性,还分析了使用ChatGPT进行漏洞检测的优缺点。代码仓库:https://github.com/KDEGroup/LLMVulnerabilityDetection。

英文摘要:

With the increase in software vulnerabilities that cause significant economic and social losses, automatic vulnerability detection has become essential in software development and maintenance. Recently, large language models (LLMs) like GPT have received considerable attention due to their stunning intelligence, and some studies consider using ChatGPT for vulnerability detection. However, they do not fully consider the characteristics of LLMs, since their designed questions to ChatGPT are simple without a specific prompt design tailored for vulnerability detection. This paper launches a study on the performance of software vulnerability detection using ChatGPT with different prompt designs. Firstly, we complement previous work by applying various improvements to the basic prompt. Moreover, we incorporate structural and sequential auxiliary information to improve the prompt design. Besides, we leverage ChatGPT's ability of memorizing multi-round dialogue to design suitable prompts for vulnerability detection. We conduct extensive experiments on two vulnerability datasets to demonstrate the effectiveness of prompt-enhanced vulnerability detection using ChatGPT. We also analyze the merit and demerit of using ChatGPT for vulnerability detection. Repository: https://github.com/KDEGroup/LLMVulnerabilityDetection.

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

↑