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.
Figures & tables
Figure 1: Overview of the study. Every function comes with a replayed proof of concept, from which we take the execution-grounded reference (Section 2 ) and the labels of edited variants. Each of the five tests answers one research question and is read against its own shortcut or control (Section 3 ). Thirteen models are tested on 515 functions, and the tests are repeated on 195 CVEs published after the training cutoffs (Section 3.3 ).
RQ and level
Test
Compared with (shortcut or control)
RQ1 L1 Discriminate
Verdict on fv and on ff , each shown alone
shortcut: a classifier on surface features such as length; control: a detector that ignores its input, with chance v(1−v)
RQ2 L2 Localize
Cited or top-ranked lines against the trigger line and the slices
shortcuts: a rule that cites lines with risky calls, and random lines
RQ3 L3 Evidence sensitivity
Verdict after the evidence is blanked or marked in the prompt
control: as many random lines blanked or marked
RQ4 L4 Counterfactual
Verdict on execution-confirmed edits of the function
controls: renaming and neutral edits, which keep the label; shortcut: accepting every added check, which decoys defeat
RQ5 L5 Execution
Outcome and faulting line of one run, given driver and input
shortcuts: rules that look for bounds checks; controls: the same driver with a benign input, and the function body hidden
Table 1: The five tests. Each level answers one research question. A shortcut needs no understanding of the vulnerability, and a control applies a comparable change without targeting the evidence. The labels of L4 and L5 are confirmed by execution.
(a) seamless_process , rdesktop, CVE-2018-20182. Out-of-bounds read in the copy on line 9.
Dynamic slice
Joern
dg
Deep- Wukong
Patch
GPT-6.1-sol evidence
1
seamless_process(STREAM s)
1
2
{
3
unsigned int pkglen;
3
4
char *buf;
struct stream packet = *s;
5
Figure 2: The functions of Examples 1 and 2 with their references. ▶ marks the trigger line. The columns Joern, dg, and DeepWukong are the static slices of these tools (DeepWukong backward to the trigger line). Each of the other columns repeats the number of every line that the reference contains. Patch: the number of every line that the fix modifies or deletes. The grey rows are the lines that the fix inserts, which exist only in the fixed version, and the Patch column gives their number there. The last column gives the lines that GPT-6.1-sol cites as evidence. In (b) lines 9 to 15 are elided, and Figure S3 of the supplementary material gives the full listing. All measures use the full functions.
Static slice
Retained (%)
Outside (%)
Size
Line Jaccard
Contains the whole dynamic slice (%)
Joern
79.5 [77.2, 81.7]
32.4
1.14 ×
0.545
39.8
dg
97.4 [96.3, 98.3]
39.0
1.56 ×
0.600
89.1
DeepWukong, backward to the trigger line
85.0 [82.8, 87.0]
42.9
1.50 ×
0.500
53.6
Table 2: Static slices against the dynamic slice. Retained: share of the dynamic slice that the static slice contains, mean with 95% interval. Outside: share of the static slice outside the dynamic slice, mean. Size: size of the static slice over that of the dynamic slice, median. Line Jaccard: J(S,D) of Equation ( 1 ), median. Last column: share of functions whose static slice contains the whole dynamic slice (%).
Model
Acc.
Prec.
Recall
F1
MCC
AUC
P-C
Chance
P-C − chance
Commercial models
GPT-6.1-sol
0.666
0.614
0.896
0.729
0.375
0.721
34.7
19.7
15.0 [11.0, 19.3] ↑
GPT-5.6-sol
0.613
0.589
0.753
0.661
0.236
0.624
26.0
23.1
2.9 [ − 1.2, 7.5] ≈
Claude Opus 5.5
0.828
0.769
0.940
0.846
0.674
0.899
67.2
23.8
43.4 [39.2, 47.4] ↑
Claude Opus 4.8
0.683
0.672
0.715
0.693
0.367
0.626
39.7
24.9
14.8 [10.5, 19.7] ↑
Open-weight models without a reasoning mode
Table 3: L1, pair discrimination on up to 481 matched pairs, open-weight models grouped by protocol. Chance is the independent-guessing P-C at each model’s share of vulnerable verdicts. Differences in percentage points with 95% intervals. † CVE-grouped cross-fitted baseline.
Figure 3: L1 outcome of the matched pairs that all models answered, in the four categories of PrimeVul [ 16 ] . A pair is correct (P-C) when the vulnerable version is judged vulnerable and the fixed version not vulnerable, and reversed (P-R) in the opposite case. Models are grouped as in Table 3 .
Model
Cited by the model
Keyword rule
Random
Model minus keyword rule
Commercial models
GPT-6.1-sol
67.2
27.2
13.6
40.0 [35.1, 44.8]
↑
GPT-5.6-sol
58.6
25.7
13.2
32.9 [28.3, 37.4]
↑
Claude Opus 5.5
81.3
28.4
14.2
52.9 [48.3, 57.4]
↑
Claude Opus 4.8
55.9
25.4
12.4
30.5 [25.3, 35.6]
↑
Open-weight models without a reasoning mode
Table 4: L2, how often the cited lines contain the trigger line (% of functions), for the model and for two rules that pick equally many lines per function, the keyword rule (lines with a risky identifier such as memcpy first, then random lines) and random lines. Each model on all functions it answered. Last two columns: model minus keyword rule in percentage points with 95% interval, and the arrow of Section 3.4 .
Line Jaccard with
Model
Trigger line cited
Trigger line
Dynamic slice
Joern slice
dg slice
DeepWukong slice
Union
Commercial models
GPT-6.1-sol
70.2 (16.8)
0.211 (0.046)
0.299 (0.096)
0.256 (0.098)
0.303 (0.111)
0.228 (0.109)
0.273 (0.121)
GPT-5.6-sol
66.0 (16.4)
0.213 (0.046)
0.276 (0.091)
0.242 (0.095)
0.284 (0.105)
0.218 (0.104)
0.260 (0.116)
Claude Opus 5.5
84.0 (17.3)
0.226 (0.046)
0.315 (0.097)
0.274 (0.099)
0.320 (0.114)
0.241 (0.111)
0.293 (0.124)
Claude Opus 4.8
60.9 (15.2)
0.196 (0.046)
0.278 (0.091)
0.240 (0.094)
0.283 (0.104)
0.212 (0.103)
0.249 (0.112)
Table 5: L2, stated evidence against every reference, on the 376 functions that the nine models other than Qwen3-Coder-Next, Qwen3.6-27B, gpt-oss-20b, and Foundation-Sec-8B-Reasoning explained. Trigger line cited: share of functions whose cited lines contain the trigger line (%). Line Jaccard: J(E,T) of Equation ( 1 ), with the expectation for equally many random lines in parentheses. Bold: significantly above that expectation. Union: the lines in the dynamic slice or in the static slice of Joern or dg.
(a) GPT models
GPT-6.1-sol
GPT-5.6-sol
Condition
P-C
difference
P-C
difference
Nothing blanked
34.7
–
26.0
–
Dynamic slice blanked
27.0
− 8.7 [ − 12.1, − 5.4] ↓
23.7
− 9.8 [ − 13.4, − 6.3] ↓
DeepWukong slice blanked
23.3
− 11.4 [ − 14.9, − 8.0] ↓
18.3
− 7.7 [ − 11.0, − 4.3] ↓
Trigger line blanked
30.1
− 4.6 [ − 7.5, − 1.7] ↓
28.3
2.3 [ − 1.1, 5.6] ≈
Table 6: L3, evidence removal for the four commercial models. Lines of the vulnerable version are blanked and the result is paired with the unchanged fixed version. P-C in percent, and the P-C difference in percentage points with a 95% interval, for the dynamic slice to blanking as many random lines and for the other conditions to the unchanged pair. Table S16 of the supplementary material adds the confidence ordering.
Model
No marks
Trigger line marked
Random lines marked
Trigger line minus no marks
Dynamic slice minus no marks
Union minus random
Commercial models
GPT-6.1-sol
33.5
39.9
30.8
6.4 [2.9, 10.1] ↑
3.3 [ − 0.2, 6.8] ≈
4.2 [0.8, 7.8] ↑
GPT-5.6-sol
26.2
33.7
24.9
7.5 [3.6, 11.7] ↑
4.2 [0.0, 8.0] ≈
2.9 [ − 0.8, 6.7] ≈
Claude Opus 5.5
68.2
71.7
65.7
3.5 [ − 0.2, 7.2] ≈
2.3 [ − 1.4, 5.9] ≈
0.6 [ − 3.5, 4.7] ≈
Claude Opus 4.8
37.0
41.2
35.8
4.2 [ − 0.2, 8.3] ≈
1.5 [ − 2.7, 5.5] ≈
1.5 [ − 2.6, 5.5] ≈
Open-weight models without a reasoning mode
Table 7: L3, marking lines in the prompt. P-C (%) without marks, with the trigger line marked, and with random lines marked, as many as the union of the slices has. Then P-C differences in percentage points with 95% intervals, for the trigger line and the dynamic slice against no marks and for the union of the slices against random marking of equal size. Table S4 of the supplementary material gives all eight conditions.
Version shown to the model
Correct verdict
GPT-6.1-sol
GPT-5.6-sol
Claude Opus 5.5
Claude Opus 4.8
(a) Real versions, each shown alone, all functions
Vulnerable version
vulnerable
94.5 [89.9, 98.2]
81.7 [74.3, 88.1]
97.2 [93.6, 100.0]
76.1 [67.9, 83.5]
Fixed version
not vulnerable
46.8 [37.6, 56.9]
40.4 [31.2, 50.5]
80.7 [73.4, 88.1]
67.0 [57.8, 75.3]
Both versions (P-C)
both right
42.2 [33.0, 51.4]
25.7 [17.4, 33.9]
78.9 [71.6, 86.2]
44.0 [34.9, 53.2]
(b) Renamed versions, functions renamed in both versions
Renamed vulnerable version
as on the original
95.8 [91.7, 99.0]
96.9 [92.7, 100.0]
96.9 [92.7, 100.0]
87.5 [80.2, 93.8]
Table 8: L4, verdicts on execution-confirmed variants of each function. Each row names the version shown to the model and the verdict that is correct for it, and each cell gives the percentage of functions for which the model gives that verdict, with a 95% interval. In (b) a verdict is correct when it equals the verdict on the unrenamed version. The row marked Δ gives the difference between the two rows above it on the same functions, in percentage points. Every function of this benchmark comes from a different CVE, so equal shares show identical intervals.
Measure
GPT-6.1-sol
GPT-5.6-sol
Claude Opus 5.5
Claude Opus 4.8
All versions
92.9 [89.7, 95.7]
91.2 [88.1, 94.0]
94.6 [91.7, 97.0]
86.3 [82.4, 90.0]
Function body hidden (shortcut)
51.6 [49.6, 53.6]
49.0 [47.0, 51.0]
46.5 [44.6, 48.4]
51.8 [49.9, 53.9]
Answer fault for every version (shortcut)
42.2
42.2
42.2
42.2
Vulnerable version
84.4 [77.1, 90.8]
78.9 [70.6, 86.2]
87.2 [80.7, 92.7]
67.0 [57.8, 75.2]
Fixed version
99.1 [97.2, 100.0]
98.2 [95.4, 100.0]
98.2 [95.4, 100.0]
100.0 [96.6, 100.0]
Both real versions of a function
83.5 [76.1, 89.9]
77.1 [68.8, 84.4]
85.3 [78.0, 91.7]
67.0 [57.8, 75.2]
Table 9: L5, prediction of one execution. The overall rows pool all evaluated versions with confirmed outcomes. Brackets give 95% intervals where estimated. The hidden-body control sees the function’s first line with the same driver and input. The benign-input control keeps the driver and uses an input on which fv runs clean. Both real versions requires both predictions for a pair to be correct. The joint measure requires a fault prediction and a line within two lines of the observed fault site. The rows by kind of version show where the errors fall.
Figure 5: Margins of the four commercial models over the baseline of each level, in percentage points with 95% intervals, in the pre-cutoff set and on the CVEs published after their training cutoffs. L1: P-C minus the chance level of the model. L2: share of functions whose cited lines contain the trigger line, minus that of the keyword rule. L3: P-C change from blanking the dynamic slice D , minus that from blanking as many random lines. L5: outcome accuracy minus that of the added-guard rule, paired over the same versions. The L1 margin of Claude Opus 5.5 falls from 43.4 [39.2, 47.4] to 16.0 [7.7, 24.5] points, and the L5 margins fall from 6.0 to 14.3 points before the cutoffs to − 6.0 to 2.0 after them. Table S8 of the supplementary material gives all measures.
Finding
Levels
Deciding comparison (pre-cutoff set)
After the cutoffs
F1 Telling a function from its fix is hard
L1
P-C over chance, at most 43.4 [39.2, 47.4] (Claude Opus 5.5), none for the open-weight models, five of which have more correct than reversed pairs, both versions vulnerable for 49.3% to 54.9% (GPT models)
only Claude Opus 5.5 above chance, by 16.0 [7.7, 24.5]
F2 Localization exceeds shortcuts, reliance is partial
L2, L3
trigger line cited 30.5 to 52.9 over the keyword rule, blanking D lowers P-C for three models
margin 34.2 to 46.7, Claude Opus 5.5 now sensitive to D
F3 With an input, outcomes are predicted
L4, L5
accuracy 86.3% to 94.6% against 80.3% for the added-guard rule
accuracy 70.2% to 78.2%, level with the rule
F4 Part of the strongest results depends on known CVEs
all
P-C of Claude Opus 5.5 67.2%
37.1%, a change of − 18.9 [ − 34.0, − 3.2] against CVEs from 2021 on
Table 10: The four findings, the levels behind them, the comparison that decides each, and whether it holds on the CVEs published after the training cutoffs. Numbers are percentage points or percent for the commercial models.
Seoul School of Integrated Sciences and Technologies (aSSIST University), Seoul, Republic of Korea · Liaoning Mechanical & Electrical College of Technology, Dandong, Liaoning, China