Jenkins Security Advisory 2024-08-07

This advisory announces vulnerabilities in the following Jenkins deliverables:

  • Jenkins (core)

Descriptions

Arbitrary file read vulnerability through agent connections can lead to RCE

SECURITY-3430 / CVE-2024-43044
Severity (CVSS): Critical
Description:
This entry was updated on 2024-08-10 to add a reference to a workaround.

Jenkins uses the Remoting library (typically agent.jar or remoting.jar) for the communication between controller and agents. This library allows agents to load classes and classloader resources from the controller, so that Java objects sent from the controller (build steps, etc.) can be executed on agents.

In addition to individual class and resource files, Remoting also allows Jenkins plugins to transmit entire jar files to agents using the Channel#preloadJar API. As of publication of this advisory, this feature is used by the following plugins distributed by the Jenkins project: bouncycastle API, Groovy, Ivy, TeamConcert

In Remoting 3256.v88a_f6e922152 and earlier, except 3206.3208.v409508a_675ff and 3248.3250.v3277a_8e88c9b_, included in Jenkins 2.470 and earlier, LTS 2.452.3 and earlier, calls to Channel#preloadJar result in the retrieval of files from the controller by the agent using ClassLoaderProxy#fetchJar. Additionally, the implementation of ClassLoaderProxy#fetchJar invoked on the controller does not restrict paths that agents could request to read from the controller file system.

This allows agent processes, code running on agents, and attackers with Agent/Connect permission to read arbitrary files from the Jenkins controller file system.

This is a critical vulnerability as the information obtained can be used to increase access up to and including remote code execution (RCE). See SECURITY-3314 for known impacts of exploiting arbitrary file read vulnerabilities in Jenkins. Be aware that the limitation of unreadable binary data with some character encodings discussed in SECURITY-3314 does not apply to SECURITY-3430.

Fix Description:
The Remoting library in Jenkins 2.471, LTS 2.452.4, LTS 2.462.1 now sends jar file contents with Channel#preloadJar requests, the only use case of ClassLoaderProxy#fetchJar in agents, so that agents do not need to request jar file contents from controllers anymore.

To retain compatibility with older versions of Remoting in combination with the plugins listed above, ClassLoaderProxy#fetchJar is retained and otherwise unused, just deprecated. Its implementation in Jenkins 2.471, LTS 2.452.4, LTS 2.462.1 was changed so that it is now limited to retrieving jar files referenced in the core classloader or any plugin classloader.

To protect from exploitation, the presence of the fix is only required to be installed on the controller. Agents with older versions of remoting can still be used safely.
In case of problems with Channel#preloadJar on older Remoting clients, administrators can disable this protection by setting the Java system property hudson.remoting.Channel.DISABLE_JAR_URL_VALIDATOR on the controller to true. This is only advisable if code running on agents, including build scripts and test code from SCM, is as trusted as Jenkins administrators.
Administrators who want to prohibit jar requests by agents through ClassLoaderProxy#fetchJar entirely can set the Java system property jenkins.security.s2m.JarURLValidatorImpl.REJECT_ALL on the controller to true. This may break some features of the plugins listed above on agents running older versions of Remoting. If you use affected functionality of the plugins identified above, agents should be updated to a version of remoting matching the version on the controller.

Workaround:
A workaround for this issue is available on GitHub for administrators unable to immediately update. It will disable the affected Channel#preloadJar functionality, and is therefore incompatible with the affected functionality of the plugins mentioned above.

We recommend that you watch at least new releases in this repository to be informed of updates to the workaround.

Missing permission check allows accessing other users' "My Views"

SECURITY-3349 / CVE-2024-43045
Severity (CVSS): Medium
Description:

Jenkins 2.470 and earlier, LTS 2.452.3 and earlier does not perform a permission check in an HTTP endpoint.

This allows attackers with Overall/Read permission to access other users' "My Views". Attackers with global View/Configure and View/Delete permissions are also able to change other users' "My Views".

Jenkins 2.471, LTS 2.452.4, LTS 2.462.1 restricts access to a user’s "My Views" to the owning user and administrators.

Severity

Affected Versions

  • Jenkins weekly up to and including 2.470
  • Jenkins LTS up to and including 2.452.3

Fix

  • Jenkins weekly should be updated to version 2.471
  • Jenkins LTS should be updated to version 2.452.4 or 2.462.1

These versions include fixes to the vulnerabilities described above. All prior versions are considered to be affected by these vulnerabilities unless otherwise indicated.

Credit

The Jenkins project would like to thank the reporters for discovering and reporting these vulnerabilities:

  • Daniel Beck, CloudBees, Inc. for SECURITY-3349
  • jiangchenwei (Nebulalab) and yangyue (Nebulalab) for SECURITY-3430