MCP
arXivarXiv
Preprint
Published: August 3, 2026
cs.SE

VulnGym: Benchmarking Coding Agents for Repository-Level Vulnerability Detection

Abstract
Recent advances in LLM-based vulnerability detection have shown promising results, while coding agents further extend this capability from isolated code snippets to complete repositories. This shift requires agents to autonomously explore repositories and locate vulnerability-relevant code, instead of performing detection on preselected functions. However, existing benchmarks primarily focus on vulnerability classification over preselected code snippets, limiting their ability to evaluate coding agents in repository-level vulnerability detection. Moreover, without fine-grained vulnerability trace annotations, the capability limitations underlying the detection process remain difficult to explore. To address these limitations, we present \textbf{VulnGym}, a real-world repository-level benchmark for evaluating vulnerability detection by coding agents. VulnGym aligns reviewed GitHub advisories with their corresponding vulnerable version repositories. It contains 184 advisories and 408 vulnerability entries across 23 repositories, with each entry annotated with line-level entry points, critical operations, and vulnerability traces. Using this fine-grained ground truth, VulnGym defines an end-to-end detection task and three oracle-based subtasks to jointly evaluate vulnerability detection and diagnose limitations in code localization and evidence construction. Our evaluation indicates that current coding agents remain limited in both end-to-end repository-level vulnerability detection and the construction of accurate supporting traces.
0
AI overview
Reviews
Citation graph
References · 36
Structured
This preview uses generator v1; v2 is available

Overview

This paper targets repository-level vulnerability detection with coding agents. It builds VulnGym, a real-world evaluation benchmark with fine-grained code evidence annotations, containing 184 reviewed security advisories, 408 vulnerability entries, and covering 23 open-source repositories. Based on this benchmark, the paper completes capability evaluation and defect diagnosis for multiple state-of-the-art coding agents.

Evaluation Requirements for Repository-Level Coding-Agent Vulnerability Detection and Comparison with Existing Benchmarks

Existing public mainstream vulnerability benchmarks can be divided by evaluation scope into function-level and repository-level categories. PrimeVul and SecVulEval are function-level benchmarks that provide vulnerability-related annotations only at function granularity and do not support end-to-end capability validation in repository-level scenarios. VulEval, CWE-Bench-Java, and JITVul are repository-level benchmarks, but each is missing dimensions in natural-language annotation of vulnerability root causes, cross-file line-level execution trace annotation, or manually verified annotation coverage; no benchmark covers all four core annotation requirements simultaneously.

Core Properties and Dataset Composition of the VulnGym Benchmark

VulnGym is a real-world repository-level evaluation benchmark designed for vulnerability detection by coding agents. Its core design idea is to align reviewed GitHub security advisories with the corresponding vulnerable versions of code repositories, thereby specifically remedying the inherent limitations of existing related benchmarks.

The benchmark covers 23 open-source repositories and contains 184 reviewed security advisories with a total of 408 vulnerability entries. Each vulnerability entry carries fine-grained annotations at the line level for vulnerability entry points, key operations, and vulnerability execution traces, forming a complete fine-grained ground-truth annotation system.

The core new contributions of this work fall into three parts. First, it introduces this real-world repository-level vulnerability detection benchmark with fine-grained code evidence annotations. Second, it designs an evaluation framework consisting of an end-to-end detection task and three ground-truth-based subtasks, which can diagnose specific capability deficiencies of coding agents in code localization and evidence construction while assessing overall vulnerability detection performance. Finally, based on this benchmark, it conducts a systematic empirical study covering different model scales and different LLM-agent combinations, observing and revealing the underlying capability limitations of current coding agents on vulnerability detection tasks.

Construction Pipeline and Tiered Evaluation Task Definitions of VulnGym

The complete construction pipeline of VulnGym consists of three stages: dataset generation, manual verification, and entry refinement. In the first stage, vulnerability advisories are aligned with the corresponding vulnerable repository snapshots to generate structured vulnerability records. In the second stage, the validity of these records is verified through source-code alignment and manual review. Records that fail verification enter the third stage for entry refinement and are then sent back to the second stage for re-verification, forming an iterative verification loop. Readers can refer to the figure below to intuitively understand the stage division and flow logic of the full pipeline.

Fig. 1: Overview of the complete construction pipeline of the VulnGym benchmark dataset

