In this paper, we present a challenging code reasoning task: vulnerability detection. Large Language Models (LLMs) have shown promising results in natural-language and math reasoning, but state-of-the-art (SOTA) models reported only 54.5% Balanced Accuracy in our vulnerability detection evaluation, even those models pre-trained on large amounts of source code. Our error analysis on LLM responses shows that the models struggle to reason about the code semantics relevant to identifying vulnerabilities, especially subtle semantic differences caused by small textual changes. We explored prominent models and training settings to understand their effects on vulnerability detection performance -- including better prompts, larger models, more pre-training data, and fine-tuning -- but none led to significant improvements. This raises the question of whether simply scaling training data and model size will allow us to "solve" complex code reasoning tasks like vulnerability detection, or if a fundamental shift in modeling and training techniques is required. We also explored adding domain knowledge to prompts; although it helped certain models understand some code semantics, vulnerability detection requires multi-step reasoning, and these models still failed in steps, such as reasoning about variable relations. Our results suggest that new models, new training methods, or more execution-specific pretraining data may be needed to conquer vulnerability detection. We speculate that auto-regressive pre-training on source code may not effectively extract code semantics, especially on the current pretraining mixtures, in which execution data is scarce. Success on vulnerability detection as a code reasoning task can benefit many areas of software engineering such as debugging, test input generation, and program repair. Our code and data are available at https://doi.org/10.6084/m9.figshare.27368025.
DREA: Decoupled Reasoning and Exploration Agents for Repository-Level Vulnerability Detection
Institute of Information Engineering, Chinese Academy of Sciences(中国科学院信息工程研究所);School of Cyber Security, University of Chinese Academy of Sciences(中国科学院大学网络安全学院)
LLM4Vuln: A Unified Evaluation Framework for Decoupling and Enhancing LLMs' Vulnerability Reasoning
Nanyang Technological University, Singapore(南洋理工大学);The Hong Kong University of Science(香港科学与技术大学);MetaTrust Labs(MetaTrust实验室);Singapore Management University, Singapore(新加坡管理学院);University of Oregon, Eugene, OR, USA(俄勒冈大学)
Vul-R2: A Reasoning LLM for Automated Vulnerability Repair
Tencent Inc.(腾讯公司);Department of Computer Science, City University of Hong Kong(香港城市大学计算机科学系);Department of Computer Science and Engineering, The Chinese University of Hong Kong(香港中文大学计算机科学与工程系)
VulReaD: Knowledge-Graph-guided Software Vulnerability Reasoning and Detection
The University of Manchester(曼彻斯特大学);Agency for Science, Technology and Research(科技研究局);Singapore University of Technology and Design(新加坡科技设计大学);Mohamed Bin Zayed University of Artificial Intelligence(穆罕默德·本·扎耶德人工智能大学)
Graph Neural Networks for Vulnerability Detection: A Counterfactual Explanation
School of Computer Science and Technology, Huazhong University of Science and Technology(华中科技大学计算机科学与技术学院);School of Electrical Engineering, Computing and Mathematical Sciences, Curtin University(科廷大学电气、计算与数学科学学院);School of Big Data and Software Engineering, Chongqing University(重庆大学大数据与软件学院);School of Computer Science and Engineering, University of New South Wales(新南威尔士大学计算机科学与工程学院)
Detecting Vulnerability-Inducing Commits via Multi-Stage Reasoning with LLM-Based Agents
State Key Laboratory of Complex & Critical Software Environment (CCSE), Beihang University(复杂与关键软件环境国家重点实验室,北京航空航天大学);Hangzhou Innovation Institute of Beihang University(北京航空航天大学杭州创新研究院);North China Municipal Engineering Design & Research Institute Co., Ltd.(华北市政工程设计研究有限公司)
LLM-based Vulnerability Detection at Project Scale: An Empirical Study
School of Computer Software, College of Intelligence and Computing, Tianjin University(天津大学计算机科学与技术学院);International Joint Institute of Tianjin University(天津大学国际联合学院);Key Laboratory of High Confidence Software Technologies (Peking University), Ministry of Education, School of Computer Science, Peking University(北京大学计算机科学学院,教育部高可信软件技术重点实验室)
Knowledge Over Parameters: Evolving Smart Contract Vulnerability Detection
Nanyang Technological University(南洋理工大学);Nankai University(南开大学);University of California, Los Angeles(加州大学洛杉矶分校);Imperial College London(伦敦帝国学院);Singapore Management University(新加坡管理大学)
Do Fine-Tuned LLMs Understand Vulnerabilities? An Investigation into the Semantic Trap
College of Computer Science and Technology, Zhejiang University(浙江大学计算机科学与技术学院);Nanyang Technological University(南洋理工大学);College of Cryptology and Cyber Science, Nankai University(南开大学密码学与网络科学学院)