Manuscript Offprint

arXiv:2610.17020

CWE-bench: Refocusing Agentic Security from Exploitation to Defense

Gonzalo Gonzalez-Pumariega, Ajay Jagannath, Adit Jain, Guram Gogia, Soumyadeep Bakshi, Nazneen Rajani

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Gonzalo Gonzalez-Pumariega Ajay Jagannath Adit Jain Guram Gogia Soumyadeep Bakshi Nazneen Rajani

Cybersecurity evaluations of AI agents have focused largely on offense, yet a working exploit does not show that an agent can make software safe. An attacker needs to exploit only one vulnerability; a defender must find and fix all of them. We introduce CWE-bench, a private benchmark of 120 held-out repository audit-and-repair tasks spanning 73 CWE types, eight languages, and all OWASP Top 10 2025 categories. Agents are given a repository to audit and a description of its threat model, but are not told the weakness, where it occurs, or how many vulnerable sites there are. Each patch must block the exploit while preserving original functionality, as checked by a programmatic verifier. We validated the verifier against a panel of agentic judges, manually reviewing disagreements during development and refining the checks. The best agents reach 68% pass@1 and 81% pass@4. We further conduct analyses showing that (i) agents with the same pass@1 differ widely in retry gains and cost, and (ii) no single agent is best across languages or vulnerability categories, and difficulty varies far more by vulnerability category than by language. As the offensive capabilities of agents improve, CWE-bench provides a broad and rigorous measure of whether their defensive capabilities keep pace.

Correspondence: research@collinear.ai

Date: October 14, 2026

1 Introduction

Can an agent make a vulnerable codebase safe to use? Most cybersecurity evaluations of AI agents measure offense: solving capture-the-flag challenges, exploiting applications, or reproducing vulnerabilities (Zhang et al., 2025; Zhu et al., 2025; WANG et al., 2026). Defense has received far less attention, even though it is the harder problem. An attacker needs to exploit only one vulnerability; a defender must find and fix all of them without breaking the software. Consider a file server with a path-traversal flaw. An attacker needs just one handler that builds a file path from user input to read files outside the shared directory. A defender must find and fix every such handler, and cannot simply disable downloads, since that removes the service the server exists to provide.

A growing number of benchmarks evaluate defensive agents, but each simplifies the problem in a different way. Many build tasks directly on public Common Vulnerabilities and Exposures (CVEs), whose fixes may already be in training data, or on LLM-generated code bases that fall outside the distribution of real software (Wei et al., 2025; Luo et al., 2026a; Bui et al., 2026; Luo et al., 2026b). Others give the agent a vulnerability description, proof-of-concept input, or location hints, reducing discovery to repair of a known flaw (Wei et al., 2025; Shen et al., 2026; Bui et al., 2026). The rest cover only a narrow slice of weaknesses, such as memory-safety bugs in C/C++ (Shi et al., 2026; Shen et al., 2026; Lau et al., 2026). A real defender faces none of these simplifications: it must find unknown vulnerabilities across the full range of weaknesses in real code.

We introduce CWE-bench, a benchmark of 120 held-out repository auditing and repair tasks that addresses each of these gaps. Every task is built on a real open-source repository with injected vulnerabilities, and the evaluation set is kept private, so the injected vulnerabilities have no published fix. Agents receive only the repository and an audit instruction describing the system and its threat model; they are not told the weakness, where it occurs, or how many vulnerable sites there are. Tasks span 73 Common Weakness Enumeration (CWE) types, eight programming languages, and all ten OWASP Top 10:2025 categories. A patch passes only if it blocks the exploits while preserving the original functionality.

BenchmarkTasksCWEsOWASP 2025Lang.CodebaseVuln. sourceInformation given to agent
PatchEval (Wei et al., 2025)230397/103RealPublic CVEsVulnerability description
CyberGym-E2E†^{\dagger} (Shi et al., 2026)920NR1/102RealPublic OSS-Fuzz bugsNone
LiveCVEBench (Luo et al., 2026a)190749/1014RealPublic CVEsBug report
ZeroDayBench†^{\dagger} (Lau et al., 2026)22154/106RealInjectedVaries (5 levels)
PatchBench (Shen et al., 2026)213161/102RealInjectedPoC and sanitizer report
Vul4Py (Bui et al., 2026)100607/101RealPublic CVEsCVE and file/line hints
SecProbe†^{\dagger} (Luo et al., 2026b)3531515/106LLM-generatedInjectedSoftware specification
CWE-bench1207310/108RealInjectedThreat model

Table 1 Comparison of recent vulnerability repair benchmarks. OWASP 2025 counts the OWASP Top 10:2025 categories covered under each category's official CWE mapping. Codebase indicates whether tasks are built on real open-source repositories or LLM-generated ones. Injected denotes vulnerabilities inserted into a codebase, such as real CVEs transplanted into new repositories. C/C++ and JavaScript/TypeScript count as separate languages. PatchEval counts its 230-task sandboxed subset. NR: not reported. †^{\dagger} Some values (in italics) are derived by us: from source-CVE records (ZeroDayBench), sanitizer crash types (CyberGym-E2E), or the 20 most frequent CWEs reported (SecProbe, a lower bound).

To ensure the correctness of our verifiers, we compared their verdicts with those of a panel of three agentic judges and, during development, manually reviewed every rollout where the two disagreed. Table 1 compares CWE-bench with recent defensive benchmarks.

The best agents reach 68% pass@1 and 81% pass@4. Beyond these aggregate scores, agents with the same pass@1 differ widely in how much they gain from retries and in cost per attempt, and their ordering changes across languages. Difficulty varies far more across vulnerability categories than across languages, and no single agent leads in either.

The paper makes three contributions:

  1. CWE-bench, a private benchmark of 120 auditing and repair tasks on real repositories, covering all ten OWASP Top 10:2025 categories with no diagnosis given to the agent.

  2. A validated grading procedure that checks both exploit blocking and preserved functionality, confirmed against a panel of agentic judges.

  3. An evaluation of eleven frontier agents, showing that equal pass@1 hides large differences in retry gains, task coverage, and cost, and that no single agent is best across languages or vulnerability categories.

References (31)