File size: 3,331 Bytes
c12142a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
license: mit
pretty_name: PatchBench
size_categories:
- n<1K
task_categories:
- text-generation
language:
- en
tags:
- code
- security
- vulnerability-repair
- program-repair
- agents
- benchmark
- fuzzing
configs:
- config_name: default
  data_files:
  - split: test
    path: data/test-*.parquet
---

# PatchBench

[![ArXiv](https://img.shields.io/badge/arXiv-2609.04075-b31b1b?style=flat&logo=arxiv&logoColor=white)](https://arxiv.org/abs/2609.04075) 
[![GitHub](https://img.shields.io/badge/GitHub-ai--sec--lab%2FPatchBench-181717?style=flat&logo=github&logoColor=white)](https://github.com/ai-sec-lab/PatchBench)
[![License](https://img.shields.io/badge/License-MIT-blue?style=flat)](https://github.com/ai-sec-lab/PatchBench/blob/main/LICENSE)

PatchBench is a benchmark for evaluating AI agents on realistic vulnerability patching tasks: **213 tasks drawn from 32 popular GitHub C/C++ projects**. It selects vulnerabilities whose ground-truth fixes lie *outside* the crash stack, and uses vulnerability transplant plus code mutation to mitigate surface-level fixes and patch memorization.

This repository holds the **task metadata**, one row per task to identify the project, the exact repository state, the crash, and the reference patch.

## Dataset Structure

Each example contains:

- **id**: Unique task identifier, also naming the task's image (Same as the one in [ARVO](https://github.com/n132/ARVO-Meta))
- **image**: Docker Hub image for the task, `b4drequest/vulpatch:{id}-vul`
- **project**: Real-world repository name
- **repo_addr**: Repository URL
- **base_commit**: Historical commit at which the vulnerability is still present, upstream of the developer's fixing commit
- **inverted_commit**: Newer upstream commit the vulnerability was transplanted onto
- **fuzzer**: Fuzzing engine that produced the crash, one of `libfuzzer`, `honggfuzz`, `afl`, `aflpp`
- **sanitizer_type**: The error detection tool type
- **CWE_ID**: The weakness the task's vulnerability manifests, derived from the sanitizer report and confirmed against the ground-truth patch
- **secondary_CWE_ID**: The underlying defect behind it where the evidence pins one down, and `None` where the primary already states the weakness
- **command**: Command that reproduces the crash inside the image, with the PoC at `/tmp/poc`
- **sanitizer_report**: Sanitizer output for the original PoC, including the crash stack
- **patch**: Reference patch against the task repository

`base_commit`, `inverted_commit` and `patch` are **ground truth** and are not visible to the agent during inference.

## Dataset Usage

```python
from datasets import load_dataset

dataset = load_dataset("ai-sec-lab/PatchBench", split="test")

```

Filtering works the usual way:

```python
libxml2 = dataset.filter(lambda r: r["project"] == "libxml2")
ubsan   = dataset.filter(lambda r: r["sanitizer_type"] == "ubsan")
```

## Evaluation

See our repo for details: [ai-sec-lab/PatchBench](https://github.com/ai-sec-lab/PatchBench).

## Citation

```bibtex
@misc{shen2026PatchBench,
  title = {{{PatchBench}}: Evaluating {{AI}} Agents for Vulnerability Patching},
  author = {Shen, Chihao and Li, Jiacheng and Mahajan, Aastha and Tian, Jeffery Siyuan and Kwon, Yonghwi and Chen, Yizheng},
  year = 2026,
  number = {arXiv:2609.04075},
  eprint = {2609.04075}
}
```