Right Verdict, Right Reason? An Execution-Grounded Study of Whether LLM Vulnerability Detectors Understand Vulnerabilities

Leizhen Zhang, Sheng ChenarXiv 2026

It’s late, you’ve spent all day staring at code, and now you’re reading about Large Language Models (LLMs) doing the same. We’ve all seen the headlines: "AI outperforms humans at finding security bugs." But when an LLM flags a function as vulnerable, does it actually understand the logic, or is it just a very sophisticated parrot that remembers seeing that specific bug on GitHub?

A new paper, "Right Verdict, Right Reason?", puts 13 different LLMs through a rigorous "vulnerability ladder" to find out if they are truly reasoning or just reciting from memory.

TL;DR

Just because an LLM correctly identifies a bug doesn't mean it knows why it's a bug. By testing models against actual program execution and "post-cutoff" vulnerabilities (bugs they couldn't have seen in training), researchers found that while top-tier models are great at spotting the "smoking gun" line, they struggle to distinguish a bug from its fix and rely heavily on memorizing known CVEs.

What Problem Does This Paper Address?

We are increasingly trusting LLMs to audit our code. These models don't just give a "Yes/No" verdict; they provide natural-language explanations. However, existing benchmarks are often "leaked"—the models likely saw the vulnerabilities and their fixes during training.

If a model has memorized a specific bug from a famous project, its high score is a measure of its memory, not its reasoning. The authors wanted to move beyond static code snippets and ground the evaluation in program execution. If the model truly understands the vulnerability, it should be able to predict how the code behaves when it runs.

Methods

The researchers built a "ladder" of five tests (L1 to L5), each progressively harder and designed to strip away the possibility of "getting lucky" or pattern matching.

Figure 1: Overview of the study's five-level ladder of tests.
  1. L1 (Discriminate): Can the model tell a vulnerable function apart from its fixed version?
  2. L2 (Localize): Can it point to the exact "trigger line" where the fault occurs?
  3. L3 (Sensitivity): If we hide the "trigger line," does the model change its mind?
  4. L4 (Counterfactual): If we rename variables or add "decoy" fixes (checks that look right but don't actually protect the code), is the model fooled?
  5. L5 (Execution): Given a specific input, can the model predict if the program will crash?

To make this "execution-grounded," they replayed 515 real-world exploits (Proof of Concepts) to identify the trigger line (where it crashes) and the dynamic slice (all the lines of code that actually influenced that crash).

Datasets

  • BigVul & PrimeVul: 515 C/C++ functions with confirmed vulnerabilities.
  • Post-Cutoff Set: 195 brand-new vulnerabilities published between September and November 2026 (after the training cutoffs for models like GPT-4o and Claude 3.5).
  • Counterfactual Benchmark: 315 execution-confirmed variants where researchers manually edited code to test model robustness.

Key Insights and Ideas

  • The "Bug vs. Fix" Paradox: Surprisingly, many models (especially open-weight ones) are terrible at L1. They often label both the original bug and the developer's fix as "vulnerable." They have a strong bias toward saying "Yes, this is a bug" regardless of the code's actual state.
  • Localization $\neq$ Understanding: Commercial models are actually quite good at finding the "trigger line" (L2), significantly beating simple keyword-search rules. However, L3 showed that their verdicts don't always depend on that evidence. They might find the right line but still give the right verdict for the wrong reason.
  • The Memorization Wall: When tested on vulnerabilities published after their training data was collected, the performance of the strongest models (like Claude Opus 5.5) dropped significantly. This suggests that a large part of their "intelligence" is actually just a very good memory for existing CVEs.

Key Results

  • Open-weight models (like Qwen2.5-Coder or CodeLlama) performed no better than chance at distinguishing a bug from its fix.
  • Commercial models (GPT and Claude variants) were much stronger, citing the correct trigger line in 55% to 81% of cases.
  • Memorization Impact: On the pre-cutoff set, Claude Opus 5.5 had a 67.2% success rate in distinguishing bugs from fixes. On the post-cutoff set, this plummeted to 37.1%.
Figure 5: Performance margins before and after training cutoffs. Note the significant drop in L1 (Discriminate) for the top models.
  • Execution Reasoning: When given the actual program input (L5), commercial models could predict crashes with 86% to 94% accuracy, far better than simple rules that just look for missing bounds checks.

Limitations and Future Work

The study primarily focuses on C and C++ memory-safety vulnerabilities (like buffer overflows). While these are critical, it remains to be seen if these findings hold for higher-level logic flaws in languages like Python or Java.

The authors also note that their method requires a working Proof of Concept (PoC) to ground the tests in execution. If a bug is "silent" or hard to trigger, this framework can't evaluate it. Future work could involve integrating these "execution-grounded" signals directly into the training process to help LLMs move from memorization to true program reasoning.

Summary updated

Abstract

Large language models (LLMs) are increasingly used to detect vulnerabilities, and their benchmark scores are often read as evidence that they understand the vulnerabilities they report. We test this reading against program execution. For 515 C and C++ functions from BigVul and PrimeVul whose vulnerability we reproduce with a proof of concept, we identify the line at which the fault occurs and the statements on which the faulting run depended. These facts ground a ladder of five tests, from telling a vulnerable function from its fixed version, through locating the fault and reacting to its removal, to judging execution-confirmed edits and predicting the outcome of a concrete run. Each test is paired with a baseline that needs no understanding, such as a rule that picks lines with risky calls, and we repeat the study on 195 vulnerabilities published after the training cutoffs of the models. Four findings emerge. First, telling a vulnerable function from its fixed version is hard. The open-weight models separate no more pairs than chance, although five of them show a weak sensitivity to the fix, and the commercial models still label many screened fixed versions vulnerable. Second, the commercial models locate the fault beyond a keyword rule, while removing that evidence changes the verdicts of the strongest model only on the newer vulnerabilities. Third, given the program input, the commercial models predict whether a run faults better than a rule that looks for added checks, and the prediction follows the input. Fourth, on the newer vulnerabilities this advantage disappears and the lead of the strongest model narrows, while localization persists. We release the framework, the per-function evidence, and an execution-confirmed counterfactual benchmark.
BibTeX
@misc{zhang2026right,
  author = {Leizhen Zhang and Sheng Chen},
  title = {{Right Verdict, Right Reason? An Execution-Grounded Study of Whether LLM Vulnerability Detectors Understand Vulnerabilities}},
  year = {2026},
  eprint = {2611.28584},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.28584},
}
Figure