TL;DR
Evaluating whether an AI can actually find software bugs—rather than just memorizing them—requires benchmarks that are both realistic and accurately labeled. VeriVul solves this by taking real-world vulnerability fixes, isolating the core buggy logic, expanding it into a self-contained program with an LLM, and formally proving whether it is safe or vulnerable using a bounded model checker. The result is an on-demand, contamination-resilient benchmark where even frontier models like Claude Opus 4.7 only hit ~71.8% accuracy and struggle to pinpoint the exact root cause.
What Problem Does This Paper Address?
If you want to test an LLM's ability to detect security vulnerabilities, you quickly run into a three-way bind:
- Isolated functions are ill-posed: Most benchmarks feed models a single function in isolation. But whether a function is vulnerable often depends on caller assumptions, pointer lifetimes, or aliasing established elsewhere in the program. Without the full program, even a human analyst is guessing.
- Realism vs. label accuracy: Mining real-world commits at scale (like BigVul or CVEFixes) gives you realistic code, but heuristic labels are notoriously noisy—audits find 20–71% label inaccuracy. Manual curation (like SVEN) is accurate but doesn't scale. Meanwhile, generating synthetic programs from scratch and verifying them (like FormAI) gives clean labels, but the code is too simple to resemble production software.
- Memorization: Frontier LLMs absorb public CVE databases and static benchmarks into their training data, turning static evaluations into memory tests rather than reasoning tests.
Methods
VeriVul breaks this trade-off with a four-stage distributed pipeline:
- Vulnerability-aware backward slicing: Starting from a real-world CVE-fixing commit, a Tree-sitter-based slicer extracts a seed—the minimal pre-patch code fragment whose data and control dependencies feed into the patched lines—without needing to compile the original repository.
- LLM-driven program expansion: A code LLM expands the seed into a complete, compilable program with a
mainentry point. The LLM isn't forced to preserve the bug; it just builds a realistic, self-contained program in the seed's domain. - Formal verification & sanitizer check: The program is fed to ESBMC v8.4 (a bounded model checker) to formally prove it
SAFEor find a counterexample(ℓ, π)—the exact violating statement and triggering input—making itVUL. Inconclusive runs are discarded. For C/C++, verdicts are double-checked using AddressSanitizer (ASan) and UndefinedBehaviorSanitizer (UBSan). - Paired counterpart generation: Each verified program is paired with a minimal-edit counterpart of the opposite label (either patching the bug or injecting a subtle one) and re-verified.
Because the pipeline can be re-run on freshly disclosed CVEs, it can generate contamination-resilient evaluation sets on demand.
Datasets
The authors release a public snapshot of 13,908 verified self-contained programs (10,225 VUL / 3,683 SAFE), including 102 verified vulnerable/safe pairs sharing a common seed. The snapshot is built from 6,281 real-world CVE seeds (sourced from ReposVul and ICVul) spanning 440 open-source projects, 1,430 CVEs, and 123 CWEs. C accounts for 87.4% of the dataset, C++ for 12.2%, and Python for 0.4%.
In their evaluation, the authors compare VeriVul against five existing datasets: FormAI (verified synthetic), ARVO (reproducible OSS-Fuzz crashes at program granularity), ICVul, TitanVul, and Mono (function-level real-world datasets).
Key Insights and Ideas
- Grounded synthesis beats pure synthetic: By anchoring LLM expansion in real CVE seeds, VeriVul produces code that looks structurally much closer to real-world software than prior verified synthetic benchmarks.
- High recall, low precision: Frontier LLMs tend to cry wolf on realistic, self-contained programs—flagging almost everything as vulnerable (83.1–97.1% recall) while struggling with precision (52.2–66.4%).
- Detection ≠ Localization: Even when an LLM correctly classifies a program as vulnerable, it rarely knows why. Models matched the ESBMC-verified trigger line only 7.9–14.2% of the time, exposing a wide gap between pattern recognition and causal reasoning.
- Contamination is real: A prefix-completion probe on 300 matched pairs showed that models reproduce public ReposVul functions far more faithfully than their post-cutoff VeriVul counterparts (e.g., Claude Opus 4.7 reproduced 46.0% of ReposVul as a single contiguous span vs. just 6.3% for VeriVul).
Key Results
- Distributional Realism: In code-embedding space (
jina-embeddings-v2-base-code), VeriVul is closer than FormAI to every real-world corpus on 11 out of 12 distance metrics. Against ARVO (the only other program-level real-world corpus), VeriVul wins on 14/17 structural code metrics (mean KS divergence of 0.405 vs. 0.548 for FormAI). - LLM Classification: Evaluated zero-shot on 400 balanced pairs across four frontier models (GPT-5.4, Claude Opus 4.7, DeepSeek-V4-Pro, GPT-OSS-120B), accuracy on VeriVul ranged from 53.8% to 71.9% (with Claude Opus 4.7 reaching 71.8% in the TitanVul/Mono shared-CWE comparison).
Limitations and Future Work
- ESBMC constraints: Bounded model checking requires unrolling loops within a time budget, which introduces a length bias toward programs in the low-hundreds-of-lines regime. ESBMC also leaves certain system calls (
stat,open,rand) unconstrained, models unprovided CLI arguments asNULL, and has gaps in its C++ library models (15.8% of C++SAFEprograms failed sanitizer checks vs. 0.4% for C). - Scope: The current snapshot focuses on C/C++ memory-safety and arithmetic CWEs; uninitialized reads, format strings, and data races are excluded.
- Future directions: The authors note that the framework can be extended to new CWEs and languages by plugging in alternative verifiers like CBMC, KLEE, Frama-C, or SeaHorn, and by expanding seed sources beyond ReposVul and ICVul to include datasets like CVEFixes.
Summary updated