CVE-2024-21538: Regular Expression Denial of Service (ReDoS) in cross-spawn
High CVSS 7.5
- OSV id
- GHSA-3xgq-45jj-v275
- Also known as
- CVE-2024-21538
- Published
- Last modified
Affected packages
| Package | Affected versions | Fixed in |
|---|---|---|
| cross-spawn npm |
>= 7.0.0, < 7.0.5 | 7.0.5 |
| cross-spawn npm |
< 6.0.6 | 6.0.6 |
Versions we track that it affects: cross-spawn 7.0.3; cross-spawn 7.0.3
How to fix it
cross-spawn (npm)
Upgrade cross-spawn to 7.0.5 or later.
npm install cross-spawn@7.0.5
# if it is an indirect dependency: npm update cross-spawn (or npm audit fix)
- If it is an indirect dependency, upgrade the package that depends on it, or force the version with "overrides" (npm), "resolutions" (Yarn) or "pnpm.overrides" (pnpm) in package.json.
- Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.
cross-spawn (npm)
Upgrade cross-spawn to 6.0.6 or later.
npm install cross-spawn@6.0.6
# if it is an indirect dependency: npm update cross-spawn (or npm audit fix)
- If it is an indirect dependency, upgrade the package that depends on it, or force the version with "overrides" (npm), "resolutions" (Yarn) or "pnpm.overrides" (pnpm) in package.json.
- Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.
Not sure whether your project uses an affected version? Check your lockfile below for free.
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.
References
- GHSA-3xgq-45jj-v275 on OSV.dev
- Advisory: https://nvd.nist.gov/vuln/detail/CVE-2024-21538
- Web: https://github.com/moxystudio/node-cross-spawn/issues/165
- Web: https://github.com/moxystudio/node-cross-spawn/pull/160
- Web: https://github.com/moxystudio/node-cross-spawn/commit/5ff3a07d9add449021d806e45c4168203aa833ff
- Web: https://github.com/moxystudio/node-cross-spawn/commit/640d391fde65388548601d95abedccc12943374f
- Web: https://github.com/moxystudio/node-cross-spawn/commit/d35c865b877d2f9ded7c1ed87521c2fdb689c8dd
- Package: https://github.com/moxystudio/node-cross-spawn
- Web: https://security.snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-8366349
- Web: https://security.snyk.io/vuln/SNYK-JS-CROSSSPAWN-8303230
Am I affected?
Upload or paste your lockfile. We check every package version in it against OSV.dev, this advisory included, and email you the vulnerable ones with the version that fixes them. Free, and no account needed.
About this data
Source: GitHub Advisory Database via OSV.dev (CC-BY 4.0). Severity comes from the advisory's own rating when it has one, else from its CVSS score.