Ground truth for SAST. An open benchmark with machine-readable ground truth and deterministic SARIF scorers, for measuring how accurately a static analysis tool identifies true vulnerabilities in benchmark code and how often it flags safe code.
benchproctor.com · blog · Apache-2.0
The current release is 2026.11.22. It is a curated release:
- 15,372 standalone cases in 11 languages across 21 framework targets, exactly 7,686 vulnerable and 7,686 safe;
- 368 multi-service applications in five languages, holding 5,284 labeled flows.
New in 2026.11.22: every framework is drawn in its API generations, an older line that is still widely deployed beside the current one, and the long-term-support line where the project has one (Spring Boot 2.7, 3.5 and 4.1, for example), each in its own folder. Every dependency is an exact version with its lockfile, and every container image is pinned by digest. Every weakness class draws from at least three distinct sink forms per side, apart from a few documented exceptions. See changelog.md.
It is published as plain files in
Benchmarks/, so every case and answer key can be read here without unpacking anything. Earlier releases are kept underarchive/, one zip per release.Releases are curated. Each release is a fresh draw: easy and medium difficulty only, on a fixed list of frameworks and weakness classes. The larger corpus it is drawn from is not published. See What this release does not contain.
Release 2026.07.22 is withdrawn. An audit found label and realism defects in families it was built from. Do not report scores against it. See Corrections and ground-truth disputes.
A SAST tool is only as trustworthy as its measured performance, and measuring that performance
requires ground truth. BenchProctor provides cases labeled vulnerable or safe, so you can score
compatible SARIF 2.1.0 output and calculate its true-positive rate, false-positive rate, and
Youden's J.
# 1. clone this repository; the current release is in Benchmarks/
# 2. scan one framework generation's testcode and export SARIF 2.1.0
your-tool scan Benchmarks/standalone/java/spring/testcode --format sarif -o results.sarif
# 3. score against its answer key (standard-library Python, zero dependencies)
python Benchmarks/standalone/java/score_sarif.py results.sarif \
Benchmarks/standalone/java/spring/expectedresults-2026.11.22.csv
# 4. read category-averaged and flat-aggregate TPR, FPR, and Youden's Jspring is the modern generation; spring-lts and spring-legacy beside it are scanned and
scored the same way, each against its own answer key. The scorer recovers each finding's CWE from
the SARIF ruleId, the result or rule properties or tags (for example
external/cwe/cwe-089), or CWE taxa. This supports many common SARIF encodings without
configuration. If your tool emits no CWE, add --match-mode filename (any finding on a vulnerable
file counts; this rewards over-flagging, so prefer the default). The same score_sarif.py ships in
every standalone language folder. The applications have their own scorer; see
Applications.
Many existing public SAST benchmarks exhibit one or more of these structural limitations:
- Fixed and unchanging cases. A static set of human-written cases can encourage benchmark-specific tuning over time, making results less indicative of generalization to unseen code.
- Labels encoded in filenames. When a test lives at
sqli/Test01729_true_positive.java, a scanner can score well by matching the path rather than analyzing the code. - Limited structural coverage. Many suites focus on one language and single-file findings, without testing a flow that crosses a service boundary.
- One framework release. Code in the field spans several releases of each framework and runtime, and an analyzer that only knows the newest APIs misses the older ones.
BenchProctor reduces exact-case memorization and label leakage by construction, covers 11 languages in more than one generation each, and adds multi-service applications whose flows cross a process boundary.
| Release | 2026.11.22 |
| Standalone cases | 15,372: 7,686 vulnerable and 7,686 safe |
| Languages | 11: Java, Python, Go, Rust, TypeScript, JavaScript, PHP, Ruby, Bash, C, C++ |
| Framework targets | 21 (see the table below) |
| API generations | 46 folders over the 21 targets: 21 legacy, 4 long-term support, 21 modern (see Generations) |
| Weakness classes | 25, mapped to 25 distinct CWE IDs |
| Sampling | 20 vulnerable + 20 safe cases for every framework and class pair (30 + 30 in C, 24 + 24 in C++), split across the framework's generations: 366 pairs |
| Applications | 368 two-service applications over 6 service graphs, in TypeScript, JavaScript, Python, Java and C++, each written in one generation of both services |
| Application flows | 5,284 labeled flows: 1,460 vulnerable and 3,824 safe |
| Difficulty | easy and medium |
Every framework and class pair is balanced exactly, and so is every generation folder. Under Youden's J, a flag-everything tool scores 0 because its true-positive and false-positive rates are both 100%. Some cases use shared runtime or companion files required by their language or framework; these files are not scored separately.
This is a curated release, and it is deliberately narrow. It does not contain:
- Cases built around an ineffective safeguard. In this release a vulnerable case has no safeguard, and a safe case has one that works. A tool that treats the presence of any safeguard as proof of safety is not penalized here.
- The deepest propagation patterns. Flows use direct and medium-depth propagation only.
- Frameworks, weakness classes and application shapes beyond the lists on this page.
Read a score on this release as a floor check on broadly known classes, not as a full assessment.
- Combinatorial, not hand-written. Each class models security-relevant behavior using the applicable components of four axes: where untrusted input enters (source), how it travels (propagator), what would neutralize it (sanitizer or safeguard), and the dangerous operation it reaches (sink). A vulnerable case omits the safeguard; its safe counterpart applies an effective one. Every emitted case is constrained to a valid, analyzable path using real language and framework APIs.
- Synthetic by design. The corpus intentionally isolates scoring-relevant security properties. Individual cases use real APIs but are not intended to represent complete production features.
- Anti-leakage by construction. Emitted files carry no comments, no CWE tags, no category names, or label-bearing identifiers. File IDs are shuffled, so filenames do not encode a case's class or label. The CSV answer keys are the only published source of labels.
- Several sink forms per class. Each class ends in at least three distinct sink statements per side (for SQL injection, a prepared statement built by concatenation and an ORM raw query beside the plain query), with no form above 60% of a side. The exceptions are documented in the changelog: Bash weak cipher and XML external entity, JavaScript and TypeScript deserialization, and the share of PHP deserialization's safe side.
- Generations. A class is written in each generation of its framework the way that line writes it: its framework release, language level and library APIs, including the deprecated APIs an older line still uses. The labels and controls are the same in every generation.
- Exact, vetted dependencies. Every dependency manifest pins exact versions, the Node
services ship a
package-lock.json, the Python services a hashed lock, and every container image is pinned by tag and digest. Versions are the newest stable release of their line published on or before 2026-10-22; a later release is taken only where it fixes a published advisory. The legacy and long-term-support generations keep their line's own releases, so a dependency scanner reports the advisories open in those lines: they are part of what such code looks like in the field, and they are not part of the ground truth. - Seed rotation. Each release is drawn with its own seed. A new release keeps the same languages, frameworks, classes and difficulty, and emits different combinations and identifiers. This limits the usefulness of exact-file and filename memorization and is designed to support cross-release score comparability. Structural generalization across releases remains possible and is expected.
| Language | Framework targets | Targets | Classes per target | Cases |
|---|---|---|---|---|
| Java | Spring, Jakarta EE | 2 | 18 | 1,440 |
| Python | Flask, Django, FastAPI | 3 | 18 | 2,160 |
| Go | Gin, net/http | 2 | 15 | 1,200 |
| Rust | Actix-web, Axum | 2 | 15 | 1,200 |
| TypeScript | NestJS, Express | 2 | 18 | 1,440 |
| JavaScript | Express, Koa | 2 | 18 | 1,440 |
| PHP | Laravel, Symfony | 2 | 18 | 1,440 |
| Ruby | Rails, Sinatra | 2 | 17 | 1,360 |
| C++ | cpp-httplib, standalone | 2 | 22 | 2,112 |
| C | standalone | 1 | 19 | 1,140 |
| Bash | standalone | 1 | 11 | 440 |
| Total | 21 | 25 in union | 15,372 |
A framework target carries the classes that occur in its language. C and C++ include memory-safety classes; the managed languages do not.
Each framework target is drawn in each of its API generations, and each generation is its own
folder with its own answer key, build files and dependency pins: <framework> is the modern line,
<framework>-lts the long-term-support line where the project has one, and <framework>-legacy
an older line that is still widely deployed. A target's depth is split across its generations (10
and 10 per side over two, 7, 7 and 6 over three; 15 and 15 in C, 12 and 12 in C++), and each
generation is drawn separately, so the folders hold different cases.
| Target | Legacy | Long-term support | Modern |
|---|---|---|---|
| Java Spring | Spring Boot 2.7, Java 11, javax.* |
Spring Boot 3.5, Java 21 | Spring Boot 4.1, Java 25 |
| Java Jakarta EE | Java EE 8 (JAX-RS 2.1, Servlet 4, Jersey 2), Java 11 | Jakarta EE 10, Java 21 | Jakarta EE 11, Java 25 |
| Python Django | Django 4.2 | Django 5.2 LTS | Django 6.1 |
| Python Flask | Flask 2.3, Werkzeug 2.3 | Flask 3.1 | |
| Python FastAPI | FastAPI 0.99 with pydantic 1 | FastAPI 0.161 with pydantic 2 | |
| PHP Symfony | Symfony 5.4 | Symfony 7.4 LTS | Symfony 8.1 |
| PHP Laravel | Laravel 10, PHP 8.1 | Laravel 13, PHP 8.5 | |
| Ruby Rails | Rails 7.1, Ruby 3.2 | Rails 8.1, Ruby 4.0 | |
| Ruby Sinatra | Sinatra 3, Rack 2 | Sinatra 4, Rack 3 | |
| JavaScript Express | Express 4, Node 20 | Express 5, Node 24 | |
| JavaScript Koa | Koa 2 | Koa 3 | |
| TypeScript Express | Express 4, TypeScript 5 | Express 5, TypeScript 7 | |
| TypeScript NestJS | NestJS 10 on Express 4 | NestJS 12 | |
| Go Gin, net/http | a go 1.20 module: io/ioutil, interface{}, seeded math/rand |
Go 1.27: any, math/rand/v2, the standard library's pbkdf2 and sha3 |
|
| Rust Actix-web, Axum | edition 2021, rand 0.8, RustCrypto 0.10 | edition 2024, rand 0.10, RustCrypto 0.11 | |
| C | C99 | C17 | |
| C++ | C++14, POSIX file calls in place of std::filesystem |
C++20 | |
| Bash | bash 3.2 idioms (backquotes, case globs, expr) |
bash 5 |
Each language folder's README lists the line of every folder it holds.
"Standalone" means one file per case, not free of dependencies. The C and C++ standard libraries
have no SQL, HTTP, cryptography or message-queue API, so some cases call a library: 239 of the 1,140
C cases include SQLite, libcurl or OpenSSL headers, and 18 of the 2,112 C++ cases include the
hiredis or RabbitMQ C client headers. A tool that compiles the cases, or resolves their #include lines, needs those
libraries' development headers:
- Fedora / RHEL:
dnf install openssl-devel sqlite-devel libcurl-devel hiredis-devel librabbitmq-devel - Debian / Ubuntu:
apt install libssl-dev libsqlite3-dev libcurl4-openssl-dev libhiredis-dev librabbitmq-dev
Each standalone language folder's README and benchproctor-manifest.json list exactly which
libraries its cases include. No label depends on a header version.
| Class | CWE | Class | CWE |
|---|---|---|---|
| SQL injection | CWE-89 | Server-side request forgery | CWE-918 |
| OS command injection | CWE-78 | Code injection | CWE-94 |
| Path traversal | CWE-22 | Deserialization of untrusted data | CWE-502 |
| Cross-site scripting | CWE-79 | XML external entity | CWE-611 |
| LDAP injection | CWE-90 | Open redirect | CWE-601 |
| XPath injection | CWE-643 | Integer overflow | CWE-190 |
| Weak cipher | CWE-327 | NULL pointer dereference | CWE-476 |
| Weak hash | CWE-328 | Stack-based buffer overflow | CWE-121 |
| Weak random | CWE-330 | Heap-based buffer overflow | CWE-122 |
| Cookie without the secure attribute | CWE-614 | Buffer over-read | CWE-126 |
| Trust boundary violation | CWE-501 | Use after free | CWE-416 |
| Double free (C, C++) | CWE-415 | Memory leak (C, C++) | CWE-401 |
| Use of uninitialized variable (C, C++) | CWE-457 |
An application is a small project made of two services that call each other over HTTP, each with
its own container file. One primary flow starts at the entry service and ends at a sink in the
backend service. Further single-file flows, vulnerable and safe, and plain safe modules sit
around it, all of them labeled, so a tool has to tell the flows that matter from the code that
surrounds them. Each application also carries a docker-compose.yml. Each application is written
in one generation of both its services, and each graph's applications are split between the
legacy and the modern generation; an application's build files and container images name the
releases it targets.
| Service graph | Applications | Flows | Vulnerable | Safe |
|---|---|---|---|---|
| Express (TypeScript) to Flask | 64 | 920 | 255 | 665 |
| NestJS to Spring | 64 | 917 | 252 | 665 |
| Express (JavaScript) to Django | 64 | 920 | 255 | 665 |
| Express (TypeScript) to cpp-httplib | 48 | 691 | 192 | 499 |
| FastAPI to Spring | 64 | 918 | 253 | 665 |
| Jakarta EE to NestJS | 64 | 918 | 253 | 665 |
| Total | 368 | 5,284 | 1,460 | 3,824 |
Applications are built around six classes (SQL injection, cross-site scripting, OS command injection, server-side request forgery, path traversal, deserialization) and two two-stage chains (an unauthenticated entry leading to cross-site scripting, and an unvalidated URL leading to server-side request forgery, whose entry service checks the destination against an allowlist when the chain is blocked). The C++ graph carries six of the eight: it has no deserialization application and no unvalidated-URL chain. In half of the applications the chain completes; in the other half a control on the path holds.
your-tool scan Benchmarks/applications/nestjs-spring/applications --format sarif -o results.sarif
python Benchmarks/applications/score_apps.py \
--flows Benchmarks/applications/nestjs-spring/expectedresults-2026.11.22.csv \
--chains Benchmarks/applications/nestjs-spring/expectedresults-chains-2026.11.22.csv \
--tool-sarif results.sarifscore_apps.py reports three numbers side by side and never averages them: whether each flow was
judged correctly (Youden's J), whether the right CWE was named for the flows judged correctly, and
how much of the service graph the tool reconstructed.
Every standalone case carries a ground-truth label (vulnerable or safe) in a CSV answer key.
After a tool runs, scoring computes a confusion matrix and one subtraction:
detected ignored
vulnerable TP FN
safe FP TN
TPR = TP / (TP + FN) detection rate
FPR = FP / (FP + TN) false-alarm rate
J = TPR - FPR Youden's J (the score)
| Score | Meaning |
|---|---|
| +100% | Perfect: catches everything, zero false alarms |
| 0% | No measured discrimination: TPR equals FPR; flag-everything and flag-nothing both land here |
| -100% | Inverted: flags safe code, misses real bugs |
Scores are reported in two forms. The category-averaged headline score weights each class equally so large classes cannot dominate; the flat aggregate score weights every case equally. Each generation folder is scored against its own answer key (test names restart in every folder). With ten cases per side in a folder, one case moves that folder's score for a class by ten points (about fifteen with seven per side) and its headline score by under one point, so per-class scores carry real signal. Any tool that emits compatible SARIF 2.1.0 can be scored; both scorers are single standard-library Python files with no dependencies.
A tool that does not attempt some classes can declare its scope. --skip-categories ldapi,sqli
leaves those classes out of the score, and --categories null_deref,use_after_free scores only
the listed ones; the summary names every class left out, so a scoped score is never mistaken for
a full one. These options are in scripts/score_sarif.py and in the copy bundled in every language
folder.
Before release, every source file in this release was put through the native toolchain for its language and generation. Nothing was sampled:
- Java: every standalone file compiled with
javac, one run per framework and generation at that generation's Java release (11, 21 or 25). - Python: every standalone file parsed, and every case checked for undefined names.
- Go:
go buildandgo vetover each generation's module. - Rust:
cargo checkover each generation's crate, against its locked dependencies. - TypeScript:
tscin strict mode over every TypeScript source file, standalone and applications, with TypeScript 5.9 for the legacy generation and 7.0 for the modern one. - JavaScript, PHP, Ruby, C, C++, Bash: every file, standalone and applications,
syntax-checked with
node --check,php -l,ruby -c,gcc,g++andbash -n, the C and C++ files at their generation's standard (C99 or C17, C++14 or C++20). The C and C++ files were checked with their libraries' development headers installed (see C and C++ prerequisites). - Applications, whole projects: on every service graph, 24 applications (at least one of every
application type and an even sample of the rest, 144 in all), built the way the project builds:
each service's own
Makefilefor C++,mvn compilefor Java, a byte-compile of the Python modules andnode --checkof the JavaScript. The Java services of a further sample of applications were compiled together, application by application.
On top of that, a suite of deterministic gates runs with no AI and no LLM-as-judge: each
vulnerable case must carry a real source-to-sink flow, each safe twin must neutralize it for
that sink, the recorded sink line must match the scored operation, and dozens of further structural
and idiom checks must hold. For the applications, further gates check that each service graph
matches the services on disk and that every vulnerable flow's scored line holds a statement.
Finally, every bundle was scored the way you would score it, with the scorer shipped in it and the answer keys shipped beside the code, against a perfect answer: every standalone folder scores +100%, and on every application graph every flow is judged right, every CWE is named and every service-graph edge is recovered.
The applications were also run. On every service graph and in both generations, applications were
built from their own Dockerfiles, started with their own docker-compose.yml, and sent one request
at the entry service carrying a marker in every input the entry reads. A run counts only when the
marker shows up at the far end of the chain: in the backend service's own log, or, when the scored
sink is a database query, in the database's own statement log. The applications tried first are
those whose primary flow carries the request to the backend unchanged, and one that does not build
or start, or whose entry refuses or fails the request, fails its graph at once. Eleven of the twelve
graph and generation pairs passed. On the legacy generation of Express (TypeScript) to cpp-httplib,
no candidate backend's sink writes anything a log can show (a socket connect, a file open, an HTML
write), so no run there can pass; a copy of one of those applications with a single print added at
the sink showed the marker arriving at the backend. Every TypeScript service of the applications was
also installed from its own lockfile and type-checked with its own compiler against the installed
type packages.
Published bundles contain test code, required support artifacts, CSV answer keys, the scorers, manifests, checksums, and documentation. Internal per-case proof metadata and the perfect-score oracle SARIF used for self-verification are deliberately not published. The CSVs are the sole published source of labels; test files contain no proof markers or label metadata from which those labels can be inferred.
The current release is published as plain files under Benchmarks/: one folder per language under
Benchmarks/standalone/ and one for the applications under Benchmarks/applications/, 27,529
files in all (76.1 MiB), every folder release 2026.11.22. Benchmarks/SHASUMS256.txt lists the
SHA-256 of every file; from Benchmarks/, sha256sum -c SHASUMS256.txt checks them all.
Each standalone language folder holds one folder per framework and generation, each with a
testcode/ directory and its expectedresults-<version>.csv answer key, plus the bundled
score_sarif.py, a benchproctor-manifest.json (version, per-folder counts, generation and line,
SHA-256 checksums of the answer keys and the scorer, and the libraries the C and C++ cases include),
and a README. Each folder also carries its language's dependency manifest for that generation,
derived from what its cases import and pinned to exact versions: pom.xml (Java), go.mod and
go.sum (Go), Cargo.toml (Rust), requirements.txt (Python), package.json
(JavaScript, TypeScript), composer.json (PHP) or a Gemfile (Ruby), so a tool that resolves
types can install exactly the packages the cases use. The applications folder holds one directory
per service graph with its applications/, its two answer-key CSVs, and score_apps.py; every
service carries its own Dockerfile and dependency manifest, and its lockfile where its language
has one.
Earlier releases are kept under archive/ as one zip per release:
archive/<version>.zip holds a <version>/ folder with that release's files and its own
SHASUMS256.txt, and archive/SHASUMS256.txt lists the SHA-256 of every zip. The zips are
written byte for byte reproducibly, so the same files always give the same zip.
Ground-truth defects are possible and must be handled in the open.
A ground-truth challenge should identify the affected case, its published label, and the semantic basis for disputing that label. Confirmed defects are traced to and corrected in the generator or template wherever possible, and every affected family is regenerated.
A published release is never silently replaced. A correction ships as a new release whose changelog identifies the affected families, the cause and the correction, and the direction of any label change.
Release 2026.07.22 (2,938,418 cases) is withdrawn as a whole, and its bundles are no longer distributed: they were removed from this repository together with its history. An audit before this release found the following in families it was built from:
- A wrong
safelabel on 314 cases. Some safe SQL injection cases guarded the value with a character allowlist and then placed it unquoted in the statement. An allowlist of identifier characters does not protect an unquoted value: the inputidturnsWHERE id = idinto a condition that matches every row. A scan of every file in the withdrawn bundles found 314 such cases, all in the SQL injection class: 116 in Java and 198 in Python, and none in the other nine languages. By size:quicktest58,normal87,enterprise169. Direction of the change:safecases that should have beenvulnerable. The value is now quoted. - Safe cases whose dangerous line could never run. A value was wrapped in fixed text and then checked as a whole, so the check rejected every input. The label was right and the case tested nothing. This release leaves those propagation forms out.
- Entry points that cannot occur. Some request handlers in Java, Rust and Ruby read command-line input. No label was wrong, but the flow could not happen in a deployed service.
- Unidiomatic Java. Unused imports, a persistence factory built on every request, and repository types declared inside a handler. No label was affected.
Only the first item changed a label. Scores reported against 2026.07.22 should not be compared with scores on any later release.
Release 2026.11.22 is the current release, in Benchmarks/; earlier releases are under
archive/. The scorers in scripts/ use only the Python standard library: clone the repository, point a scorer at a corpus and your SARIF, and read the resulting
metrics. The release history is in changelog.md, and a step-by-step guide is in
usage.md.
Apache License 2.0, see LICENSE. Created and maintained by Code Reality Labs (https://coderealitylabs.com).