一句话:通过开源与闭源数据集的对照实验,首次实证表明基于 LLM 的漏洞检测在开源基准上的评测结果会因数据污染而被显著高估。
已有研究显示大语言模型(LLM)能有效检测源码中的安全漏洞,但这些工作几乎只在开源系统基准上评测,所用漏洞多为公开已知、很可能已进入模型训练数据,因此报告的性能可能因数据污染而虚高。本文以案例研究量化该效应:在两个精心整理的数据集——开源的 CWE-Bench-Java 与基于闭源商业代码库的 TS-Vuls——上评测五个前沿 LLM;同时按 CVE 记录日期切分开源数据,从时间污染角度考察模型知识截止的影响。结果显示,从开源数据集转到闭源数据集时,平均 F1 下降约 20 个百分点,精确率平均从 56% 降至 34%,五个模型中有四个在 p<0.05 下显著,且该下降趋势在所有模型与指标上一致;而开源数据上的时间切分结果不明确,说明依赖知识截止日期可减轻但并不足以消除污染效应。研究虽仅基于单一闭源系统、不可泛化,但为开源基准评测导致的过度乐观提供了首个实证证据,呼吁未来评测纳入闭源数据集。
Existing research has demonstrated promising results when applying large language models (LLMs) to detect security vulnerabilities in source code. However, these studies have been exclusively evaluated on benchmarks from open-source systems, using publicly known vulnerabilities that are likely part of the LLMs’ training data. This raises concerns that reported performance metrics may be inflated due to data contamination, providing a misleading view of the models’ actual capabilities.In this paper, we quantify this effect with a case study that evaluates five frontier LLMs on two carefully curated datasets: CWE-Bench-Java (an open-source dataset) and TS-Vuls (based on a closed-source commercial codebase). To provide a second angle, we also split CWE-Bench-Java by CVE record date to explore temporal contamination based on LLM knowledge cutoff dates.Our results reveal that the average F1 score dropped by approximately 20 percentage points when comparing the open-source to the closed-source dataset. Additionally, the precision drops from 56% to 34% on average, which is statistically significant (p < 0.05) for four of five models. This declining trend is consistent across all tested LLMs and metrics. In contrast, the results for the temporal split on the open-source data are inconclusive, suggesting that using a knowledge cutoff may reduce but does not ensure the elimination of contamination effects.Although our study is based on a single closed-source system and thus not generalizable, these findings provide the first empirical evidence that evaluating LLM-based vulnerability detection on open-source benchmarks may lead to overly optimistic results. This motivates the inclusion of closed-source datasets in future LLM evaluations.
DOI 原文 ·
@inproceedings{paperbot9296,
title = {Should We Evaluate LLM Based Security Analysis Approaches on Open Source Systems?},
author = {Kohei Dozono and Jonas Engesser and Benjamin Hummel and Tobias Roehm and Alexander Pretschner},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00265}
}