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

基于代码语言模型的漏洞检测:我们进展如何?

Vulnerability Detection with Code Language Models: How Far Are We?

University of Maryland(马里兰大学);King Abdulaziz City for Science and Technology(阿卜杜勒阿齐兹国王科学技术城);Google DeepMind(谷歌DeepMind);Columbia University(哥伦比亚大学);University of Washington(华盛顿大学)

Yangruibo Ding, Yanjun Fu, Omniyyah Ibrahim, Chawin Sitawarin, Xinyun Chen, Basel Alomair, David Wagner, Baishakhi Ray, Yizheng Chen

AI总结:

该研究指出现有漏洞数据集与评估方法存在缺陷,推出标注准确、去重且按时间划分的PrimeVul数据集,实验表明现有基准高估了代码语言模型的漏洞检测性能,凸显了该领域的研究缺口。

摘要:

在代码语言模型(code LMs)与漏洞检测领域关注度日益提升的背景下,我们研究了代码语言模型在漏洞检测任务中的有效性。我们的分析揭示了现有漏洞数据集存在的显著缺陷,包括数据质量差、标签准确率低、重复率高,导致模型在真实漏洞检测场景下的性能不可靠。此外,配合这些数据集使用的评估方法也无法代表真实世界的漏洞检测情况。\n为应对这些挑战,我们推出了PrimeVul——一个用于训练和评估漏洞检测代码语言模型的新数据集。PrimeVul采用了一套新颖的数据标注技术,其标签准确率可与人工验证的基准相当,同时大幅扩充了数据集规模。它还实施了严格的数据去重和按时间顺序划分数据的策略以缓解数据泄露问题,并引入了更贴合实际的评估指标与设置。这套综合性方案旨在更准确地评估代码语言模型在真实场景下的性能。\n在PrimeVul上评估代码语言模型后发现,现有基准显著高估了这些模型的性能。例如,一个前沿的7B模型在BigVul上的F1得分为68.26%,但在PrimeVul上仅为3.09%。通过先进训练技术以及GPT-3.5、GPT-4等更大模型来提升性能的尝试均未成功,在最严格的设置下结果与随机猜测相近。这些发现凸显了当前能力与将代码语言模型部署到安全岗位的实际需求之间存在巨大差距,表明该领域需要更多创新性研究。

英文摘要:

In the context of the rising interest in code language models (code LMs) and vulnerability detection, we study the effectiveness of code LMs for detecting vulnerabilities. Our analysis reveals significant shortcomings in existing vulnerability datasets, including poor data quality, low label accuracy, and high duplication rates, leading to unreliable model performance in realistic vulnerability detection scenarios. Additionally, the evaluation methods used with these datasets are not representative of real-world vulnerability detection. To address these challenges, we introduce PrimeVul, a new dataset for training and evaluating code LMs for vulnerability detection. PrimeVul incorporates a novel set of data labeling techniques that achieve comparable label accuracy to human-verified benchmarks while significantly expanding the dataset. It also implements a rigorous data de-duplication and chronological data splitting strategy to mitigate data leakage issues, alongside introducing more realistic evaluation metrics and settings. This comprehensive approach aims to provide a more accurate assessment of code LMs' performance in real-world conditions. Evaluating code LMs on PrimeVul reveals that existing benchmarks significantly overestimate the performance of these models. For instance, a state-of-the-art 7B model scored 68.26% F1 on BigVul but only 3.09% F1 on PrimeVul. Attempts to improve performance through advanced training techniques and larger models like GPT-3.5 and GPT-4 were unsuccessful, with results akin to random guessing in the most stringent settings. These findings underscore the considerable gap between current capabilities and the practical requirements for deploying code LMs in security roles, highlighting the need for more innovative research in this domain.

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

↑