CVE-2022-43401: Script security Groovy Plugin Vulnerability

HIGH
Advisory Identifier: GHSA-7vr5-72w7-q6jc
CVSS 8.8
CWE-693
Published
Advisory Summary

CVE-2022-43401 is a HIGH (CVSS 8.8) groovy plugin vulnerability (CWE-693: Protection Mechanism Failure) affecting Script security libraries in the Maven ecosystem. The issue involves groovy plugin. Remediation is available by upgrading affected packages to version 1184.v85d16b_d851b_3, 2803.v1a_f77ffcc773.

CVE-2022-43401 at a Glance

CVE Identifier CVE-2022-43401
GHSA Identifier GHSA-7vr5-72w7-q6jc
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-693: Protection Mechanism Failure
Affected Product Script security
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-43401

To remediate this vulnerability, upgrade all affected Script security dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.jenkins-ci.plugins:script-security fixed: 1184.v85d16b_d851b_3
<dependency>
    <groupId>org.jenkins-ci.plugins</groupId>
    <artifactId>script-security</artifactId>
    <version>1184.v85d16b_d851b_3</version>
</dependency>
org.jenkins-ci.plugins.workflow:workflow-cps fixed: 2803.v1a_f77ffcc773
<dependency>
    <groupId>org.jenkins-ci.plugins.workflow</groupId>
    <artifactId>workflow-cps</artifactId>
    <version>2803.v1a_f77ffcc773</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.jenkins-ci.plugins

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2022-43401, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.jenkins-ci.plugins