In the manual verification stage, the code locations of the entry point, key operations, and vulnerability trace steps of each entry are first compared line by line against the target source code, with comparison results classified into four categories: exact match, line-number offset, content mismatch, and missing file. Two reviewers then independently verify the correctness of each record based on the vulnerability description; verification dimensions include external reachability of the entry point, security relevance of key operations, and ordering plausibility of the vulnerability trace. Each record is ultimately labeled as fully correct, requiring local repair, fully incorrect, or pending confirmation.

VulnGym defines four repository-level evaluation tasks, comprising one end-to-end vulnerability detection task T1 and three subtasks T2 through T4 that rely on prior information. The end-to-end task covers the complete vulnerability detection pipeline, while the three subtasks respectively isolate the evaluation requirements for entry-point identification, key operation localization, and vulnerability trace construction, enabling decomposed diagnosis of coding agents' capabilities across different dimensions. Readers can refer to the figure below to clarify the procedural differences and design logic of the four tasks.

Fig. 2: Overview of VulnGym's four tasks: T1 performs end-to-end vulnerability detection, while T2-T4 isolate the subtasks of entry-point identification, key operation localization, and vulnerability trace construction, respectively.

Measured Performance and Capability Analysis of State-of-the-Art Coding Agents on VulnGym

The study divides VulnGym's verified entries by trace length into three difficulty tiers: Easy (length ≤ 7), Medium (length = 8), and Hard (length ≥ 9), where the Medium and Hard samples are of comparable scale, corresponding to 110/31/31 security advisories and 278/56/46 evaluation entries, respectively. To investigate model scaling behavior, the study uses Claude Code as the agent framework and evaluates the Qwen3.5 series models with parameter counts of 2B, 4B, 9B, and 27B, measuring T1 performance at each difficulty tier. The experiments observe that as model parameter count increases, the coding agents' end-to-end vulnerability detection capability shows an overall strengthening trend: the 2B and 4B models achieve non-zero scores only on the Easy tier, the 9B model extends non-zero performance to the Medium tier, and the 27B model achieves the best performance on all metrics across all difficulty tiers, being the only model to attain non-zero performance on the Hard tier. You can refer to the line chart to intuitively compare the performance distributions of models with different parameter counts across the three difficulty tiers.

Fig. 3: Performance scaling of the Qwen3.5 series models across difficulty subsets as parameter count grows

Current state-of-the-art coding agents show further improvement over Qwen3.5-27B overall, but Hard-tier entries still generally cannot be solved effectively. The evaluation results show that DeepSeek-V4-Flash paired with the OpenHands framework achieves the current best performance, with AR, ER, and ES of 22.58%, 15.22%, and 11.63% respectively, outperforming the 12.90%, 8.70%, and 4.55% results of Qwen3.5-27B paired with Claude Code. Even so, this currently best-performing coding agent detects fewer than a quarter of the Hard-tier entries, and a significant capability gap remains in high-difficulty vulnerability detection scenarios.

Even when coding agents are given definitive endpoint-code pairs as prior conditions, the generated vulnerability evidence traces still suffer from incompleteness and high noise. The true negative rate of all evaluated coding agents falls in the range of 30.60% to 53.96%, while the true positive rate is markedly lower, ranging only from 14.61% to 26.71%. This imbalance between recall and precision indicates that although coding agents can recover some reference intermediate nodes, they also mix in a large number of unrelated unmatched nodes in their predictions. With endpoint uncertainty fully eliminated, the highest ES metric the evaluated models achieve is only 36.37%, directly demonstrating that current coding agents still face a difficult-to-overcome capability shortfall in constructing accurate vulnerability evidence traces.

Consolidation of Observations and Scope Limitations

All observations in this study regarding coding agents' vulnerability detection capabilities are confined to the experimental framework of the VulnGym benchmark, which is designed for repository-level scenarios and contains 184 security advisories and 408 vulnerability entries, all with fine-grained annotations of entry points, key operations, and vulnerability trace paths. Based on these annotations, the benchmark defines one end-to-end evaluation task and three oracle-based subtasks, enabling both overall performance assessment of coding agents and fine-grained diagnosis of capability shortfalls.

The measured results on this benchmark confirm that current state-of-the-art coding agents still cannot effectively handle a large number of high-difficulty vulnerabilities, and different combinations of LLMs and agent architectures show markedly different performance on vulnerability detection tasks. This observation provides a clear research foundation and optimization reference for driving coding agents toward reliable repository-level vulnerability detection.

Rating
No ratings yet
Rate
Community rating
—
/ 5
No ratings yet
Rating
—
Soundness
—
Presentation
—
Contribution
—
Confidence
—
Discussion
Top
Newest
Questions
Replication
Author
No comments yet — be the first