arXiv(opens in a new tab)cs.SEOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.33509

Can Agentic Code Review Catch Vulnerabilities Before They Are Merged?

Yihan Yang, Chenyuan Yang, Zijie Zhao, Anh Nguyen Hoang, Ziqi Zhang, Weidong Wang, Zhiheng Lyu, Lingming Zhang

Abstract

LLM agents have been increasingly adopted for security-focused code review, but existing benchmarks mostly derive the reviewed changes from their later fixes instead of the real-world bug-introducing commits. In this paper, we present SecPRBench, the first comprehensive benchmark for evaluating agentic security review on validated real-world code changes. More specifically, we have built an automated agentic pipeline to autonomously harvest, build, and validate massive real-world bug-introducing commits for popular software systems. To ensure precise evaluation, we also adopt LLM-as-a-judge to credit the findings matching ground-truth vulnerabilities. To date, we have collected 265 tasks from nine critical systems, including Firefox, V8, and OpenSSL with millions of lines of code. Across eight frontier models, recall ranges from 32.5% to 78.1%, with Grok 4.6 and GPT-6 sol ranking at the top. Our study also shows that most misses are not simply oversights: in 68% of them, the agent reports on a file that holds the flaw but argues for a different mechanism. Security-focused harnesses also behave differently: OpenAI's Codex Security lowers recall by 8.3 points, mostly by abstaining, while Anthropic's Defending Code harness raises it by 7.7 points, at a higher cost.

github.com/yijan4845/secprbench

yijan4845.github.io/secprbench-results

1 Introduction

Anthropic, OpenAI, and GitHub now offer agents that review code changes, such as pull requests (PRs), for vulnerabilities before merge (Anthropic, 2026b; OpenAI, 2025; GitHub, 2026). A vulnerability missed at review can persist for years (Yang et al., 2025). Consider a Firefox sandbox escape in which a compromised child process could make the privileged parent return an unintentionally powerful handle over inter-process communication (IPC) (CVE-2025-2857; Mozilla Foundation, 2025). Catching it at review requires connecting the IPC code to Windows handle semantics and the trust boundary between processes. We ask: Can today's agents catch vulnerabilities before merge?

A diff shows a reviewer where to start looking but not what is wrong, so a security review is only as useful as its diagnosis. Unfortunately, existing benchmarks do not measure diagnosis on real changes (Table 1). Earlier detection datasets score a binary label on single functions (Ding et al., 2025; Yildiz et al., 2025), which models often get right for the wrong reasons (Ullah et al., 2024). Reproduction and exploitation benchmarks start from a known vulnerability and score an executable proof-of-concept (PoC) or exploit (Wang et al., 2026b; Lee et al., 2026; Wang et al., 2026a; Lee and Brumley, 2026). Code-review benchmarks also do not target security vulnerabilities (Zeng et al., 2026; Zhang et al., 2026b). Security PR-review benchmarks come closest, and MalPR-Bench scores whether the reviewer identifies the target (Chen et al., 2026). However, most of their vulnerable PRs revert or partially apply a later fix, which centers each diff on the repaired code, instead of using the real vulnerability-introducing commit (Melo et al., 2026; Chen et al., 2026).

We introduce SecPRBench, a benchmark for pre-merge security review that aims to evaluate modern agentic code review on real-world bug-introducing commits. Each task gives an agent the diff of a real historical change that introduced a vulnerability, its commit message, and the repository, but no description of the flaw; the agent reports findings. A finding earns credit only if it explains the root cause of the task's target vulnerability in the reviewed code; in Figure 1, a bounds warning on the right call earns none. SecPRBench contains 265 buggy tasks from nine widely deployed C, C++, and Rust

∗^{*}Equal contribution.

†^{\dagger}Quantum AI & Cyber Security Institute, FPT Corporation; work done during an internship at UIUC.

Figure

Figure 1: One SecPRBench case (Wasmtime CVE-2026-34946; diff and message paraphrased, findings illustrative). The flaw depends on unchanged code outside the diff; the LLM judge credits a finding only if it explains the target's root cause and that cause is still live in the reviewed code.

