[论文解读] DiverseVul: A New Vulnerable Source Code Dataset for Deep Learning Based Vulnerability Detection
DiverseVul 引入一个大规模且多样化的 C/C++ 漏洞源代码数据集,包含 18,945 个漏洞函数,覆盖 150 个 CWE,且在四个家族下分析 11 种 DL 架构,强调数据规模和代码特定的预训练是漏洞检测性能的关键因素。
We propose and release a new vulnerable source code dataset. We curate the dataset by crawling security issue websites, extracting vulnerability-fixing commits and source codes from the corresponding projects. Our new dataset contains 18,945 vulnerable functions spanning 150 CWEs and 330,492 non-vulnerable functions extracted from 7,514 commits. Our dataset covers 295 more projects than all previous datasets combined. Combining our new dataset with previous datasets, we present an analysis of the challenges and promising research directions of using deep learning for detecting software vulnerabilities. We study 11 model architectures belonging to 4 families. Our results show that deep learning is still not ready for vulnerability detection, due to high false positive rate, low F1 score, and difficulty of detecting hard CWEs. In particular, we demonstrate an important generalization challenge for the deployment of deep learning-based models. We show that increasing the volume of training data may not further improve the performance of deep learning models for vulnerability detection, but might be useful to improve the generalization ability to unseen projects. We also identify hopeful future research directions. We demonstrate that large language models (LLMs) are a promising research direction for ML-based vulnerability detection, outperforming Graph Neural Networks (GNNs) with code-structure features in our experiments. Moreover, developing source code specific pre-training objectives is a promising research direction to improve the vulnerability detection performance.
研究动机与目标
- 从真实世界项目和安全问题中创建一个大型、多样化的漏洞与非漏洞 C/C++ 函数开放数据集。
- 在该数据集及先前数据集上基准测试广泛的深度学习架构在漏洞检测任务上的性能。
- 研究训练数据量、模型架构和预训练任务如何影响漏洞检测性能。
- 评估标签噪声和泛化挑战,包括对未见项目的性能表现。
- 识别在使用大型语言模型和面向代码的预训练方面推进基于 ML 的漏洞检测的有前景方向。
提出的方法
- 抓取安全问题网站以获取漏洞报告和修复提交。
- 通过标记提交前的版本为漏洞、提交后的版本为非漏洞,从克隆的项目中提取漏洞和非漏洞函数。
- 在保持项目和 CWE 注释可用时,使用 MD5 对函数去重。
- 评估来自 4 个家族的 11 种模型架构,涵盖 GNN、 transformers/LLMs,在三种数据设置上进行评估(CVEFixes、Previous、Previous+DiverseVul)。
- 通过人工抽样检查标签噪声以估计标签准确性(DiverseVul 大约 60% 的标签准确性)。
- 比较有无 DiverseVul 的模型性能,以研究数据规模对 F1、TP 率和 FP 率的影响。

实验结果
研究问题
- RQ1增加训练数据(通过 DiverseVul 及其它数据集)如何影响不同模型家族的漏洞检测性能?
- RQ2在大规模、多样化的漏洞数据集上训练时,是否大型语言模型优于基于图的模型?
- RQ3哪些预训练目标最能提升代码的漏洞检测性能?
- RQ4模型对未见项目的泛化能力有多强,哪些技术可以缓解泛化差距?
- RQ5漏洞数据集中的标签噪声的程度及其对模型评估的影响有多大?
主要发现
- DiverseVul 提供 18,945 个漏洞函数和 330,492 个非漏洞函数,来自 7,514 次提交,跨越 150 个 CWE,覆盖 797 个项目。
- 仅在 CVEFixes 上,架构差异较小,但随着数据集增大,LLMs 明显优于 GNNs。
- 在组合的 Previous+DiverseVul 测试集上,最佳 F1-score 为 47.2%,真阳性率 43.3%,假阳性率 3.5%。
- 在代码特定任务上进行预训练的 LLM(如 CodeT5 Small/Base、NatGen)相较 GNNs 提供最强的性能提升。
- 对未见项目的表现显著下降(如 seen 项目上的 F1 为 49%,未见项目为 9.4%),凸显泛化挑战。
- 通过提交信号的漏洞标签准确性约为 DiverseVul 的 60%,表明各数据集中存在显著的标签噪声。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。