PatchTheVuln · Results · Updated 1 December 2026
From 2% to 34%.
PatchTheVuln is an RL environment for security patching. Training on it takes a 7B model from 2% to 34% on held-out tasks, about 15×. On its hard tier, GPT 6.2 Sol fixed all 236 planted vulnerabilities under our benchmark checks, but passed 27/59 tasks. All 32 failures came from functional checks.
Standard tier · 178 held-out tasks
Base
Qwen2.5-Coder-7B-Instruct
4/178 (2.2%)
95% CI 1–6%
Mender r1
Ours · same 7B, trained here
51/178 (28.7%)
95% CI 23–36%
Mender r2
Ours · r1 + hard-composite replays
60/178 (33.7%)
95% CI 27–41%
GPT 6.2 Sol
Frontier reference
172/178 (96.6%)
95% CI 93–98%
Hard tier · 59 Hard tasks, including 15 calibration tasks · four vulnerabilities each
Base
Qwen2.5-Coder-7B-Instruct
0/59 (0%)
95% CI 0–6% · vulnerabilities fixed 0/236 (0%)
Mender r1
Ours · same 7B, trained here
0/59 (0%)
95% CI 0–6% · vulnerabilities fixed 14/236 (5.9%)
Mender r2
Ours · r1 + hard-composite replays
0/59 (0%)
95% CI 0–6% · vulnerabilities fixed 39/236 (16.5%)
GPT 6.2 Sol
Frontier reference
27/59 (45.8%)
95% CI 34–58% · vulnerabilities fixed 236/236 (100%)
GPT 6.2 Sol fixed all 236 planted vulnerabilities under our benchmark checks, but passed 27/59 tasks. All 32 failures came from functional checks.
The strict score for fresh Set B was 7/15. A CSV check rejected CRLF line endings, which RFC 4180 describes as valid record separators. Accepting them would put Set B at about 12/15, an estimate from re-scoring, not a new run. The official pooled score stays 27/59.
Standard and Hard evals are pass@1: one attempt per task, with the same agent scaffold for every model. Validation is reported separately: 29 tasks, two attempts each (58 episodes), scored pass@1. Intervals are Wilson 95%.
26
Seed apps · Python 7, TypeScript 7, Go 6, Java 6
6
Frameworks · FastAPI, Flask, Express, Next.js, chi/Gin, Spring Boot
391
Standard tasks · 184 train, 29 val, 178 held out
59
Hard tasks · including 15 calibration tasks
4
Vulnerability classes · SQL injection, SSRF, Auth bypass, Path traversal
11
Admission gates · including: the planted service scores 0; the reference fix scores 1; known reward hacks score 0; grading is deterministic; the container is isolated; a leave-one-out gate on hard tasks
The hidden functional suites are mutation-tested, and grading fails closed.
01 / Standard tier
About 15× on held-out tasks.
178 held-out tasks, with no frontier transcripts in training. The biggest gain is on apps never seen in training: T2 went from 0 to 40 of 97. Mender r2 over r1 is no regression and a modest gain: r2 solves 24 tasks r1 misses, r1 solves 15 that r2 misses (exact McNemar p ≈ 0.2, not significant).
Overall178 tasks
- Base2.2%4 / 178
- Mender r128.7%51 / 178
- Mender r233.7%60 / 178
- GPT 6.2 Sol96.6%172 / 178
T1 · New sites in seen apps54 tasks
- Base5.6%3 / 54
- Mender r124.1%13 / 54
- Mender r225.9%14 / 54
- GPT 6.2 Sol92.6%50 / 54
T2 · Unseen apps97 tasks
- Base0.0%0 / 97
- Mender r137.1%36 / 97
- Mender r241.2%40 / 97
- GPT 6.2 Sol97.9%95 / 97
T3 · Unseen class × language27 tasks
- Base3.7%1 / 27
- Mender r17.4%2 / 27
- Mender r222.2%6 / 27
- GPT 6.2 Sol100.0%27 / 27
| Model | Solved | Rate | 95% CI | T1 (54) | T2 (97) | T3 (27) |
|---|---|---|---|---|---|---|
| Base | 4 / 178 | 2.2% | 1–6% | 3 | 0 | 1 |
| Mender r1 | 51 / 178 | 28.7% | 23–36% | 13 | 36 | 2 |
| Mender r2 | 60 / 178 | 33.7% | 27–41% | 14 | 40 | 6 |
| GPT 6.2 Sol | 172 / 178 | 96.6% | 93–98% | 50 | 95 | 27 |
02 / Training
No teacher model.
Mender r1 is the base 7B after a teacher-free warm-up on scripted replays of the reference fixes, then one round of expert iteration on PatchTheVuln's reward. No frontier transcripts. On the validation split, pass@1 over 29 tasks, it goes from base, to the warm-up, to r1.
Validation split · pass@1 · 29 tasks, 58 episodes
- Base3.4%1 / 29
- Warm-up17.2%5 / 29
- Mender r120.7%6 / 29
View as table
| Step | Solved | Rate |
|---|---|---|
| Base | 1 / 29 | 3.4% |
| Warm-up | 5 / 29 | 17.2% |
| Mender r1 | 6 / 29 | 20.7% |
03 / Hard tier
Every planted bug fixed. 32 of 59 tasks failed.
- Four vulnerabilities in one service: an auth bypass, a SQL injection, a path traversal and an SSRF.
- An audit-style brief, with no files, no classes and no count.
- About 12–15 extra hidden checks per app catch over-eager fixes.
- A leave-one-out admission gate guarantees every vulnerability matters on its own.
The brief
“An external penetration test found several high-severity vulnerabilities in this service. Find and fix them.”
| Set | Tasks | GPT 6.2 Sol solved |
|---|---|---|
| Pilot | 15 | 7 / 15 |
| Fresh set A · New combinations | 29 | 13 / 29 |
| Fresh set B · Three apps never used for calibration | 15 | 7 / 15 |
GPT 6.2 Sol · standard vs hard
- Standard tier178 held-out tasks96.6%172 / 178
- Hard tier59 tasks, incl. 15 calibration45.8%27 / 59
GPT 6.2 Sol · vulnerabilities fixed vs tasks solved
- Vulnerabilities fixedof 236100%236 / 236
- Tasks solvedof 5945.8%27 / 59
The gap between the two bars is tasks that failed functional checks.
GPT 6.2 Sol · hard tier by language
- Go100.0%9 / 9
- Java88.9%8 / 9
- Python33.3%8 / 24
- TypeScript11.8%2 / 17
All models, all 59 hard tasks
| Model | Solved (of 59) | Rate | 95% CI | Vulnerabilities fixed (of 236) |
|---|---|---|---|---|
| Base | 0 | 0% | 0–6% | 0 (0%) |
| Mender r1 | 0 | 0% | 0–6% | 14 (5.9%) |
| Mender r2 | 0 | 0% | 0–6% | 39 (16.5%) |
| GPT 6.2 Sol | 27 | 45.8% | 34–58% | 236 (100%) |
What the frontier model gets wrong
Unrequested format changes
GPT added CSV formula-injection escaping and switched line endings to CRLF, and the export check rejected the result. It did this in all 5 tasks on one app. CRLF is a valid record separator under RFC 4180; see the note on Set B.
Rewriting a security control and losing a constraint
GPT replaced a broken SSRF allowlist with a stricter host-and-port check, but dropped the original rule that rejects URLs with embedded credentials. It did this in all 3 such tasks.
Token handling
GPT rewrote TypeScript signed-token verification and broke the rejection of expired or malformed tokens.
Over-tightened rules
GPT over-tightened the Java approver rules, so legitimate approvals the app depends on were rejected.
GPT 6.2 Sol fixed every planted vulnerability. All 32 failures came from functional checks: changes made while hardening the service that the app's checks rejected.
Status
Evaluations are frozen. Hard-tier training moved the 7B: Mender r2 fixed 39 hard-tier vulnerabilities to r1's 14, about 2.8× as many, but solved no hard task. Mender r2 fixed two in one task 9 times, and 20 of its fixes left the app passing at least 90% of its checks.
04 / About the environment
A real fix, or nothing.
In the Standard tier, a security scanner has flagged an endpoint. The agent plays the developer who has to fix it today, and the site has to keep working for real users.
Unsafe fix
The patch blocks the payload in the report but leaves the hole open to a variant.
Breaking fix
The patch closes the hole by damaging legitimate behaviour.
Coding agents asked to fix security bugs fail in these two ways. PatchTheVuln requires avoiding both in one binary reward, so a model can't trade one for the other.
Standard tier: what the agent sees
- The full service source code, writable
- A scanner-style finding: the vulnerability class, the affected endpoint and a one-line description. No payload, no file, no line number
- Visible functional tests it can run
Hard tier: only a general audit brief; no class, endpoint, or count is given.
The agent never sees
- The hidden functional tests, including inputs that only look like attacks
- The exploit variants: they are never on the agent's disk
- The network: the agent's container has no outbound access
Four vulnerability classes
| Class | CWE | Planted as | The exploit succeeds when |
|---|---|---|---|
| SQL injection | CWE-89 | A string-built query in a search or login handler | A secret row leaks, or the login is bypassed |
| SSRF | CWE-918 | A URL preview, webhook or import feature fetches unvalidated targets | An internal canary service records a hit |
| Broken access control | CWE-287 / 306 / 862 | Missing auth middleware, an unverified token signature, a missing ownership check | A protected resource is read or changed without valid credentials |
| Path traversal | CWE-22 | A download or upload joins user input to a base path | A canary file outside the allowed root is read or written |
26 seed apps, four languages
Python
FastAPI, Flask · 7 apps
TypeScript
Express, Next.js · 7 apps
Go
chi/Gin · 6 apps
Java
Spring Boot · 6 apps
Standard tier difficulty
- EasyFlaw and fix in one file, at the handler
- MediumThe flaw spans layers; the fix belongs in a layer the finding doesn't name
- Advanced (standard tier)A flawed existing sanitiser, a second-order flow, or several call sites sharing one flawed helper
How a submission is graded
- 01The agent's work is copied. Protected files (tests, build configuration) are compared with the originals; any change is flagged and reverted.
- 02The service starts fresh and the hidden functional suite runs against it, including legitimate inputs that look like attacks: a customer named O'Brien, a search for “50% off -- today”, a filename like report.v2.final.pdf.
- 03The service starts fresh again and every exploit variant runs, with new random canaries each time. Each task carries several variants that reach the flaw by different routes.
- 04Reward is 1 only if every functional check passes and every exploit is blocked. An error counts against the submission.
Partial credit would pay a model for an unsafe fix, the behaviour the environment exists to remove. So reward is binary.
Cheats, and what catches them
| Cheat | Caught by |
|---|---|
| Delete or stub the vulnerable route | Hidden functional tests use the route with legitimate input |
| Reject all input, or an over-broad blocklist | Legitimate inputs that look like attacks |
| Edit the exploit test | Exploits are never on the agent's disk; grading runs in a fresh container |
| Edit visible tests or build config | Protected files are restored and the change is flagged |
| Special-case the payload from the report | Several variants, random canaries, and no payload in the finding |
| Block every private address (SSRF) | A legitimate partner service sits on a private address, so the functional checks fail |
Admission
Every task passes eleven admission gates before it is admitted, including: the planted service scores 0, the reference fix scores 1, known reward hacks score 0, grading is deterministic, the container is isolated, and, for hard tasks, a leave-one-out gate. The hidden functional suites are mutation-tested: each must kill at least 70% of mutants, and most kill more than 90%. Grading fails closed.
Held-out splits
Held-out tasks are split by group, not at random, to reduce train–test overlap: T1 holds out plant sites in seen apps, T2 whole apps, T3 whole class × language combinations. Near-duplicate plants across apps are kept on the same side of the split.
Known limits
- Exploits are a finite set. A fix that blocks only those variants, not the underlying flaw, could score 1; several variants and lookalike inputs make that hard, not impossible.
- The functional suite is not exhaustive. A fix that breaks behaviour no check covers would not be caught.
- The grader judges behaviour over HTTP, not code quality: a clumsy fix that works scores the same as an idiomatic one.
- The agent never writes exploits. Finding unknown bugs, and other bug classes, are out of scope for this version.
05 / How we measured
The method.
- Standard:
- 391 tasks from 26 seed apps · 184 train · 29 val · 178 held out
- Hard:
- 59 tasks, including 15 calibration tasks · 4 vulnerabilities each
- Languages:
- Python, TypeScript, Go, Java
- Classes:
- SQL injection, SSRF, Auth bypass, Path traversal
- Reward:
- Binary: 1 only if every hidden exploit is blocked and every hidden test passes
- Protocol:
- pass@1: 1 attempt per task, the same agent scaffold for every model
- Intervals:
- Wilson 95%
- Base:
- Qwen2.5-Coder-7B-Instruct
- Mender r1:
- Ours: the same 7B. A teacher-free warm-up on scripted replays of the reference fixes, then one round of expert iteration (521 rollouts, 158 successes kept across 101 tasks). No frontier transcripts
- Mender r2:
- Ours: r1's 710 examples plus 229 scripted replays on 113 train-only hard composites. Imitation, not RL: r1 solved 0 of 277 rollouts on those composites
- GPT 6.2 Sol:
- Frontier reference
Integrity
- Winning patches were reviewed by hand. They are genuine root-cause fixes: parameterized queries, owner filters, constant-time signature checks, path containment and per-hop redirect allowlists.
- Known cheats score zero by construction: deleting routes, rejecting all input and editing tests.
- The other four catalog environments are in development. Their results will be published when they exist.
Samples
Request a sample.
Tell us what you'd train or evaluate. We reply by email with PatchTheVuln sample tasks and how a full set is scoped to your model.
Loading the form…