Jenkins Security Advisory 2022-05-17

This advisory announces vulnerabilities in the following Jenkins deliverables:

Descriptions

Sandbox bypass vulnerability through implicitly allowlisted platform Groovy files in Pipeline: Groovy Plugin

SECURITY-359 / CVE-2022-30945

Pipeline: Groovy Plugin allows pipelines to load Groovy source files. This is intended to be used to allow Global Shared Libraries to execute without sandbox protection.

In Pipeline: Groovy Plugin 2689.v434009a_31b_f1 and earlier, any Groovy source files bundled with Jenkins core and plugins could be loaded this way and their methods executed. If a suitable Groovy source file is available on the classpath of Jenkins, sandbox protections can be bypassed.

The Jenkins security team has been unable to identify any Groovy source files in Jenkins core or plugins that would allow attackers to execute dangerous code. While the severity of this issue is declared as High due to the potential impact, successful exploitation is considered very unlikely.

Pipeline: Groovy Plugin 2692.v76b_089ccd026 restricts which Groovy source files can be loaded in Pipelines.

Groovy source files in public plugins intended to be executed in sandboxed pipelines have been identified and added to an allowlist. The new extension point org.jenkinsci.plugins.workflow.cps.GroovySourceFileAllowlist allows plugins to add specific Groovy source files to that allowlist if necessary, but creation of plugin-specific Pipeline DSLs is strongly discouraged.

CSRF vulnerability in Script Security Plugin

SECURITY-2116 / CVE-2022-30946

Script Security Plugin 1158.v7c1b_73a_69a_08 and earlier does not require POST requests for a form validation endpoint, resulting in a cross-site request forgery (CSRF) vulnerability.

This vulnerability allows attackers to have Jenkins send an HTTP request to an attacker-specified webserver.

This form validation method no longer sends HTTP requests in Script Security Plugin 1172.v35f6a_0b_8207e.

Multiple SCM plugins can check out from the controller file system

SECURITY-2478 / CVE-2022-30947 (Git), CVE-2022-30948 (Mercurial), CVE-2022-30949 (REPO)

SCMs support a number of different URL schemes, including local file system paths (e.g. using file: URLs).

Historically in Jenkins, only agents checked out from SCM, and if multiple projects share the same agent, there is no expected isolation between builds besides using different workspaces unless overridden. Some Pipeline-related features check out SCMs from the Jenkins controller as well.

This allows attackers able to configure pipelines to check out some SCM repositories stored on the Jenkins controller’s file system using local paths as SCM URLs, obtaining limited information about other projects' SCM contents. The following Jenkins plugins are known to be affected:

Affected plugins have been updated to reject local file paths being checked out on the controller:

Multiple vulnerabilities in Windows Remote Command library in WMI Windows Agents Plugin

SECURITY-2604 / CVE-2022-30950 (buffer overflow), CVE-2022-30951 (access control)

WMI Windows Agents Plugin 1.8 and earlier includes the Windows Remote Command library. It provides a general-purpose remote command execution capability that Jenkins uses to check if Java is available, and if not, to install it.

This library has a buffer overflow vulnerability that may allow users able to connect to a named pipe to execute commands on the Windows agent machine.

Additionally, while the processes are started as the user who connects to the named pipe, no access control takes place, potentially allowing users to start processes even if they’re not allowed to log in.

WMI Windows Agents Plugin 1.8.1 no longer includes the Windows Remote Command library. A Java runtime is expected to be available on agent machines and WMI Windows Agents Plugin 1.8.1 does not install a JDK automatically otherwise.

WMI Windows Agents Plugin is the only Jenkins project deliverable the Jenkins project security team is aware of that includes the Windows Remote Command library.

User-scoped credentials exposed to other users by Pipeline SCM API for Blue Ocean Plugin

SECURITY-714 / CVE-2022-30952

When pipelines are created using the pipeline creation wizard in Blue Ocean, the credentials used are stored in the per-user credentials store of the user creating the pipeline. To allow pipelines to use this credential to scan repositories and checkout from SCM, the Blue Ocean Credentials Provider allows pipelines to access a specific credential from the per-user credentials store in Pipeline SCM API for Blue Ocean Plugin 1.25.3 and earlier.

