Skip to content

From Miscontextion to Misconceptions: Rethinking LLM-Based Vulnerability Detection Through Context-Rich Evaluation

2026 · IEEE Transactions on Information Forensics and Security · Vol 21, pp. 10303-10317 · 0 citations · 62 references

Abstract

Large Language Models have become promising tools for automated vulnerability detection, supported by their success in code generation, repair, and integration into developer workflows. Yet a key question remains: Are LLMs truly effective at detecting real-world vulnerabilities? Current evaluations, typically limited to isolated functions or files, neglect the broader execution and data-flow context essential for understanding real vulnerabilities. This leads to misleading conclusions and flawed rationales, reducing the reliability of prior studies. Therefore, in this paper, we challenge three widely held community beliefs: that LLMs are 1) unreliable, 2) insensitive to code patches, and 3) performance-plateaued across model scales. We argue that these beliefs are artifacts of context-deprived evaluations. To address this, we propose $\textsf {CORRECT}$ (Context-Rich Reasoning Evaluation of Code with Trust), a new evaluation framework that systematically integrates contextual data into LLM-based vulnerability detection. We build a dataset of 2,000 vulnerable–patched program pairs across 99 CWEs and evaluate 13 LLMs from four model families on a 400-pair subset covering 10 top-level CWEs. Our framework elicits both binary predictions and natural-language rationales, further validated with LLM-as-a-judge methods. Our findings overturn existing misconceptions. When evaluated with $\textsf {CORRECT}$ , state-of-the-art LLMs achieve substantially better performance (e.g., 67% accuracy and an F1 score above 70% on key CWEs), with precision nearing 0.8. We show that most false positives stem from reasoning errors rather than misclassification, that larger models are associated with better performance, and that test-time scaling exhibits diminishing returns and can reduce recall. Finally, we uncover new flaws in current LLM-based detection systems, such as limited generalization and overthinking biases.

View source

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.