
Unauthenticated arbitrary file read exploit for Jenkins CVE-2024-23897, with HTTPS and CSRF-crumb support to bypass hardened instances.
cve-2024-23897-crumb.py — unauthenticated arbitrary file read against
Jenkins <= 2.441 / LTS <= 2.426.2 (fixed in 2.442 / LTS 2.426.3).
The widely-used PoCs — exploit-db 51993, xaitax/CVE-2024-23897, and the ProjectDiscovery nuclei template — are HTTP-only and send no CSRF crumb. Against a Jenkins instance that is:
they fail with 403 No valid crumb was included in the request, which is
indistinguishable from "patched" and produces a false negative.
This variant:
--http);JSESSIONID from the unauthenticated
/cli error page, then replays them on the duplex channel;Net effect: it detects and exploits hardened-but-unpatched instances that the public tooling reports as safe.
python3 cve-2024-23897-crumb.py <host> [file] [--http] [--port N]
python3 cve-2024-23897-crumb.py jenkins.example.com
python3 cve-2024-23897-crumb.py jenkins.example.com /etc/shells
python3 cve-2024-23897-crumb.py 10.0.0.5 /etc/passwd --http --port 8080
Python 3 standard library only. Read-only: sends help "@<file>"; nothing is
written, uploaded, or executed.
help echoes a file's leading line(s) — the first line in the
Too many arguments: message plus following lines in the (default: ...)
field. Works well on files whose first line carries several fields or is long:
/etc/passwd, /etc/shells/proc/net/arp, /proc/net/route (internal IPs, gateway, MACs)/proc/mounts (container/storage layout)Files with a very short first line (e.g. /etc/hostname) fall through to an
auth-error path and return nothing via help. Whole-file extraction uses the
connect-node command instead, but that requires the anonymous user to hold
Overall/Read — often not granted, in which case the read primitive still works
but only the leading lines come back.
Point it only at hosts you are authorised to test. The same channel exposes
state-changing CLI commands (enable-job, reload-configuration, …); this
script deliberately uses only the read-only help path.