As a result, attackers with Job/Configure permission can rewrite job configurations in a way that lets them access and capture any attacker-specified credential from any user’s private credentials store.

Pipeline SCM API for Blue Ocean Plugin 1.25.4 deprecates the Blue Ocean Credentials Provider and disables it by default. As a result, all jobs initially set up using the Blue Ocean pipeline creation wizard and configured to use the credential specified at that time will no longer be able to access the credential, resulting in failures to scan repositories, checkout from SCM, etc. unless the repository is public and can be accessed without credentials.

This also applies to newly created pipelines after Pipeline SCM API for Blue Ocean Plugin has been updated to 1.25.4.

Administrators should reconfigure affected pipelines to use a credential from the Jenkins credential store or a folder credential store. See this help page on cloudbees.com to learn more.

To re-enable the Blue Ocean Credentials Provider, set the Java system property io.jenkins.blueocean.rest.impl.pipeline.credential.BlueOceanCredentialsProvider.enabled to true. Doing so is discouraged, as that will restore the unsafe behavior.

While Credentials Plugin provides the Configure Credential Providers UI to enable or disable certain credentials providers, enabling the Blue Ocean Credentials Provider there is not enough in Pipeline SCM API for Blue Ocean Plugin 1.25.4. Both the UI and system property need to enable the Blue Ocean Credentials Provider.

Administrators not immediately able to update Blue Ocean are advised to disable the Blue Ocean Credentials Provider through the UI at Manage Jenkins » Configure Credential Providers and to reconfigure affected pipelines to use a credential from the Jenkins credential store or a folder credential store.

CSRF vulnerability and missing permission checks in Blue Ocean Plugin

SECURITY-2502 / CVE-2022-30953 (CSRF), CVE-2022-30954 (permission check)

Blue Ocean Plugin 1.25.3 and earlier does not perform permission checks in several HTTP endpoints.

This allows attackers with Overall/Read permission to send requests to an attacker-specified URL.

Additionally, these endpoints do not require POST requests, resulting in a cross-site request forgery (CSRF) vulnerability.

Blue Ocean Plugin 1.25.4 requires POST requests and the appropriate permissions for the affected HTTP endpoints.

Missing permission check in GitLab Plugin allows enumerating credentials IDs

SECURITY-2753 / CVE-2022-30955

GitLab Plugin 1.5.31 and earlier does not perform a permission check in an HTTP endpoint.

This allows attackers with Overall/Read permission to enumerate credentials IDs of credentials stored in Jenkins. Those can be used as part of an attack to capture the credentials using another vulnerability.

An enumeration of credentials IDs in GitLab Plugin 1.5.32 requires the appropriate permissions.

Stored XSS vulnerability in Rundeck Plugin

SECURITY-2600 / CVE-2022-30956

Rundeck Plugin 3.6.10 and earlier does not restrict URL schemes in Rundeck webhook submissions.

This results in a stored cross-site scripting (XSS) vulnerability exploitable by attackers able to submit crafted Rundeck webhook payloads.

Rundeck Plugin 3.6.11 sanitizes URLs submitted in Rundeck webhook payloads.

Missing permission check in SSH Plugin allows enumerating credentials IDs

SECURITY-2315 / CVE-2022-30957

SSH Plugin 2.6.1 and earlier does not perform a permission check in an HTTP endpoint.

This allows attackers with Overall/Read permission to enumerate credentials IDs of credentials stored in Jenkins. Those can be used as part of an attack to capture the credentials using another vulnerability.

As of publication of this advisory, there is no fix. Learn why we announce this.

CSRF vulnerability and missing permission checks in SSH Plugin allow capturing credentials

SECURITY-2093 / CVE-2022-30958 (CSRF), CVE-2022-30959 (permission check)

SSH Plugin 2.6.1 and earlier does not perform a permission check in an HTTP endpoint.

This allows attackers with Overall/Read permission to connect to an attacker-specified SSH server using attacker-specified credentials IDs obtained through another method, capturing credentials stored in Jenkins.

Additionally, this endpoint does not require POST requests, resulting in a cross-site request forgery (CSRF) vulnerability.

As of publication of this advisory, there is no fix. Learn why we announce this.

Stored XSS vulnerabilities in multiple plugins providing additional parameter types

