CVE-2024-23897 Elastic Security · Elastic

Detect CVE-2024-23897: Jenkins Arbitrary File Read via CLI Argument Parser (Pre-Auth RCE Chain) in Elastic Security

CVE-2024-23897 is a critical path traversal vulnerability (CWE-22) in Jenkins' built-in CLI argument parser (args4j). The parser expands file contents prefixed with '@' as command arguments, allowing unauthenticated attackers to read arbitrary files from the Jenkins controller filesystem — including secrets, credentials, and SSH keys. When combined with additional weaknesses (e.g., exposed Remember Me tokens or cryptographic keys), this chain enables unauthenticated remote code execution. CVSS 9.8. Actively exploited (CISA KEV). Affects Jenkins <= 2.441 and LTS <= 2.426.2.

MITRE ATT&CK

Tactic
Initial Access Credential Access Execution

Elastic Detection Query

Elastic Security (Elastic)
eql
sequence by source.ip with maxspan=5m
  [network where
    destination.port in (8080, 8443, 443, 80) and
    http.request.method in ("POST", "GET") and
    (
      wildcard(url.path, "*/cli*") or
      wildcard(url.path, "*/remoting/legacy*")
    ) and
    (
      wildcard(url.query, "*@../*") or
      wildcard(url.query, "*@/etc/*") or
      wildcard(url.query, "*@/root*") or
      wildcard(url.query, "*@*secret*") or
      wildcard(url.query, "*@*passwd*") or
      wildcard(url.query, "*@*credentials*") or
      wildcard(url.query, "*@*id_rsa*")
    )
  ]
  [network where
    http.response.status_code in (200, 201, 500) and
    (
      wildcard(url.path, "*/cli*") or
      wildcard(url.path, "*/remoting/legacy*")
    )
  ]
critical severity high confidence

EQL sequence rule detecting CVE-2024-23897 exploitation: correlates an inbound HTTP request to a Jenkins CLI endpoint containing '@'-prefixed path traversal patterns with a subsequent server response within 5 minutes from the same source IP. Response codes 200/201 indicate successful file read; 500 may indicate a parsing error that still revealed file content.

Data Sources

Elastic Network Packet CaptureElastic Agent HTTP IntegrationPacketbeat

Required Tables

logs-network.*packetbeat-*logs-endpoint.events.network-*

False Positives & Tuning

  • Authorized Jenkins CLI scripts using '@' file expansion for legitimate build configuration
  • Internal DevOps tooling that constructs CLI URIs programmatically with file references
  • Penetration testing tooling from authorized IP ranges
  • WAF passthrough of benign scanner traffic against Jenkins instances

Other platforms for CVE-2024-23897


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Unauthenticated Jenkins CLI File Read via args4j @ Expansion

    Expected signal: POST request to /cli with '@/etc/passwd' in body; HTTP 200 response with non-empty body containing passwd file contents; OS-level file open event for /etc/passwd initiated by jenkins process

  2. Test 2Jenkins master.key Extraction for Credential Decryption

    Expected signal: Three sequential POST requests to /cli targeting secrets/master.key, secrets/hudson.util.Secret, and credentials.xml; file access events (auditd/Sysmon) for all three files initiated by the Jenkins JVM process; HTTP 200 responses with non-trivial body sizes

  3. Test 3Jenkins CLI Path Traversal via Remoting Legacy Endpoint

    Expected signal: POST requests to /remoting/legacy and /cli with '@' file arguments; path traversal sequences in URI or body; file access events for .ssh/id_rsa; HTTP responses with key material in body

Unlock Pro Content

Get the full detection package for CVE-2024-23897 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections