CloudBees Security Advisory 2023-03-08

This advisory announces vulnerabilities in CloudBees CI, CloudBees Jenkins Platform and Jenkins

Descriptions

XSS vulnerability in plugin manager

SECURITY-3037 / CVE-2023-27898
Severity (CVSS): High
Description:

Jenkins 2.270 through 2.393 (both inclusive), LTS 2.277.1 through 2.375.3 (both inclusive) does not escape the Jenkins version a plugin depends on when rendering the error message stating its incompatibility with the current version of Jenkins in the plugin manager.

This results in a stored cross-site scripting (XSS) vulnerability exploitable by attackers able to provide plugins to the configured update sites and have this message shown by Jenkins instances.

Exploitation does not require the manipulated plugin to be installed.

Jenkins 2.394, LTS 2.375.4, and LTS 2.387.1 escapes the Jenkins version a plugin depends on when rendering the error message stating its incompatibility with the current version of Jenkins.

CloudBees update sites no longer publish plugin releases with invalid Jenkins core dependencies since 2023-03-02. This prevents exploitation through the update sites.

Temporary plugin file created with insecure permissions 

SECURITY-2823 / CVE-2023-27899
Severity (CVSS): High
Description:

Jenkins creates a temporary file when a plugin is uploaded from an administrator’s computer.

Jenkins 2.393 and earlier, LTS 2.375.3 and earlier creates this temporary file in the system temporary directory with the default permissions for newly created files.

If these permissions are overly permissive, they may allow attackers with access to the Jenkins controller file system to read and write the file before it is installed in Jenkins, potentially resulting in arbitrary code execution.

Warning: This vulnerability only affects operating systems using a shared temporary directory for all users (typically Linux). Additionally, the default permissions for newly created files generally only allows attackers to read the temporary file.

Jenkins 2.394, LTS 2.375.4, and LTS 2.387.1 creates the temporary file with more restrictive permissions.

As a workaround, you can set a different path as your default temporary directory using the Java system property java.io.tmpdir, if you’re concerned about this issue but unable to immediately update Jenkins.

DoS vulnerability in bundled Apache Commons FileUpload library 

SECURITY-3030 / CVE-2023-24998 (upstream issue), CVE-2023-27900 (MultipartFormDataParser), CVE-2023-27901 (StaplerRequest)
Severity (CVSS): Medium
Description:

Jenkins 2.393 and earlier, LTS 2.375.3 and earlier is affected by the Apache Commons FileUpload library’s vulnerability CVE-2023-24998. This library is used to process uploaded files via the Stapler web framework (usually through StaplerRequest#getFile) and MultipartFormDataParser in Jenkins.

This allows attackers to cause a denial of service (DoS) by sending crafted requests to HTTP endpoints processing file uploads.

Jenkins 2.394, LTS 2.375.4, and LTS 2.387.1 limits the number of request parts to be processed to 1000. Specific endpoints receiving only simple form submissions have a lower limit.

Warning: While the Apache Commons FileUpload dependency has been updated previously in the 2.392 weekly release, the Jenkins-specific changes in 2.394 are necessary for Jenkins to be protected.

Note: Some Jenkins forms can be very complex, and these limits apply to all fields and not just fields representing uploaded files. As a result, legitimate submissions of complex forms that include (possible) file uploads may be affected by these limits. If that happens, these limits can be changed by setting the Java system properties hudson.util.MultipartFormDataParser.FILEUPLOAD_MAX_FILES and org.kohsuke.stapler.RequestImpl.FILEUPLOAD_MAX_FILES to a bigger value, or to -1 to completely disable them.

Note: These releases of Jenkins also introduce additional Java system properties that can be set to restrict request sizes:

By default, Jenkins does not set these size limits. Setting these system properties can offer additional protection, but comes at a greater risk of impacting legitimate use (e.g., when uploading huge file parameters).

Workspace temporary directories accessible through directory browser 

SECURITY-1807 / CVE-2023-27902
Severity (CVSS): Medium
Description:

Jenkins uses temporary directories adjacent to workspace directories, usually with the @tmp name suffix, to store temporary files related to the build. In pipelines, these temporary directories are adjacent to the current working directory when operating in a subdirectory of the automatically allocated workspace. Jenkins-controlled processes, like SCMs, may store credentials in these directories.

Jenkins 2.393 and earlier, LTS 2.375.3 and earlier shows these temporary directories when viewing job workspaces, which allows attackers with Item/Workspace permission to access their contents.

Jenkins 2.394, LTS 2.375.4, and LTS 2.387.1 does not list these temporary directories in job workspaces.

As a workaround, do not grant Item/Workspace permission to users who lack Item/Configure permission, if you’re concerned about this issue but unable to immediately update Jenkins.

Note: The Java system property hudson.model.DirectoryBrowserSupport.allowTmpEscape can be set to true to restore the previous behavior.

Temporary file parameter created with insecure permissions 

SECURITY-3058 / CVE-2023-27903
Severity (CVSS): Low
Description:

When triggering a build from the Jenkins CLI, Jenkins creates a temporary file on the controller if a file parameter is provided through the CLI’s standard input.

Jenkins 2.393 and earlier, LTS 2.375.3 and earlier creates this temporary file in the default temporary directory with the default permissions for newly created files.

If these permissions are overly permissive, they may allow attackers with access to the Jenkins controller file system to read and write the file before it is used in the build.

Warning: This vulnerability only affects operating systems using a shared temporary directory for all users (typically Linux). Additionally, the default permissions for newly created files generally only allows attackers to read the temporary file.

Jenkins 2.394, LTS 2.375.4, and LTS 2.387.1 creates the temporary file with more restrictive permissions.

As a workaround, you can set a different path as your default temporary directory using the Java system property java.io.tmpdir, if you’re concerned about this issue but unable to immediately update Jenkins.

SECURITY-2120 / CVE-2023-27904
Severity (CVSS): Low
Description:

Jenkins 2.393 and earlier, LTS 2.375.3 and earlier prints an error stack trace on agent-related pages when agent connections are broken. This stack trace may contain information about Jenkins configuration that is otherwise inaccessible to attackers.

Jenkins 2.394, LTS 2.375.4, and LTS 2.387.1 does not display error stack traces when agent connections are broken.

Severity

Fix

  • CloudBees Traditional Platforms should be upgraded to 2.375.4.2 or 2.387.1.2

  • CloudBees Cloud Platforms should be upgraded to 2.375.4.2 or 2.387.1.2

  • CloudBees Jenkins Platform (fixed train, CJP Operations Center and CJP Client Master (2.346.x.0.z)) should be upgraded to 2.346.40.0.8