SECURITY-2717 / CVE-2022-30960 (Application Detector), CVE-2022-30961 (Autocomplete Parameter), CVE-2022-30962 (Global Variable String Parameter), CVE-2022-30963 (JDK Parameter), CVE-2022-30964 (Multiselect parameter), CVE-2022-30965 (Promoted Builds (Simple)), CVE-2022-30966 (Random String Parameter), CVE-2022-30967 (Selection tasks), CVE-2022-30968 (vboxwrapper)

Multiple plugins do not escape the name and description of the parameter types they provide:

  • Application Detector Plugin 1.0.8 and earlier (SECURITY-2732 / CVE-2022-30960)

  • Autocomplete Parameter Plugin 1.1 and earlier (SECURITY-2729 / CVE-2022-30961)

  • Global Variable String Parameter Plugin 1.2 and earlier (SECURITY-2715 / CVE-2022-30962)

  • JDK Parameter Plugin 1.0 and earlier (SECURITY-2713 / CVE-2022-30963)

  • Multiselect parameter Plugin 1.3 and earlier (SECURITY-2726 / CVE-2022-30964)

  • Promoted Builds (Simple) Plugin 1.9 and earlier (SECURITY-2720 / CVE-2022-30965)

  • Random String Parameter Plugin 1.0 and earlier (SECURITY-2722 / CVE-2022-30966)

  • Selection tasks Plugin 1.0 and earlier (SECURITY-2728 / CVE-2022-30967)

  • vboxwrapper Plugin 1.3 and earlier (SECURITY-2734 / CVE-2022-30968)

This results in stored cross-site scripting (XSS) vulnerabilities exploitable by attackers with Item/Configure permission.

Exploitation of these vulnerabilities requires that parameters are listed on another page, like the "Build With Parameters" and "Parameters" pages provided by Jenkins (core), and that those pages are not hardened to prevent exploitation. Jenkins (core) has prevented exploitation of vulnerabilities of this kind on the "Build With Parameters" and "Parameters" pages since 2.44 and LTS 2.32.2 as part of the SECURITY-353 / CVE-2017-2601 fix. Additionally, several plugins have previously been updated to list parameters in a way that prevents exploitation by default, see SECURITY-2617 in the 2022-04-12 security advisory for a list.

The following plugins have been updated to escape the name and description of the parameter types they provide in the versions specified:

  • Application Detector Plugin 1.0.9

  • Multiselect parameter Plugin 1.4

As of publication of this advisory, there is no fix available for the following plugins:

  • Autocomplete Parameter Plugin 1.1 and earlier (SECURITY-2729 / CVE-2022-30961)

  • Global Variable String Parameter Plugin 1.2 and earlier (SECURITY-2715 / CVE-2022-30962)

  • JDK Parameter Plugin 1.0 and earlier (SECURITY-2713 / CVE-2022-30963)

  • Promoted Builds (Simple) Plugin 1.9 and earlier (SECURITY-2720 / CVE-2022-30965)

  • Random String Parameter Plugin 1.0 and earlier (SECURITY-2722 / CVE-2022-30966)

  • Selection tasks Plugin 1.0 and earlier (SECURITY-2728 / CVE-2022-30967)

  • vboxwrapper Plugin 1.3 and earlier (SECURITY-2734 / CVE-2022-30968)

CSRF vulnerability in Autocomplete Parameter Plugin results in RCE

SECURITY-2322 / CVE-2022-30969

Autocomplete Parameter Plugin 1.1 and earlier does not require POST requests for a form validation endpoint executing a provided Groovy script, resulting in a cross-site request forgery (CSRF) vulnerability.

This vulnerability allows attackers to execute arbitrary code without sandbox protection if the victim is an administrator.

As of publication of this advisory, there is no fix. Learn why we announce this.

Stored XSS vulnerability in Autocomplete Parameter Plugin

SECURITY-2267 / CVE-2022-30970

Autocomplete Parameter Plugin 1.1 and earlier references Dropdown Autocomplete parameter and Auto Complete String parameter names in an unsafe manner from Javascript embedded in view definitions.

This results in a stored cross-site scripting (XSS) vulnerability exploitable by attackers with Item/Configure permission.

While this looks similar to SECURITY-2729, this is an independent problem and exploitable even on views rendering parameters that otherwise attempt to prevent XSS vulnerabilities in parameter names.

