diff --git a/bench/tasks/java-jwt-none-deserialize/answer.yaml b/bench/tasks/java-jwt-none-deserialize/answer.yaml new file mode 100644 index 0000000..fb78c2c --- /dev/null +++ b/bench/tasks/java-jwt-none-deserialize/answer.yaml @@ -0,0 +1,24 @@ +issues: + - id: java-deserialize-objectinputstream-001 + file: AuthService.java + severity: HIGH + cwe: CWE-502 + vulnSlugs: [java-deserialize-objectinputstream, rce-deserialization] + location: { startLine: 9, endLine: 10, tolerance: 2 } + scanner: { mustEmitCandidate: true } + - id: java-jwt-none-001 + file: AuthService.java + severity: HIGH + cwe: CWE-347 + vulnSlugs: [java-jwt-none] + location: { startLine: 18, endLine: 18, tolerance: 2 } + scanner: { mustEmitCandidate: true } +decoys: + - id: java-json-parse-decoy + file: AuthService.java + line: 14 + forbiddenSlugs: [java-deserialize-objectinputstream, rce-deserialization] + - id: java-jwt-hmac256-decoy + file: AuthService.java + line: 22 + forbiddenSlugs: [java-jwt-none] diff --git a/bench/tasks/java-jwt-none-deserialize/source/AuthService.java b/bench/tasks/java-jwt-none-deserialize/source/AuthService.java new file mode 100644 index 0000000..2d3dd61 --- /dev/null +++ b/bench/tasks/java-jwt-none-deserialize/source/AuthService.java @@ -0,0 +1,26 @@ +package com.example.auth; + +import com.auth0.jwt.JWT; +import com.auth0.jwt.algorithms.Algorithm; + +public class AuthService { + + public Object restoreSessionVulnerable(byte[] bytes) throws Exception { + var ois = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bytes)); + return ois.readObject(); + } + + public Object restoreSessionSafe(String json) throws Exception { + return JsonParser.parse(json); + } + + public String verifyTokenVulnerable(String token) { + return JWT.require(Algorithm.none()).build().verify(token).getSubject(); + } + + public String verifyTokenSafe(String token, String secret) { + return JWT.require(Algorithm.HMAC256(secret)).build().verify(token).getSubject(); + } + + static class JsonParser { static Object parse(String s) { return s; } } +} diff --git a/bench/tasks/java-jwt-none-deserialize/source/pom.xml b/bench/tasks/java-jwt-none-deserialize/source/pom.xml new file mode 100644 index 0000000..6356b9a --- /dev/null +++ b/bench/tasks/java-jwt-none-deserialize/source/pom.xml @@ -0,0 +1,7 @@ + + + 4.0.0 + com.example + auth-fixture + 0.0.1 + diff --git a/bench/tasks/java-jwt-none-deserialize/task.toml b/bench/tasks/java-jwt-none-deserialize/task.toml new file mode 100644 index 0000000..f8f55a7 --- /dev/null +++ b/bench/tasks/java-jwt-none-deserialize/task.toml @@ -0,0 +1,9 @@ +[provenance] +source = "handcraft" +added_at = "2026-05-14" +reviewer = "@noeljackson" +review_due = "2027-05-14" +notes = "Under-covered Phase-2 language fixture per CLAUDE.md project invariant. Java JWT alg=none + native ObjectInputStream.readObject deserialization." + +[labels] +change_rule = "freeze" diff --git a/bench/tasks/kotlin-jdbc-runtime-exec/answer.yaml b/bench/tasks/kotlin-jdbc-runtime-exec/answer.yaml new file mode 100644 index 0000000..b588c54 --- /dev/null +++ b/bench/tasks/kotlin-jdbc-runtime-exec/answer.yaml @@ -0,0 +1,20 @@ +issues: + - id: kt-jdbc-sqli-001 + file: UserDao.kt + severity: HIGH + cwe: CWE-89 + vulnSlugs: [kt-jdbc-string-template-sqli, sql-injection] + location: { startLine: 12, endLine: 12, tolerance: 2 } + scanner: { mustEmitCandidate: true } + - id: kt-runtime-exec-001 + file: UserDao.kt + severity: HIGH + cwe: CWE-78 + vulnSlugs: [kt-runtime-exec-template, command-injection] + location: { startLine: 17, endLine: 17, tolerance: 2 } + scanner: { mustEmitCandidate: true } +decoys: + - id: kt-processbuilder-list-decoy + file: UserDao.kt + line: 22 + forbiddenSlugs: [kt-runtime-exec-template, command-injection] diff --git a/bench/tasks/kotlin-jdbc-runtime-exec/source/UserDao.kt b/bench/tasks/kotlin-jdbc-runtime-exec/source/UserDao.kt new file mode 100644 index 0000000..71fc376 --- /dev/null +++ b/bench/tasks/kotlin-jdbc-runtime-exec/source/UserDao.kt @@ -0,0 +1,26 @@ +package com.example.app + +import java.sql.Connection +import java.sql.Statement +import javax.sql.DataSource + +class UserDao(private val ds: DataSource) { + + fun findVulnerable(name: String): String? { + val c: Connection = ds.connection + val stmt: Statement = c.createStatement() + val rs = stmt.executeQuery("SELECT email FROM users WHERE name = '$name'") + return if (rs.next()) rs.getString(1) else null + } + + fun convertVulnerable(filename: String): Int { + val p = Runtime.getRuntime().exec("convert $filename out.png") + return p.waitFor() + } + + fun convertSafe(filename: String): Int { + val pb = ProcessBuilder("convert", filename, "out.png") + val p = pb.start() + return p.waitFor() + } +} diff --git a/bench/tasks/kotlin-jdbc-runtime-exec/source/build.gradle.kts b/bench/tasks/kotlin-jdbc-runtime-exec/source/build.gradle.kts new file mode 100644 index 0000000..6516175 --- /dev/null +++ b/bench/tasks/kotlin-jdbc-runtime-exec/source/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + kotlin("jvm") version "1.9.0" +} + +dependencies { + implementation("org.postgresql:postgresql:42.7.1") +} diff --git a/bench/tasks/kotlin-jdbc-runtime-exec/task.toml b/bench/tasks/kotlin-jdbc-runtime-exec/task.toml new file mode 100644 index 0000000..186e283 --- /dev/null +++ b/bench/tasks/kotlin-jdbc-runtime-exec/task.toml @@ -0,0 +1,9 @@ +[provenance] +source = "handcraft" +added_at = "2026-05-14" +reviewer = "@noeljackson" +review_due = "2027-05-14" +notes = "Under-covered Phase-3 language fixture per CLAUDE.md project invariant. Kotlin string-template SQLi + Runtime.exec template." + +[labels] +change_rule = "freeze" diff --git a/bench/tasks/swift-process-format/answer.yaml b/bench/tasks/swift-process-format/answer.yaml new file mode 100644 index 0000000..337bc52 --- /dev/null +++ b/bench/tasks/swift-process-format/answer.yaml @@ -0,0 +1,13 @@ +issues: + - id: swift-system-call-001 + file: Tool.swift + severity: HIGH + cwe: CWE-78 + vulnSlugs: [swift-eval-injection, command-injection] + location: { startLine: 4, endLine: 4, tolerance: 2 } + scanner: { mustEmitCandidate: true } +decoys: + - id: swift-system-literal-decoy + file: Tool.swift + line: 8 + forbiddenSlugs: [swift-eval-injection] diff --git a/bench/tasks/swift-process-format/source/Tool.swift b/bench/tasks/swift-process-format/source/Tool.swift new file mode 100644 index 0000000..5c6efce --- /dev/null +++ b/bench/tasks/swift-process-format/source/Tool.swift @@ -0,0 +1,9 @@ +import Foundation + +func runConvertVulnerable(_ tool: String) -> Int32 { + return system(tool) +} + +func runConvertSafe() -> Int32 { + return system("/usr/bin/convert /tmp/in.png /tmp/out.png") +} diff --git a/bench/tasks/swift-process-format/task.toml b/bench/tasks/swift-process-format/task.toml new file mode 100644 index 0000000..57f2fbd --- /dev/null +++ b/bench/tasks/swift-process-format/task.toml @@ -0,0 +1,9 @@ +[provenance] +source = "handcraft" +added_at = "2026-05-14" +reviewer = "@noeljackson" +review_due = "2027-05-14" +notes = "Under-covered Phase-3 language fixture per CLAUDE.md project invariant. Swift Process() command-injection with argv built from input. The companion String(format:) tainted-format matcher landed in a separate fixture because the noise_tier=noisy matcher fires too broadly." + +[labels] +change_rule = "freeze"