Jenkins Security Advisory 2022-01-12

This advisory announces vulnerabilities in the following Jenkins deliverables:

Descriptions

CSRF vulnerability in build triggers

SECURITY-2558 / CVE-2022-20612
Severity (CVSS): Medium
Description:

Jenkins 2.329 and earlier, LTS 2.319.1 and earlier does not require POST requests for the HTTP endpoint handling manual build requests when no security realm is set, resulting in a cross-site request forgery (CSRF) vulnerability.

This vulnerability allows attackers to trigger build of job without parameters.

Jenkins 2.330, LTS 2.319.2 requires POST requests for the affected HTTP endpoint.

CSRF vulnerability and missing permission checks in Mailer Plugin

SECURITY-2163 / CVE-2022-20613 (CSRF), CVE-2022-20614 (missing permission check)
Severity (CVSS): Medium
Affected plugin: mailer
Description:

Mailer Plugin 391.ve4a_38c1b_cf4b_ and earlier does not perform a permission check in a method implementing form validation.

This allows attackers with Overall/Read access to use the DNS used by the Jenkins instance to resolve an attacker-specified hostname.

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

Mailer Plugin 408.vd726a_1130320 requires POST requests and Overall/Administer permission for the affected form validation method.

Stored XSS vulnerability in Matrix Project Plugin

SECURITY-2017 / CVE-2022-20615
Severity (CVSS): High
Affected plugin: matrix-project
Description:

Matrix Project Plugin 1.19 and earlier does not escape HTML metacharacters in node and label names, and label descriptions.

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

Matrix Project Plugin 1.20 escapes HTML metacharacters in node and label names, and label descriptions.

Missing permission check in Credentials Binding Plugin allows validating secret file credentials IDs

SECURITY-2342 / CVE-2022-20616
Severity (CVSS): Low
Affected plugin: credentials-binding
Description:

Credentials Binding Plugin 1.27 and earlier does not perform a permission check in a method implementing form validation.

This allows attackers with Overall/Read access to validate if a credential ID refers to a secret file credential and whether it’s a zip file.

Credentials Binding Plugin 1.27.1 performs permission checks when validating secret file credentials IDs.

OS command execution vulnerability in Docker Commons Plugin

SECURITY-1878 / CVE-2022-20617
Severity (CVSS): High
Affected plugin: docker-commons
Description:

Docker Commons Plugin 1.17 and earlier does not sanitize the name of an image or a tag.

This results in an OS command execution vulnerability exploitable by attackers with Item/Configure permission or able to control the contents of a previously configured job’s SCM repository.

Docker Commons Plugin 1.18 sanitizes the name of an image or a tag.

Missing permission checks in Bitbucket Branch Source Plugin allow enumerating credentials IDs

SECURITY-2033 / CVE-2022-20618
Severity (CVSS): Medium
Affected plugin: cloudbees-bitbucket-branch-source
Description:

Bitbucket Branch Source Plugin 737.vdf9dc06105be and earlier does not perform permission checks in several HTTP endpoints.

This allows attackers with Overall/Read access 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 Bitbucket Branch Source Plugin 746.v350d2781c184 requires the appropriate permissions.

CSRF vulnerability in Bitbucket Branch Source Plugin allows capturing credentials

SECURITY-2467 / CVE-2022-20619
Severity (CVSS): High
Affected plugin: cloudbees-bitbucket-branch-source
Description:

Bitbucket Branch Source Plugin 737.vdf9dc06105be and earlier does not require POST requests for an HTTP endpoint, resulting in a cross-site request forgery (CSRF) vulnerability.

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

Bitbucket Branch Source Plugin 746.v350d2781c184 requires POST requests for the affected HTTP endpoint.

Missing permission checks in SSH Agent Plugin allow enumerating credentials IDs

SECURITY-2189 / CVE-2022-20620
Severity (CVSS): Medium
Affected plugin: ssh-agent
Description:

SSH Agent Plugin 1.23 and earlier does not perform permission checks in several HTTP endpoints.

