Attackers are continuing to target the Jenkins Arbitrary File Read vulnerability (CVE-2024-23897) in ransomware attacks, according to a report from FortiGuard Labs.

Jenkins is an open-source continuous integration (CI) server and a popular DevOps tool used by thousands of development teams. It manages and controls several stages of the software delivery process, including building, automated testing, packaging, and more.

Jenkins has a built-in command-line interface (CLI) that uses the args4j library to parse command arguments and options on the Jenkins controller during CLI command processing.

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 ends up 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.

Schneider Bold
  • 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 end up read depends on available CLI commands. The Jenkins security team 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. Jenkins security team confirmed 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, according to the FortiGuard Labs report.

Additionally, FortiRecon ACI service observed discussions related to CVE-2024-23897 on the Dark Web. Also, a Proof of Concept (PoC) exploit is publicly available which makes this vulnerability crucial for patching and detecting any exploitation activity.

In terms of mitigations, Jenkins 2.442, LTS 2.426.3, and LTS 2.440.1 disables the command parser feature that replaces an @ character followed by a file path in an argument with the file’s contents for CLI commands.

In case of problems with this fix, disable this change by setting the Java system property hudson.cli.CLICommand.allowAtSyntax to true. Doing this, however, ends up strongly discouraged on any network accessible by users who are not Jenkins administrators.

In terms of a workaround, disabling access to the CLI should prevent exploitation completely. This ends up strongly recommended for administrators unable to immediately update to Jenkins 2.442, LTS 2.426.3 or LTS 2.440.1. Applying this workaround does not require a Jenkins restart.

Pin It on Pinterest

Share This