Proposal: Add Jenkins CLI CVE-2024-23897 detection module
I would like to propose adding a vulnerability detection module for:
CVE-2024-23897 – Jenkins CLI argument expansion arbitrary file read Summary: Jenkins versions ≤ 2.441 are vulnerable to arbitrary file read via @file argument expansion in the CLI. The issue is reachable pre-auth through the Jenkins CLI endpoint. Behavioral Difference In vulnerable versions:
help "@/etc/hosts" causes /etc/hosts contents (e.g., 127.0.0.1 localhost) to appear in the response. In patched versions (≥ 2.442): ERROR: No such command @/etc/hosts. No file content is reflected.
The difference is deterministic and safe to test. Proposed Detection Approach Confirm Jenkins presence (X-Jenkins header or /cli/). Trigger safe probe using @/etc/hosts. Flag vulnerable if common hosts file markers (127.0.0.1, localhost) appear in response. No exploitation, no file writes, detection-only logic. If this aligns with Nettacker’s scope, I would be happy to prepare a PR with a minimal, pure-HTTP implementation.
Please let me know if this would be acceptable..
Hi @Gauravsharma2040, great proposal! The behavioral difference you described (file contents vs "No such command" error) makes this a clean, deterministic detection target.
Are you planning to implement this module yourself? If not, I would like to pick it up.
My proposed approach (two options):
Option A - CLI endpoint detection (YAML module):
- HTTP GET to
/cli/-- check for Jenkins CLI download page markers (jenkins-cli,cli-*.jar,remoting.jar) - This confirms the CLI endpoint is exposed, which is the prerequisite for CVE-2024-23897 exploitation
- Combined with the
X-Jenkinsheader for version context
Option B - Behavioral detection (as you proposed):
- Probe with
help "@/etc/hosts"via the CLI binary protocol - Vulnerable: response contains
127.0.0.1/localhost - Patched:
No such command @/etc/hosts
One consideration: the Jenkins CLI uses a custom binary protocol over HTTP (upload/download requests with session UUID), not simple GET/POST text exchange. Option B is more precise but may require a Python-based module rather than YAML if the binary protocol cannot be expressed in the YAML framework. Option A is simpler and fits the existing YAML module pattern.
I would start with Option A and can extend to Option B if the maintainers prefer behavioral detection.
@arkid15r @securestep9 -- does this align with Nettacker's scope? Would you prefer Option A (endpoint exposure) or Option B (behavioral probe)?
Thanks for the suggestion @mason5052 but even though Option A would confirm the CLI endpoint is exposed, but since it also exists in patched versions it may not be sufficient to deterministically detect CVE-2024-23897. My initial proposal relied on the behavioral difference (help "@/etc/hosts" returning file contents vs "No such command"). Since implementing the CLI binary protocol may not fit cleanly into the YAML module framework, I opened the issue mainly to confirm architectural alignment before proceeding and am waiting for maintainer feedback.