This allows attackers with Overall/Read access 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 SSH Agent Plugin 1.23.2 requires the appropriate permissions.

Access key stored in plain text by Metrics Plugin

SECURITY-1624 / CVE-2022-20621
Severity (CVSS): Low
Affected plugin: metrics
Description:

Metrics Plugin 4.0.2.8 and earlier stores access keys unencrypted in its global configuration file jenkins.metrics.api.MetricsAccessKey.xml on the Jenkins controller as part of its configuration.

This access key can be viewed by users with access to the Jenkins controller file system.

Metrics Plugin 4.0.2.8.1 stores access key encrypted once its configuration is saved again.

Additionally, the token value is only displayed once when it is generated.

User passwords transmitted in plain text by Active Directory Plugin

SECURITY-1389 / CVE-2022-23105
Severity (CVSS): Medium
Affected plugin: active-directory
Description:

Active Directory Plugin implements two separate modes: integration with ADSI on Windows, and an OS agnostic LDAP-based mode.

Active Directory Plugin 2.25 and earlier does not encrypt the transmission of data between the Jenkins controller and Active Directory servers unless it is configured to use the OS agnostic LDAP mode and the system property hudson.plugins.active_directory.ActiveDirectorySecurityRealm.forceLdaps is set to true.

This allows attackers able to capture network traffic between the Jenkins controller and Active Directory servers to obtain credentials of users logging into Jenkins, as well as credentials of the manager DN (LDAP mode) or the Windows/Active Directory user Jenkins is running as (ADSI mode).

Active Directory Plugin 2.25.1 adds an option to only connect to Active Directory via TLS/SSL to both modes (ADSI and LDAP). This option is enabled by default for new installations and is now the recommended way to enforce TLS/SSL for connections to Active Directory. Unlike the existing StartTLS option for the LDAP-based mode, it will not proceed using an insecure connection if establishing a TLS/SSL connection fails.

Administrators upgrading from previous versions of the plugin will be shown a warning on the Jenkins UI requesting they update the plugin configuration unless the (now otherwise obsolete) flag hudson.plugins.active_directory.ActiveDirectorySecurityRealm.forceLdaps was set to true.

The plugin exposes configuration of the ADSI flags implementing the TLS/SSL requirement via the system properties hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.ADSI_FLAGS_OVERRIDE and hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.ADSI_PASSWORDLESS_FLAGS_OVERRIDE. See the plugin documentation for further details.
Care needs to be taken when reconfiguring the security realm to not accidentally lock yourself out. See the documentation for advice how to resolve this problem if it occurs.

Non-constant time token comparison in Configuration as Code Plugin

SECURITY-2141 / CVE-2022-23106
Severity (CVSS): Low
Affected plugin: configuration-as-code
Description:

Configuration as Code Plugin 1.55 and earlier does not use a constant-time comparison when checking whether two authentication tokens are equal.

This could potentially allow attackers to use statistical methods to obtain a valid authentication token.

Configuration as Code Plugin 1.55.1 now uses a constant-time comparison when validating authentication tokens.

Path traversal vulnerability in Warnings Next Generation Plugin

SECURITY-2090 / CVE-2022-23107
Severity (CVSS): Medium
Affected plugin: warnings-ng
Description:

Warnings Next Generation Plugin 9.10.2 and earlier does not restrict the name of a file when configuring a custom ID.

This allows attackers with Item/Configure permission to write and read specific files with a hard-coded suffix on the Jenkins controller file system.

Warnings Next Generation Plugin 9.10.3 checks for the presence of prohibited directory separator characters in the custom ID.

Stored XSS vulnerability in Badge Plugin

SECURITY-2547 / CVE-2022-23108
Severity (CVSS): High
Affected plugin: badge
Description:

Badge Plugin allows adding custom build badges with a custom description and optionally a link to a URL.

Badge Plugin 1.9 and earlier does not escape the description and does not check for allowed protocols when creating a badge.

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