projects, including Firefox, V8, and OpenSSL with millions of lines of code. Each buggy task has a fixed companion that adds the later repair, on which the target should no longer be reported.

Building such pairs is challenging as advisories typically name the fix, not the introducing change, and automatic attribution can be unreliable (Lu et al., 2026). We have built an automated agentic pipeline to trace each bug's introducing change and compose it with the later fix. Moreover, our pipeline also validates the pairs automatically, mostly by PoC replay on the parent, introducing, and fixed versions. Most cases pass mechanical validation checks based on PoC execution; the other task instances require human adjudication. For task evaluation, since no oracle checks free text, a large language model (LLM) judge, Claude Opus 5.5 (high), derives target-specific criteria from a reference built from public security records and checks each finding against them and the reviewed code.

Across eight frontier models and two security-focused harnesses, three findings stand out. Strong agents tie on easy targets but diverge on contested ones. Grok 4.6, GPT-6 sol, GLM 5.3, and Opus 5.5 each find about three in four targets and are statistically tied overall. On easy targets, which nearly all other agents find, every agent but MiniMax M3 finds at least nine in ten. On contested targets, which few other agents find, the top four still find about half, while the other four find at most one in five. Even combined, the eight models leave 23 targets unfound. Most misses are not oversights. In 68% of misses, a finding lands in a file that holds the flaw, often in the very function, but argues a mechanism the judge rejects. Scoring by location or by a binary vulnerable/safe verdict would count these as detections; MalPR-Bench similarly finds that reviewers often block a PR without identifying its flaw (Chen et al., 2026). Security-focused harnesses move recall in both directions. With each backend model fixed, OpenAI's Codex Security plugin, run as a static diff scan (OpenAI, 2026f), lowers recall by 8.3 points relative to the same model in the Codex CLI, mostly by abstaining; Anthropic's Defending Code reference harness (Anthropic, 2026e) raises it by 7.7 points on the tasks it completed, at higher cost and report volume. On repaired changes, the judge never rules that the removed target is still present (§ 5.4).

The paper makes three main contributions:

• Benchmark and the construction pipeline. SecPRBench, the first comprehensive benchmark for evaluating agentic security review on validated real-world code changes, with 265 cases built by an automated, repeatable pipeline that turns fixes into validated pairs of introducing and repaired changes ( §§ 3).

• Grading. A criteria-first judge that credits only root-cause explanations of a target present in the reviewed code, separating correct diagnosis from findings that merely land in the right place, with each verdict’s rationale recorded ( §§ 4).

• Analysis. Evaluation of eight frontier models and two security-focused harnesses showing where agents diverge, why they miss, and whether harnesses and training cutoffs change recall, with reports, verdicts, and analysis code released ( §§ 5).

BenchmarkTasksTask inputValidationScoring
Real changeNo hintFull repoPaired controlPoC-validatedScored byRoot cause
VULNERABILITY DETECTION: LABEL
PrimeVul (Ding et al., 2025)6,968✕✓✕✓✕Label✕
JitVul (Yildiz et al., 2025)1,758➊✓➊✓✕Label✕
REPRODUCTION AND EXPLOITATION: PoC, EXPLOIT, OR PATCH
SEC-bench (Lee et al., 2025)200✕✕✓✕✓Exec.✕
CyberGym (Wang et al., 2026b)1,507✕➊✓✕✓Exec.✕
CyberGym-E2E (Shi et al., 2026)920✕✓✓✕✓Exec.✕
SEC-bench Pro (Lee et al., 2026)344✕➊✓✕✓Exec. + LLM✕
ExploitGym (Wang et al., 2026a)898✕✕✓✕✓Exec. + LLM✕
ExploitBench (Lee and Brumley, 2026)41✕✕✓✕✓Exec.✕
CODE REVIEW: COMMENTSc-CRAB (Zhang et al., 2026b)184✓✓✓✕✕Tests✕
SECURITY REVIEW OF PULL REQUESTS: VERDICT OR REPORT
SEVRA-Bench (Melo et al., 2026)~1,000➊✓✓✕✕LLM➊
MalPR-Bench (Chen et al., 2026)89 + 50➊✓✓✓➊LLM, human✓
SecPRBench (ours)265 + 265✓✓✓✓➊LLM✓

