# CVE-2024-21538: Regular Expression Denial of Service (ReDoS) in cross-spawn

> An attacker can cause a denial of service by crafting a large string that triggers excessive CPU usage in the cross-spawn library.

- **Severity:** High 8.7 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 8 Nov 2024
- **Updated:** 7 Aug 2026
- **Also known as:** AZL-52548, AZL-52551, AZL-52561, AZL-52587, AZL-52604, BELL-CVE-2024-21538, CLEANSTART-2026-JD77118, CLEANSTART-2026-SZ60879, CLSA-2026-1773793042, CLSA-2026-1773965919, CLSA-2026-1776818188, CLSA-2026-1780620667, CLSA-2026-1780620678, GHSA-3xgq-45jj-v275, MINI-4fv6-xqfr-3w7w, MINI-hjrh-87mf-j8gr, MINI-rhgf-5q48-gw9m, MINI-w8hq-vfqh-47j3, ROOT-APP-NPM-CVE-2024-21538, SUSE-SU-2024:4272-1, SUSE-SU-2024:4286-1, SUSE-SU-2024:4300-1, SUSE-SU-2024:4301-1, openSUSE-SU-2024:14550-1, openSUSE-SU-2024:14553-1, openSUSE-SU-2024:14558-1, openSUSE-SU-2024:14559-1, openSUSE-SU-2024:14560-1, openSUSE-SU-2024:14561-1, openSUSE-SU-2025:14615-1

## What is CVE-2024-21538?

CVE-2024-21538 is a high-severity denial of service vulnerability in cross-spawn, published on 8 Nov 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Versions of the package cross-spawn before 6.0.6, from 7.0.0 and 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.

Weakness: CWE-1333 (Inefficient Regular Expression Complexity)

## Which versions are affected by CVE-2024-21538?

4 open source packages ship an affected version, including cross-spawn.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `cross-spawn` | npm | All versions | 6.0.6 |
| `cross-spawn` | npm | All versions | 6.0.6 |
| `cross-spawn` | npm | From 7.0.0 | 7.0.5 |
| `cross-spawn` | npm | From 7.0.0 | 7.0.5 |
| `nodejs18` | SUSE:Linux Enterprise Module for Web and Scripting 15 SP5 | All versions | 18.20.5-150400.9.30.1 |
| `nodejs20` | SUSE:Linux Enterprise Module for Web and Scripting 15 SP5 | All versions | 20.18.1-150500.11.15.1 |
| `nodejs20` | SUSE:Linux Enterprise Module for Web and Scripting 15 SP6 | All versions | 20.18.1-150600.3.6.1 |
| `nodejs18` | SUSE:Linux Enterprise Server LTSS Extended Security 12 SP5 | All versions | 18.20.5-8.30.1 |
| `nodejs18` | openSUSE:Leap 15.5 | All versions | 18.20.5-150400.9.30.1 |
| `nodejs20` | openSUSE:Leap 15.5 | All versions | 20.18.1-150500.11.15.1 |
| `nodejs20` | openSUSE:Leap 15.6 | All versions | 20.18.1-150600.3.6.1 |
| `jupyter-jupyterlab-latex` | openSUSE:Tumbleweed | All versions | 4.1.1-2.1 |
| `nodejs22` | openSUSE:Tumbleweed | All versions | 22.12.0-1.1 |
| `python-furo` | openSUSE:Tumbleweed | All versions | 2024.8.6-2.1 |
| `python-jupyter-ydoc` | openSUSE:Tumbleweed | All versions | 3.0.0-2.1 |
| `python-nbclassic` | openSUSE:Tumbleweed | All versions | 1.1.0-2.1 |
| `python-nbdime` | openSUSE:Tumbleweed | All versions | 4.0.2-18.1 |
| `python-pytest-html` | openSUSE:Tumbleweed | All versions | 4.1.1-4.1 |

## How do I fix CVE-2024-21538?

Upgrade cross-spawn to a fixed version for your release line: 6.0.6 or 7.0.5.

## Is CVE-2024-21538 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21538 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-21538 and fix it if it is affected.

What it is: CVE-2024-21538 is a high-severity denial of service vulnerability in cross-spawn, published on 8 Nov 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21538 exists.

Affected packages and fixed versions:
- cross-spawn (npm): affected all versions; fixed in 6.0.6
- cross-spawn (npm): affected all versions; fixed in 6.0.6
- cross-spawn (npm): affected from 7.0.0; fixed in 7.0.5
- cross-spawn (npm): affected from 7.0.0; fixed in 7.0.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-21538/ (Markdown: https://insights.sbomify.com/CVE-2024-21538/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-21538
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-21538
- OSV: https://osv.dev/vulnerability/CVE-2024-21538

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-21538/
Summaries are generated and may contain mistakes; the official description above is the record.
