CVE-2024-23897: Jenkins Command Line Interface (CLI) Path Traversal Vulnerability
Jenkins 2.441 and earlier, LTS 2.426.2 and earlier does not disable a feature of its CLI command parser that replaces an '@' character followed by a file path in an argument with the file's contents, allowing unauthenticated attackers to read arbitrary files on the Jenkins controller file system.
Other sources
Jenkins Command Line Interface (CLI) contains a path traversal vulnerability that allows attackers limited read access to certain files, which can lead to code execution.
— CISA
Jenkins has a built-in command line interface (CLI) to access Jenkins from a script or shell environment.
Jenkins uses the args4j library to parse command arguments and options on the Jenkins controller when processing CLI commands. This command parser has a feature that replaces an @ character followed by a file path in an argument with the file’s contents (expandAtFiles). This feature is enabled by default and Jenkins 2.441 and earlier, LTS 2.426.2 and earlier does not disable it.
This allows attackers to read arbitrary files on the Jenkins controller file system using the default character encoding of the Jenkins controller process.
Attackers with Overall/Read permission can read entire files.
Attackers without Overall/Read permission can read the first few lines of files. The number of lines that can be read depends on available CLI commands. As of publication of this advisory, the Jenkins security team has found ways to read the first three lines of files in recent releases of Jenkins without having any plugins installed, and has not identified any plugins that would increase this line count.
Binary files containing cryptographic keys used for various Jenkins features can also be read, with some limitations (see note on binary files below). As of publication, the Jenkins security team has confirmed the following possible attacks in addition to reading contents of all files with a known file path. All of them leverage attackers' ability to obtain cryptographic keys from binary files, and are therefore only applicable to instances where that is feasible.
— GitHub
Credit
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/Jenkinsto a version that resolves this vulnerability.Fixed in 2.442 - Upgrade
Upgrade
redhat/Jenkins LTSto a version that resolves this vulnerability.Fixed in 2.426.3 - Upgrade
Upgrade
maven/org.jenkins-ci.main:jenkins-coreto a version that resolves this vulnerability.Fixed in 2.440.1 - Upgrade
Upgrade
maven/org.jenkins-ci.main:jenkins-coreto a version that resolves this vulnerability.Fixed in 2.442 - Upgrade
Upgrade
maven/org.jenkins-ci.main:jenkins-coreto a version that resolves this vulnerability.Fixed in 2.426.3 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.441 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.426.2 - Configuration
Disable the CLI command parser feature that expands an '@' character followed by a file path in a CLI argument into the file’s contents (expandAtFiles). This feature is enabled by default and is not disabled in Jenkins 2.441 and earlier, and in LTS 2.426.2 and earlier.
Jenkins CLI command parser (args4j expandAtFiles) expandAtFiles = disabled
Event History
Frequently Asked Questions
What is the severity of CVE-2024-23897?
CVE-2024-23897 is considered a critical vulnerability due to its potential to allow unauthenticated attackers to read arbitrary files on the Jenkins controller.
How do I fix CVE-2024-23897?
To fix CVE-2024-23897, upgrade Jenkins to version 2.442 or LTS version 2.426.3 immediately.
Which versions of Jenkins are affected by CVE-2024-23897?
CVE-2024-23897 affects Jenkins versions 2.441 and earlier, as well as LTS version 2.426.2 and earlier.
What type of attack does CVE-2024-23897 enable?
CVE-2024-23897 enables unauthenticated attackers to exploit the CLI command parser to read sensitive files on the Jenkins controller.
Is there a workaround for CVE-2024-23897?
There is no official workaround for CVE-2024-23897; immediate upgrading is the recommended action.