Analyze the terminal output to locate any version of Script security in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1184.v85d16b_d851b_3), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.jenkins-ci.plugins command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-693: Protection Mechanism Failure, where the product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product. In Script security, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Script Security Plugin provides a sandbox feature that allows low privileged users to define scripts, including Pipelines, that are generally safe to execute. Calls to code defined inside a sandboxed script are intercepted, and various allowlists are checked to determine whether the call is to be allowed. Multiple sandbox bypass vulnerabilities exist in Script Security Plugin and Pipeline: Groovy Plugin: - In Script Security Plugin 1183.v774b_0b_0a_a_451 and earlier and in Pipeline: Groovy Plugin 2802.v5ea_628154b_c2 and earlier, various casts performed implicitly by the Groovy language runtime were not intercepted by the sandbox. This includes casts performed when returning values from methods, when assigning local variables, fields, properties, and when defining default arguments for closure, constructor, and method parameters (CVE-2022-43401 in Script Security Plugin and CVE-2022-43402 in Pipeline: Groovy Plugin). - In Script Security Plugin 1183.v774b_0b_0a_a_451 and earlier, when casting an array-like value to an array type, per-element casts to the component type of the array are not intercepted by the sandbox (CVE-2022-43403). - In Script Security Plugin 1183.v774b_0b_0a_a_451 and earlier, crafted constructor bodies and calls to sandbox-generated synthetic constructors can be used to construct any subclassable type (due to an incomplete fix for SECURITY-1754 in the [2020-03-09 security advisory](https://www.jenkins.io/security/advisory/2020-03-09/#SECURITY-1754)) (CVE-2022-43404). These vulnerabilities allow attackers with permission to define and run sandboxed scripts, including Pipelines, to bypass the sandbox protection and execute arbitrary code in the context of the Jenkins controller JVM.\n\nThese vulnerabilities have been fixed: - Script Security Plugin 1184.v85d16b_d851b_3 and Pipeline: Groovy Plugin 2803.v1a_f77ffcc773 intercept Groovy casts performed implicitly by the Groovy language runtime (CVE-2022-43401 in Script Security Plugin and CVE-2022-43402 in Pipeline: Groovy Plugin). - Script Security Plugin 1184.v85d16b_d851b_3 intercepts per-element casts when casting array-like values to array types (CVE-2022-43403). - Script Security Plugin 1184.v85d16b_d851b_3 rejects improper calls to sandbox-generated synthetic constructors (CVE-2022-43404). Both plugins, Script Security Plugin and Pipeline: Groovy Plugin must be updated simultaneously. While Script Security Plugin could be updated independently, doing so would cause errors in Pipeline: Groovy Plugin due to an incompatible API change.

CVE-2022-43401 Affected Script security Versions

2 component(s)
Fixed Versions:
1184.v85d16b_d851b_32803.v1a_f77ffcc773
Product / Package Ecosystem Affected Versions Fixed Version
org.jenkins-ci.plugins:script-security
Maven
< 1184.v85d16b_d851b_3
1184.v85d16b_d851b_3
org.jenkins-ci.plugins.workflow:workflow-cps
Maven
< 2803.v1a_f77ffcc773
2803.v1a_f77ffcc773

References

Frequently Asked Questions

What is CVE-2022-43401?
CVE-2022-43401 is a security vulnerability in Script security involving Groovy Plugin under CWE-693: Protection Mechanism Failure.
Which Script security versions are affected?
Affected versions include releases prior to 1184.v85d16b_d851b_3, 2803.v1a_f77ffcc773 across affected packages: org.jenkins-ci.plugins:script-security, org.jenkins-ci.plugins.workflow:workflow-cps.
What version fixes CVE-2022-43401?
Upgrading to 1184.v85d16b_d851b_3, 2803.v1a_f77ffcc773 (or the latest patched release for your respective branch) resolves the vulnerability.
Is script-security affected?
Yes, org.jenkins-ci.plugins:script-security is affected in releases prior to 1184.v85d16b_d851b_3. Upgrade your dependency to 1184.v85d16b_d851b_3 or later.
Is workflow-cps affected?
Yes, org.jenkins-ci.plugins.workflow:workflow-cps is affected in releases prior to 2803.v1a_f77ffcc773. Upgrade your dependency to 2803.v1a_f77ffcc773 or later.
What is the CVSS score of CVE-2022-43401?
CVE-2022-43401 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-43401?
CVE-2022-43401 is classified under CWE-693: Protection Mechanism Failure (The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.).
How can I check Maven dependencies for CVE-2022-43401?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.jenkins-ci.plugins'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7vr5-72w7-q6jc",
  "modified" : "2022-12-16T16:21:38Z",
  "published" : "2022-10-19T19:00:21Z",
  "aliases" : [ "CVE-2022-43401" ],
  "summary" : "Sandbox bypass vulnerabilities in Jenkins Script Security Plugin and in Pipeline: Groovy Plugin",
  "details" : "Script Security Plugin provides a sandbox feature that allows low privileged users to define scripts, including Pipelines, that are generally safe to execute. Calls to code defined inside a sandboxed script are intercepted, and various allowlists are checked to determine whether the call is to be allowed.\n\nMultiple sandbox bypass vulnerabilities exist in Script Security Plugin and Pipeline: Groovy Plugin:\n\n- In Script Security Plugin 1183.v774b_0b_0a_a_451 and earlier and in Pipeline: Groovy Plugin 2802.v5ea_628154b_c2 and earlier, various casts performed implicitly by the Groovy language runtime were not intercepted by the sandbox. This includes casts performed when returning values from methods, when assigning local variables, fields, properties, and when defining default arguments for closure, constructor, and method parameters (CVE-2022-43401 in Script Security Plugin and CVE-2022-43402 in Pipeline: Groovy Plugin).\n- In Script Security Plugin 1183.v774b_0b_0a_a_451 and earlier, when casting an array-like value to an array type, per-element casts to the component type of the array are not intercepted by the sandbox (CVE-2022-43403).\n- In Script Security Plugin 1183.v774b_0b_0a_a_451 and earlier, crafted constructor bodies and calls to sandbox-generated synthetic constructors can be used to construct any subclassable type (due to an incomplete fix for SECURITY-1754 in the [2020-03-09 security advisory](https://www.jenkins.io/security/advisory/2020-03-09/#SECURITY-1754)) (CVE-2022-43404).\n\nThese vulnerabilities allow attackers with permission to define and run sandboxed scripts, including Pipelines, to bypass the sandbox protection and execute arbitrary code in the context of the Jenkins controller JVM.\\n\\nThese vulnerabilities have been fixed:\n\n- Script Security Plugin 1184.v85d16b_d851b_3 and Pipeline: Groovy Plugin 2803.v1a_f77ffcc773 intercept Groovy casts performed implicitly by the Groovy language runtime (CVE-2022-43401 in Script Security Plugin and CVE-2022-43402 in Pipeline: Groovy Plugin).\n- Script Security Plugin 1184.v85d16b_d851b_3 intercepts per-element casts when casting array-like values to array types (CVE-2022-43403).\n- Script Security Plugin 1184.v85d16b_d851b_3 rejects improper calls to sandbox-generated synthetic constructors (CVE-2022-43404).\n\nBoth plugins, Script Security Plugin and Pipeline: Groovy Plugin must be updated simultaneously. While Script Security Plugin could be updated independently, doing so would cause errors in Pipeline: Groovy Plugin due to an incompatible API change.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.jenkins-ci.plugins:script-security"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1184.v85d16b_d851b_3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 1184.v85d16b"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.jenkins-ci.plugins.workflow:workflow-cps"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2803.v1a_f77ffcc773"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2802.v5ea"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-43401"
  }, {
    "type" : "WEB",
    "url" : "https://www.jenkins.io/security/advisory/2022-10-19/#SECURITY-2824%20(1)"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2022/10/19/3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-693" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-19T22:04:01Z",
    "nvd_published_at" : "2022-10-19T16:15:00Z"
  }
}