CVE-2024-21538: Cross spawn Denial of Service Vulnerability
HIGHCVE-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
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).
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.
npm install cross-spawn@7.0.5
npm install cross-spawn@6.0.6
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
CVE-2024-21538 Affected Cross spawn Versions
2 component(s)| 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?
Which Cross spawn versions are affected?
What version fixes CVE-2024-21538?
Is cross-spawn affected?
What is the CVSS score of CVE-2024-21538?
What CWE is associated with CVE-2024-21538?
How can I check npm dependencies for CVE-2024-21538?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}