Badge Plugin 1.9.1 escapes the description and check for allowed protocols when creating a badge.

Improper credentials masking in HashiCorp Vault Plugin

SECURITY-2213 / CVE-2022-23109
Severity (CVSS): Medium
Affected plugin: hashicorp-vault-plugin
Description:

Pipelines display commands executed in their Pipeline step descriptions and their output in build logs. To mask sensitive output, Pipeline: Groovy Plugin 2.84 and earlier specified an allowlist of known non-sensitive variables and masked everything else. This caused problems, so Pipeline: Groovy Plugin 2.85 and newer expects pipeline steps to explicitly specify that variables are to be treated as sensitive and should be removed from output.

HashiCorp Vault Plugin 3.7.0 and earlier relied on the previous behavior and did not explicitly declare variables as sensitive or redacted them.

This can result in exposure of Vault credentials in Pipeline build logs and Pipeline step descriptions.

HashiCorp Vault Plugin 3.8.0 explicitly masks Vault credentials in build logs and Pipeline step descriptions.

This fix only applies to new builds. Administrators are advised to review build logs and Pipeline metadata files created before HashiCorp Vault Plugin 3.8.0 for the presence of Vault credentials.

Stored XSS vulnerability in Publish Over SSH Plugin

SECURITY-2287 / CVE-2022-23110
Severity (CVSS): Medium
Affected plugin: publish-over-ssh
Description:

Publish Over SSH Plugin 1.22 and earlier does not escape the SSH server name.

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

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

CSRF vulnerability and missing permission checks in Publish Over SSH Plugin

SECURITY-2290 / CVE-2022-23111 (CSRF), CVE-2022-23112 (missing permission check)
Severity (CVSS): Medium
Affected plugin: publish-over-ssh
Description:

Publish Over SSH Plugin 1.22 and earlier does not perform permission checks in methods implementing connection tests.

This allows attackers with Overall/Read access to connect to an attacker-specified SSH server using attacker-specified credentials.

Additionally, these connection tests methods do 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.

Path traversal vulnerability in Publish Over SSH Plugin

SECURITY-2307 / CVE-2022-23113
Severity (CVSS): Medium
Affected plugin: publish-over-ssh
Description:

Publish Over SSH Plugin 1.22 and earlier performs a validation of the file name specifying whether it is present or not.

This results in a path traversal vulnerability allowing attackers with Item/Configure permission to discover the name of the Jenkins controller files.

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

Password stored in plain text by Publish Over SSH Plugin

SECURITY-2291 / CVE-2022-23114
Severity (CVSS): Low
Affected plugin: publish-over-ssh
Description:

Publish Over SSH Plugin 1.22 and earlier stores password unencrypted in its global configuration file jenkins.plugins.publish_over_ssh.BapSshPublisherPlugin.xml on the Jenkins controller as part of its configuration.

This password can be viewed by users with access to the Jenkins controller file system.

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

CSRF vulnerability in batch task Plugin

SECURITY-1025 / CVE-2022-23115
Severity (CVSS): Medium
Affected plugin: batch-task
Description:

batch task Plugin 1.19 and earlier does not require POST requests for several HTTP endpoints, resulting in cross-site request forgery (CSRF) vulnerabilities.

These vulnerabilities allow attackers with Overall/Read access to retrieve logs, build or delete a batch task.

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

Agent-to-controller security bypass in Conjur Secrets Plugin allows decrypting secrets

SECURITY-2522 (1) / CVE-2022-23116
Severity (CVSS): Medium
Affected plugin: conjur-credentials
Description:

Conjur Secrets Plugin 1.0.9 and earlier implements functionality that allows agent processes to obtain the plain text of any attacker-provided encrypted secret.

This allows attackers able to control agent processes to decrypt secrets stored in Jenkins obtained through another method.

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

Agent-to-controller security bypass in Conjur Secrets Plugin allows retrieving all credentials

SECURITY-2522 (2) / CVE-2022-23117
Severity (CVSS): Medium
Affected plugin: conjur-credentials
Description:

Conjur Secrets Plugin 1.0.9 and earlier implements functionality that allows agent processes to obtain all username/password credentials (Credentials Plugin) stored on the Jenkins controller.

This allows attackers able to control agent processes to retrieve those credentials.

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

Agent-to-controller security bypass in Debian Package Builder Plugin

SECURITY-2546 / CVE-2022-23118
Severity (CVSS): High
Affected plugin: debian-package-builder
Description:

Debian Package Builder Plugin 1.6.11 and earlier implements functionality that allows agent processes to invoke command-line git at an attacker-specified path on the controller.

This allows attackers able to control agent processes to invoke arbitrary OS commands on the controller.

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

Severity

Affected Versions

  • Jenkins weekly up to and including 2.329
  • Jenkins LTS up to and including 2.319.1
  • Active Directory Plugin up to and including 2.25
  • Badge Plugin up to and including 1.9
  • batch task Plugin up to and including 1.19
  • Bitbucket Branch Source Plugin up to and including 737.vdf9dc06105be
  • Configuration as Code Plugin up to and including 1.55
  • Conjur Secrets Plugin up to and including 1.0.9
  • Credentials Binding Plugin up to and including 1.27
  • Debian Package Builder Plugin up to and including 1.6.11
  • Docker Commons Plugin up to and including 1.17
  • HashiCorp Vault Plugin up to and including 3.7.0
  • Mailer Plugin up to and including 391.ve4a_38c1b_cf4b_
  • Matrix Project Plugin up to and including 1.19
  • Metrics Plugin up to and including 4.0.2.8
  • Publish Over SSH Plugin up to and including 1.22
  • SSH Agent Plugin up to and including 1.23
  • Warnings Next Generation Plugin up to and including 9.10.2

Fix

  • Jenkins weekly should be updated to version 2.330
  • Jenkins LTS should be updated to version 2.319.2
  • Active Directory Plugin should be updated to version 2.25.1
  • Badge Plugin should be updated to version 1.9.1
  • Bitbucket Branch Source Plugin should be updated to version 746.v350d2781c184
  • Configuration as Code Plugin should be updated to version 1.55.1
  • Credentials Binding Plugin should be updated to version 1.27.1
  • Docker Commons Plugin should be updated to version 1.18
  • HashiCorp Vault Plugin should be updated to version 3.8.0
  • Mailer Plugin should be updated to version 408.vd726a_1130320
  • Matrix Project Plugin should be updated to version 1.20
  • Metrics Plugin should be updated to version 4.0.2.8.1
  • SSH Agent Plugin should be updated to version 1.23.2
  • Warnings Next Generation Plugin should be updated to version 9.10.3

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:

  • batch task Plugin
  • Conjur Secrets Plugin
  • Debian Package Builder Plugin
  • Publish Over SSH 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-2033, SECURITY-2522 (1), SECURITY-2522 (2), SECURITY-2546
  • Devin Nusbaum, CloudBees, Inc. for SECURITY-2467
  • James Nord, CloudBees, Inc. for SECURITY-2141
  • Jasen Minton for SECURITY-2213
  • Kevin Guerroudj for SECURITY-2287
  • Kevin Guerroudj, CloudBees, Inc. for SECURITY-2547
  • Kevin Guerroudj, CloudBees, Inc. and Wadeck Follonier, CloudBees, Inc. for SECURITY-2558
  • Kevin Guerroudj, Justin Philip and Marc Heyries for SECURITY-2307
  • Marc Heyries, Justin Philip and Kevin Guerroudj for SECURITY-2290, SECURITY-2291
  • Matt Sicker, CloudBees, Inc. for SECURITY-2163
  • Oleg Nenashev for SECURITY-1025
  • Tomasz Szuba for SECURITY-1878
  • Wadeck Follonier, CloudBees, Inc. for SECURITY-2017, SECURITY-2090
  • Wasin Saengow for SECURITY-1624