arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2406.09701cs.SE
收藏

面向基于大语言模型的可解释漏洞检测

Towards Explainable Vulnerability Detection with Large Language Models

Qiheng Mao, Zhenhao Li, Xing Hu, Kui Liu, Xin Xia, Jianling Sun

AI总结:

针对现有漏洞检测方法缺乏详细解释的问题,提出融合提示标注、LoRA指令微调和CoT关键代码提取的LLMVulExp框架,实现高准确率的漏洞检测与可解释分析,在SeVC数据集上F1超90%。

摘要:

软件漏洞对软件系统的安全性与完整性构成重大风险。尽管已有研究探索了使用深度学习和预训练模型进行漏洞检测,但这些方法往往无法提供详细的解释,难以帮助开发者有效理解并修复漏洞。大语言模型(LLM)凭借其先进的生成能力和复杂语境理解能力展现出变革性潜力,为应对这些挑战提供了新可能。本文提出LLMVulExp,这是一个专为让大语言模型胜任漏洞检测与解释双重任务而设计的自动化框架。为解决高质量标注数据获取困难和领域知识注入的挑战,LLMVulExp利用基于提示的技术标注漏洞解释,并通过低秩适配(LoRA)的指令微调方法对大语言模型进行微调,使其能够检测代码中的漏洞类型,同时生成包含成因、位置和修复建议的详细解释。此外,我们采用基于思维链(CoT)的关键代码提取策略,引导大语言模型聚焦于分析易出漏洞的代码,进一步提升检测准确率和解释深度。实验结果表明,LLMVulExp在SeVC数据集上的F1值超过90%,有效兼顾了高检测准确率与可操作、连贯的解释。本研究凸显了利用大语言模型开展实际漏洞检测与解释任务的可行性,为其在软件安全领域的适配与应用提供了关键洞见。

英文摘要:

Software vulnerabilities pose significant risks to the security and integrity of software systems. Although prior studies have explored vulnerability detection using deep learning and pre-trained models, these approaches often fail to provide the detailed explanations necessary for developers to understand and remediate vulnerabilities effectively. The advent of large language models (LLMs) has introduced transformative potential due to their advanced generative capabilities and ability to comprehend complex contexts, offering new possibilities for addressing these challenges. In this paper, we propose LLMVulExp, an automated framework designed to specialize LLMs for the dual tasks of vulnerability detection and explanation. To address the challenges of acquiring high-quality annotated data and injecting domain-specific knowledge, LLMVulExp leverages prompt-based techniques for annotating vulnerability explanations and finetunes LLMs using instruction tuning with Low-Rank Adaptation (LoRA), enabling LLMVulExp to detect vulnerability types in code while generating detailed explanations, including the cause, location, and repair suggestions. Additionally, we employ a Chain-of-Thought (CoT) based key code extraction strategy to focus LLMs on analyzing vulnerability-prone code, further enhancing detection accuracy and explanatory depth. Our experimental results demonstrate that LLMVulExp achieves over a 90% F1 score on the SeVC dataset, effectively combining high detection accuracy with actionable and coherent explanations. This study highlights the feasibility of utilizing LLMs for real-world vulnerability detection and explanation tasks, providing critical insights into their adaptation and application in software security.

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

↑