Symbols: ✓ yes, ● partial, ✕ no. Tasks: vulnerable + control where both are reported; JitVul counts functions from 879 CVEs. Real change: from project history; ● for fix-derived changes (reverted or partial patches) or functions from introducing commits. No hint: ● if hints vary by level (CyberGym) or target metadata is given (SEC-bench Pro). Paired control: fixed or benign controls, not always one per vulnerable input. PoC-validated: ● if only some cases are (MalPR-Bench: twelve discovery cases; SecPRBench: § 3.3).

Table 1: How SecPRBench differs from related benchmarks. Only SecPRBench uses complete vulnerability-introducing changes (no hint, full repo) and pairs each with its repaired version.

References (31)

  • Hwiwon Lee, Jiawei Liu, Dongjun Kim, Wubing Xia, Ziqi Zhang, Chunqiu Steven Xia, and Lingming Zhang. 2026. SEC-bench Pro: Can language models solve long-horizon software security tasks? arXiv preprint arXiv:2605.26548. (opens arXiv in a new tab)
  • Zijie Zhao, Chenyuan Yang, Weidong Wang, Yihan Yang, Ziqi Zhang, and Lingming Zhang. 2026. AnyPoC: Universal proof-of-concept test generation for scalable LLM-based bug detection. arXiv preprint arXiv:2604.11950. (opens arXiv in a new tab)
  • We collect candidates from two complementary sources: CVE-linked vulnerability records and public project security reports, including issues without assigned CVE identifiers
  • All 265 buggy changes and their fixed companions satisfy these caps
  • Of the 265 cases, identified by project and bug identifier, 217 are accepted through the mechanical route and 48 through human adjudication (Table 5)
  • Before replay, structural checks cover commit hashes, task metadata, diff structure, and patch applicability
  • The same PoC triggers the target overread in both the parent and reviewed versions
  • mechanical</td><td>217</td></tr><tr><td>Validated cases: human adjudication</td><td>48</td></tr></table>
  • Raw records include overlapping reports and repeated records of the same issue
  • All projects additionally require a traceable code change suitable for benchmark task construction
  • The released snapshot records the selected cases and the hashes, commit identifiers, and diff statistics of all 530 review inputs
  • These are condensed descriptions of the prompts, not verbatim copies of the original templates
  • State uncertainty; a complete exploit is not required
  • This reporting policy favors candidate discovery
  • Codex Security and Anthropic's Defending Code reference harness follow their own review workflows (Appendix F.7)
  • Reject adjacent bugs, location-only matches, hypothetical future risks, and historical or already-fixed failures
  • Appendix E covers excerpt selection and why this verdict does not measure target alarms on fixed companions
  • A positive saved verdict denotes detection
  • No pair among the top four agents (Grok, GPT-6 sol, GLM, and Opus) differs significantly even before correction for multiple comparisons
  • On easy targets, found by six or seven others, every agent except MiniMax M3 finds at least 90%
  • A task’s root-cause files comprise the reference finding’s location, affected files, and additional files annotated as necessary to explain the mechanism
  • Category D rests on judge verdicts we did not re-adjudicate; most such reports offer competing diagnoses rather than explicitly claiming the target site is safe
  • Within difficulty strata, the Opus difference is no longer statistically clear; Grok's differences vary by stratum and include small miss samples
  • Including single-finding reports, reading only the first finding reaches the target in 74.9% of detections with a resolved rank
  • Grok instead reports ordinary trailing-dot normalization and percent-encoded dots, calling the latter an incomplete fix
  • >Agent</td><td colspan=
  • Empty reports receive negative verdicts without a judge model call
  • Findings, nominal cost, and time are per scan; five assigned pairs are missing
  • Headers give sample sizes
  • ><tr><td rowspan=
  • Opus and Grok include training data through June 2026, leaving no later fixes (Anthropic, 2026c; xAI, 2026); GLM has no documented cutoff