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

基于多任务自指令微调大语言模型的安全漏洞检测

Security Vulnerability Detection with Multitask Self-Instructed Fine-Tuning of Large Language Models

Carnegie Mellon University(卡内基梅隆大学);University of Melbourne(墨尔本大学)

Aidan Z. H. Yang, Haoye Tian, He Ye, Ruben Martins, Claire Le Goues

AI总结:

本文提出MSIVD方法,通过多任务自指令微调将大语言模型与控制流图神经网络结合进行漏洞检测,在BigVul和PreciseBugs数据集上取得优于LineVul的性能。

摘要:

软件安全漏洞使攻击者能够执行恶意活动,从而破坏软件运行。近年来,基于Transformer的语言模型显著推进了漏洞检测,超越了基于静态分析的深度学习模型的能力。然而,仅在代码token上训练的语言模型既无法捕捉漏洞类型的解释,也无法捕捉代码的数据流结构信息,而这两者对漏洞检测都至关重要。我们提出了一种新技术,将多任务序列到序列大语言模型与编码为图神经网络的程序控制流图相结合,以实现序列到分类的漏洞检测。我们引入了MSIVD,即面向漏洞检测的多任务自指令微调方法,其灵感来源于思维链提示和大语言模型自指令。我们的实验表明,MSIVD取得了优越的性能,超过了基于大语言模型的最佳漏洞检测基线LineVul,在BigVul数据集上F1分数为0.92,在PreciseBugs数据集上为0.48。通过同时使用代码和易受攻击程序的解释性指标来训练大语言模型和图神经网络,MSIVD代表了推进基于大语言模型的漏洞检测并泛化到未见数据的一个有前景的方向。基于我们的发现,我们进一步讨论了构建新的带标签安全漏洞数据集的必要性,因为近期的大语言模型已经见过或记住了先前数据集的留出评估数据。

英文摘要:

Software security vulnerabilities allow attackers to perform malicious activities to disrupt software operations. Recent Transformer-based language models have significantly advanced vulnerability detection, surpassing the capabilities of static analysis based deep learning models. However, language models trained solely on code tokens do not capture either the explanation of vulnerability type or the data flow structure information of code, both of which are crucial for vulnerability detection. We propose a novel technique that integrates a multitask sequence-to-sequence LLM with pro-gram control flow graphs encoded as a graph neural network to achieve sequence-to-classification vulnerability detection. We introduce MSIVD, multitask self-instructed fine-tuning for vulnerability detection, inspired by chain-of-thought prompting and LLM self-instruction. Our experiments demonstrate that MSIVD achieves superior performance, outperforming the highest LLM-based vulnerability detector baseline (LineVul), with a F1 score of 0.92 on the BigVul dataset, and 0.48 on the PreciseBugs dataset. By training LLMs and GNNs simultaneously using a combination of code and explanatory metrics of a vulnerable program, MSIVD represents a promising direction for advancing LLM-based vulnerability detection that generalizes to unseen data. Based on our findings, we further discuss the necessity for new labelled security vulnerability datasets, as recent LLMs have seen or memorized prior datasets' held-out evaluation data.

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

↑