Skip to content

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).

Standard tier held-out results by model and tier
ModelSolvedRate95% CIT1 (54)T2 (97)T3 (27)
Base4 / 1782.2%1–6%301
Mender r151 / 17828.7%23–36%13362
Mender r260 / 17833.7%27–41%14406
GPT 6.2 Sol172 / 17896.6%93–98%509527

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.

View as table
Training progression on the validation split
StepSolvedRate
Base1 / 293.4%
Warm-up5 / 2917.2%
Mender r16 / 2920.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.”

Hard tier sets
SetTasksGPT 6.2 Sol solved
Pilot157 / 15
Fresh set A · New combinations2913 / 29
Fresh set B · Three apps never used for calibration157 / 15

All models, all 59 hard tasks

Hard tier results by model
ModelSolved (of 59)Rate95% CIVulnerabilities fixed (of 236)
Base00%0–6%0 (0%)
Mender r100%0–6%14 (5.9%)
Mender r200%0–6%39 (16.5%)
GPT 6.2 Sol2745.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

Vulnerability classes in PatchTheVuln
ClassCWEPlanted asThe exploit succeeds when
SQL injectionCWE-89A string-built query in a search or login handlerA secret row leaks, or the login is bypassed
SSRFCWE-918A URL preview, webhook or import feature fetches unvalidated targetsAn internal canary service records a hit
Broken access controlCWE-287 / 306 / 862Missing auth middleware, an unverified token signature, a missing ownership checkA protected resource is read or changed without valid credentials
Path traversalCWE-22A download or upload joins user input to a base pathA 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

  1. 01The agent's work is copied. Protected files (tests, build configuration) are compared with the originals; any change is flagged and reverted.
  2. 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.
  3. 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.
  4. 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

Known cheats and how each is caught
CheatCaught by
Delete or stub the vulnerable routeHidden functional tests use the route with legitimate input
Reject all input, or an over-broad blocklistLegitimate inputs that look like attacks
Edit the exploit testExploits are never on the agent's disk; grading runs in a fresh container
Edit visible tests or build configProtected files are restored and the change is flagged
Special-case the payload from the reportSeveral 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…

Next · The catalogAll five environments