Uncovering the Limits of Machine Learning for Automatic Vulnerability Detection
Niklas Risse, Marcel Böhme
摘要
Recent results of machine learning for automatic vulnerability detection (ML4VD) have been very promising. Given only the source code of a function , ML4VD techniques can decide if contains a security flaw with up to 70% accuracy. However, as evident in our own experiments, the same top-performing models are unable to distinguish between functions that contain a vulnerability and functions where the vulnerability is patched. So, how can we explain this contradiction and how can we improve the way we evaluate ML4VD techniques to get a better picture of their actual capabilities? In this paper, we identify overfitting to unrelated features and out-of-distribution generalization as two problems, which are not captured by the traditional approach of evaluating ML4VD techniques. As a remedy, we propose a novel benchmarking methodology to help researchers better evaluate the true capabilities and limits of ML4VD techniques. Specifically, we propose (i) to augment the training and validation dataset according to our cross-validation algorithm, where a semantic preserving transformation is applied during the augmentation of either the training set or the testing set, and (ii) to augment the testing set with code snippets where the vulnerabilities are patched. Using six ML4VD techniques and two datasets, we find (a) that state-of-the-art models severely overfit to unrelated features for predicting the vulnerabilities in the testing data, (b) that the performance gained by data augmentation does not generalize beyond the specific augmentations applied during training, and (c) that state-of-the-art ML4VD techniques are unable to distinguish vulnerable functions from their patches.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 14 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Chasing Shadows: Pitfalls in LLM Security Research 引用了 Top Score on the Wrong Exam: On Benchmarking in Machine Learning for Vulnerability Detection
- Chasing Shadows: Pitfalls in LLM Security Research 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Out of Distribution, Out of Luck: How Well Can LLMs Trained on Vulnerability Datasets Detect Top 25 CWE Weaknesses? 引用了 Top Score on the Wrong Exam: On Benchmarking in Machine Learning for Vulnerability Detection
- Out of Distribution, Out of Luck: How Well Can LLMs Trained on Vulnerability Datasets Detect Top 25 CWE Weaknesses? 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Natural Attack for Pre-trained Models of Code 引用了 Adversarial examples for models of code
- Natural Attack for Pre-trained Models of Code 引用了 Generating Adversarial Examples for Holding Robustness of Source Code Processing Models
- Natural Attack for Pre-trained Models of Code 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
引用它的顶会 Paper14
- Chasing Shadows: Pitfalls in LLM Security ResearchJonathan Evertz, Niklas Risse, Nicolai Neuer, Andreas Müller 等NDSS 2026 · 17 次引用
- Top Score on the Wrong Exam: On Benchmarking in Machine Learning for Vulnerability DetectionNiklas Risse, Jing Liu, Marcel BöhmeISSTA 2025 · 8 次引用
- Out of Distribution, Out of Luck: How Well Can LLMs Trained on Vulnerability Datasets Detect Top 25 CWE Weaknesses?Yikun Li, Ngoc Tan Bui, Ting Zhang, Chengran Yang 等ICSE 2026 · 2 次引用
- Accurate Identification of the Vulnerability-Introducing Commit based on Differential Analysis of Patching PatternsQixuan Guo, Yongzhong HeNDSS 2026 · 1 次引用
- Safe4U: Identifying Unsound Safe Encapsulations of Unsafe Calls in Rust using LLMsHuan Li, Bei Wang, Xing Hu, Xin XiaISSTA 2025 · 1 次引用
它引用的 Paper13
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
- The Many Faces of Robustness: A Critical Analysis of Out-of-Distribution GeneralizationDan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath 等ICCV 2021 · 2,294 次引用
- Adversarial examples for models of codeNoam Yefet, Uri Alon, Eran YahavOOPSLA 2020 · 162 次引用
- Natural Attack for Pre-trained Models of CodeZhou Yang, Jieke Shi, Junda He, David LoICSE 2022 · 150 次引用
- Generating Adversarial Examples for Holding Robustness of Source Code Processing ModelsHuangzhao Zhang, Zhuo Li, Ge Li, Lei Ma 等AAAI 2020 · 148 次引用
相关 Paper
- Rethinking the Capability of Fine-Tuned Language Models for Automated Vulnerability RepairWoorim Han, Yeongjun Kwak, Miseon Yu, Kyeongmin Kim 等ICSE 2026
- Understanding and Tackling Label Errors in Deep Learning-Based Vulnerability Detection (Experience Paper)Xu Nie, Ningke Li, Kailong Wang, Shangguang Wang 等ISSTA 2023 · 23 次引用
- Are We Learning the Right Features? A Framework for Evaluating DL-Based Software Vulnerability Detection SolutionsSatyaki Das, Syeda Tasnim Fabiha, Saad Shafiq, Nenad MedvidovicICSE 2025 · 1 次引用
- Data Quality for Software Vulnerability DatasetsRoland Croft, Muhammad Ali Babar, M. Mehdi KholoosiICSE 2023 · 138 次引用
- How Effective Are Neural Networks for Fixing Security VulnerabilitiesYi Wu, Nan Jiang, Hung Viet Pham, Thibaud Lutellier 等ISSTA 2023 · 86 次引用