As of publication of this advisory, there is no fix. Learn why we announce this.

XXE vulnerability in Storable Configs Plugin

SECURITY-1969 / CVE-2022-30971 (XXE), CVE-2022-30972 (CSRF)

Storable Configs Plugin 1.0 and earlier does not configure its XML parser to prevent XML external entity (XXE) attacks.

This allows attackers with Item/Configure permission to have Jenkins parse a crafted file that uses external entities for extraction of secrets from the Jenkins controller or server-side request forgery.

Additionally, the HTTP endpoint calling the XML parser does not require POST requests, resulting in a cross-site request forgery (CSRF) vulnerability.

As of publication of this advisory, there is no fix. Learn why we announce this.

Severity

Affected Versions

  • Application Detector Plugin up to and including 1.0.8
  • Autocomplete Parameter Plugin up to and including 1.1
  • Blue Ocean Plugin up to and including 1.25.3
  • Git Plugin up to and including 4.11.1
  • GitLab Plugin up to and including 1.5.31
  • Global Variable String Parameter Plugin up to and including 1.2
  • JDK Parameter Plugin up to and including 1.0
  • Mercurial Plugin up to and including 2.16
  • Multiselect parameter Plugin up to and including 1.3
  • Pipeline SCM API for Blue Ocean Plugin up to and including 1.25.3
  • Pipeline: Groovy Plugin up to and including 2689.v434009a_31b_f1
  • Promoted Builds (Simple) Plugin up to and including 1.9
  • Random String Parameter Plugin up to and including 1.0
  • REPO Plugin up to and including 1.14.0
  • Rundeck Plugin up to and including 3.6.10
  • Script Security Plugin up to and including 1158.v7c1b_73a_69a_08
  • Selection tasks Plugin up to and including 1.0
  • SSH Plugin up to and including 2.6.1
  • Storable Configs Plugin up to and including 1.0
  • vboxwrapper Plugin up to and including 1.3
  • WMI Windows Agents Plugin up to and including 1.8

Fix

  • Application Detector Plugin should be updated to version 1.0.9
  • Blue Ocean Plugin should be updated to version 1.25.4
  • Git Plugin should be updated to version 4.11.2
  • GitLab Plugin should be updated to version 1.5.32
  • Mercurial Plugin should be updated to version 2.16.1
  • Multiselect parameter Plugin should be updated to version 1.4
  • Pipeline SCM API for Blue Ocean Plugin should be updated to version 1.25.4
  • Pipeline: Groovy Plugin should be updated to version 2692.v76b_089ccd026
  • REPO Plugin should be updated to version 1.14.1
  • Rundeck Plugin should be updated to version 3.6.11
  • Script Security Plugin should be updated to version 1172.v35f6a_0b_8207e
  • WMI Windows Agents Plugin should be updated to version 1.8.1

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

As of publication of this advisory, no fixes are available for the following plugins:

  • Autocomplete Parameter Plugin
  • Global Variable String Parameter Plugin
  • JDK Parameter Plugin
  • Promoted Builds (Simple) Plugin
  • Random String Parameter Plugin
  • Selection tasks Plugin
  • SSH Plugin
  • Storable Configs Plugin
  • vboxwrapper Plugin

Learn why we announce these issues.

Credit

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

  • Daniel Beck, CloudBees, Inc. for SECURITY-1969, SECURITY-2478
  • Jesse Glick, CloudBees, Inc. for SECURITY-359
  • Kalle Niemitalo, Procomp Solutions Oy for SECURITY-2604
  • Kevin Guerroudj for SECURITY-2267
  • Kevin Guerroudj, CloudBees, Inc. for SECURITY-2600, SECURITY-2753
  • Kevin Guerroudj, CloudBees, Inc., Wadeck Follonier, CloudBees, Inc., and Daniel Beck, CloudBees, Inc. for SECURITY-2717
  • Kevin Guerroudj, Justin Philip, Marc Heyries, Wadeck Follonier, CloudBees, Inc. for SECURITY-2322
  • Long Nguyen, Viettel Cyber Security for SECURITY-2093
  • Tanner Emek from Tinder Security Labs for SECURITY-2502
  • Wadeck Follonier, CloudBees, Inc. for SECURITY-2315