PatchBench: Evaluating AI Agents for Vulnerability Patching

Chihao Shen, Jiacheng Li, Aastha Mahajan, Jeffery Siyuan Tian, Yonghwi Kwon, Yizheng ChenarXiv 2026

TL;DR

Current benchmarks for AI vulnerability patching are severely flawed, often validating fixes simply if they stop a single crashing input (Proof-of-Concept). This paper reveals that LLM agents frequently cheat by either regurgitating memorized historical patches or writing shallow "band-aid" fixes that suppress the crash without fixing the root cause. To address this, the authors introduce PatchBench, a rigorous benchmark that uses vulnerability transplantation, code mutation, and a strict multi-stage validation pipeline to accurately measure true patching capabilities.

What Problem Does This Paper Address?

Automated vulnerability patching using Large Language Model (LLM) agents has seen massive interest, highlighted by events like DARPA's AI Cyber Challenge (AIxCC). However, evaluating these agents is deceptively difficult. Standard evaluations usually consider a patch successful if the program no longer crashes when given the original Proof-of-Concept (PoC) exploit input.

The authors identify two massive threats to the validity of these evaluations:

  1. Patch Memorization (Data Contamination): Because LLMs are trained on public code repositories, they often memorize historical bug reports and developer patches. Testing them on known vulnerabilities might just be evaluating memory retrieval rather than reasoning.
  2. Surface-Level Fixes: Agents often take shortcuts. Instead of localizing and fixing the underlying logic bug, they look at the crash stack trace and insert a local guard (like a null check or an early return) right where the crash happens. This suppresses the specific symptom but leaves the vulnerability open to alternative exploit paths and can silently break intended program behavior.
Figure 3: CVE-2022-1276 in mruby. The developer patch fixes the compiler-side argument packing condition at the correct location, while the agent adds only a surface-level check at the VM crash location.

Methods

The authors tackle these issues with a two-pronged approach: a new evaluation metric and a robust benchmark construction pipeline.

  • DiffBLEU: To quantify memorization, the authors developed DiffBLEU, a context-aware patch similarity metric. Built on top of CodeBLEU, it uses a diff-aware tokenizer to separate added and removed lines, normalizes code-irrelevant noise (like formatting and comments), and analyzes abstract syntax tree (AST) and data-flow slices around the patch context.
  • Vulnerability Transplantation & Mutation: To prevent agents from using memorized patches, PatchBench takes historical vulnerabilities from open-source projects, uses git bisection to transplant them into newer versions of the repository, and applies semantic-preserving code mutations (variable renaming, loop transformations, block swapping) to the patch sites. This forces the agent to face entirely unseen code contexts.
  • Rigorous Patch Validation Pipeline: Instead of relying on a single PoC, PatchBench validates patches using:
  • Security Validation: Employs both directed fuzzing (via ConcFuzz) and undirected fuzzing to generate a crashing corpus of multiple PoC variants, ensuring the vulnerability is thoroughly closed.
  • Semantic Validation: Tests the patch against a benign corpus and existing project unit tests to ensure it doesn't introduce new sanitizer errors, preserves the program's intended output states, and doesn't break existing functionality.

Datasets

The paper utilizes two primary datasets:

  • SEC-BENCH: An existing repository-level benchmark with 300 C/C++ patching tasks, used by the authors to analyze memorization and shortcut behaviors in current LLMs.
  • PatchBench (New): The newly introduced benchmark consisting of 213 patching tasks across 16 CWE types and 32 real-world open-source projects. Unlike previous benchmarks, it explicitly selects "off-stack" vulnerabilities—meaning the root cause lies outside of the functions listed in the crash stack trace—forcing agents to actually perform vulnerability localization.

Key Insights and Ideas

  • Agent Scaffolds Amplify Memorization: Surprisingly, repository-level agents (like Codex, Claude Code, and OpenHands) produce a higher proportion of memorized patches (averaging 25%) compared to standalone LLMs operating on local context (11%). The scaffolding provides better code context, which inadvertently helps the underlying LLM recall its training data more effectively.
Figure 4: DiffBLEU similarity between agent patches and developer patches on SEC-BENCH. Agents consistently shift the score distribution toward higher developer patch similarity compared with their corresponding standalone LLMs.
  • The Crash Stack Trace is a Crutch: AI agents rely heavily on the crash trace. Across evaluations, 81% of agent patches modified functions directly on the crash stack trace. When the root cause was actually located elsewhere, 64% of agent patches still incorrectly targeted the crash trace functions just to silence the symptom.
  • More Budget Doesn't Equal Better Patches: When the authors increased the per-task budget from $5 to $25, the success rate quickly plateaued. The bottleneck isn't compute or generation budget; it's the fundamental reasoning and localization capabilities of the models.

Key Results

The authors evaluated 11 state-of-the-art agent configurations, including commercial tools and the top three systems from the AIxCC finals.

  • Illusion of Competence: Under traditional single-PoC validation, the top three agents achieved near-perfect scores (>97% pass rate). However, under PatchBench's strict Security + Semantic validation, their actual solve rates plummeted to roughly half (~50-59%). On average, PoC-only validation inflates agent success rates by 1.83×.
Figure 1: The top three agents achieve Single-PoC pass rates above 97%, while their pass rates drop to 75–82% after secu- rity validation with multiple PoCs, and to roughly half with additional semantic validation, which checks whether patches preserve intended program behavior.
  • General-Purpose Agents Outperform Specialized Cyber Systems: Specialized Cyber Reasoning Systems (CRSs) from AIxCC (like Atlantis, Buttercup, and RoboDuck) actually performed worse than general-purpose programming agents running on the same underlying models. The authors attribute this to rigid, over-engineered framework workflows in the CRSs that restrict free exploration and waste API budgets on boilerplate templates.

Limitations and Future Work

  • Reference Dependency: PatchBench relies on a manually curated "reference-patched repository" to act as a behavioral oracle for semantic validation. In real-world deployment, such an oracle doesn't exist, making semantic validation much harder.
  • The Validation Gap: Even with extensive fuzzing, PatchBench's validation pipeline missed minor issues in about 6.8% to 7.1% of patches, leaving the root cause partially unfixed because fuzzing couldn't guarantee 100% path coverage. The authors suggest integrating symbolic or concolic execution in future iterations to generate inputs that more rigorously explore agent-edited paths.

Summary updated

BibTeX
@misc{shen2026patchbench,
  author = {Chihao Shen and Jiacheng Li and Aastha Mahajan and Jeffery Siyuan Tian and Yonghwi Kwon and Yizheng Chen},
  title = {{PatchBench: Evaluating AI Agents for Vulnerability Patching}},
  year = {2026},
  eprint = {2609.04075},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.04075},
}
Figure