CVE-2024-21538: Cross spawn Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-3xgq-45jj-v275
CVSS 7.5
CWE-1333
Published
Advisory Summary

CVE-2024-21538 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Cross spawn libraries in the npm ecosystem. The issue involves regular expression denial of service (redos) in cross-spawn. Remediation is available by upgrading affected packages to version 7.0.5, 6.0.6.

CVE-2024-21538 at a Glance

CVE Identifier CVE-2024-21538
GHSA Identifier GHSA-3xgq-45jj-v275
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product Cross spawn
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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

How to Fix CVE-2024-21538

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

cross-spawn fixed: 7.0.5
npm install cross-spawn@7.0.5
cross-spawn fixed: 6.0.6
npm install cross-spawn@6.0.6
Verify Direct and Transitive Dependencies

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

npm ls cross-spawn

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-21538, inspect your project dependencies using npm:

npm ls cross-spawn

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

Note: The npm ls cross-spawn command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Cross spawn, 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

Versions of the package cross-spawn before 7.0.5 are vulnerable to Regular Expression Denial of Service (ReDoS) due to improper input sanitization. An attacker can increase the CPU usage and crash the program by crafting a very large and well crafted string.

CVE-2024-21538 Affected Cross spawn Versions

2 component(s)
Fixed Versions:
7.0.56.0.6
Product / Package Ecosystem Affected Versions Fixed Version
cross-spawn
npm
≥ 7.0.0
< 7.0.5
7.0.5
cross-spawn
npm
< 6.0.6
6.0.6

References

Frequently Asked Questions

What is CVE-2024-21538?
CVE-2024-21538 is a security vulnerability in Cross spawn involving Regular Expression Denial of Service (ReDoS) in cross-spawn under CWE-1333: Inefficient Regular Expression Complexity.
Which Cross spawn versions are affected?
Affected versions include releases prior to 7.0.5, 6.0.6 across affected packages: cross-spawn.
What version fixes CVE-2024-21538?
Upgrading to 7.0.5, 6.0.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is cross-spawn affected?
Yes, cross-spawn is affected in releases prior to 7.0.5, 6.0.6. Upgrade your dependency to 7.0.5, 6.0.6 or later.
What is the CVSS score of CVE-2024-21538?
CVE-2024-21538 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2024-21538?
CVE-2024-21538 is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check npm dependencies for CVE-2024-21538?
Run the dependency tree command: 'npm ls cross-spawn'. 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-3xgq-45jj-v275",
  "modified" : "2025-05-19T19:56:26Z",
  "published" : "2024-11-08T06:30:47Z",
  "aliases" : [ "CVE-2024-21538" ],
  "summary" : "Regular Expression Denial of Service (ReDoS) in cross-spawn",
  "details" : "Versions of the package cross-spawn before 7.0.5 are vulnerable to Regular Expression Denial of Service (ReDoS) due to improper input sanitization. An attacker can increase the CPU usage and crash the program by crafting a very large and well crafted string.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "cross-spawn"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.0.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "cross-spawn"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.0.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-21538"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/issues/165"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/pull/160"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/commit/5ff3a07d9add449021d806e45c4168203aa833ff"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/commit/640d391fde65388548601d95abedccc12943374f"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/moxystudio/node-cross-spawn/commit/d35c865b877d2f9ded7c1ed87521c2fdb689c8dd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/moxystudio/node-cross-spawn"
  }, {
    "type" : "WEB",
    "url" : "https://security.snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-8366349"
  }, {
    "type" : "WEB",
    "url" : "https://security.snyk.io/vuln/SNYK-JS-CROSSSPAWN-8303230"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-15T22:25:53Z",
    "nvd_published_at" : "2024-11-08T05:15:06Z"
  }
}