PortGate

Advisories · Node.js & Next.js

CVE-2024-21538 High CVSS 7.5

cross-spawn regular-expression denial of service

Disclosed 2024 · Last reviewed 2 Dec 2026

A long command string could make cross-spawn spend CPU matching arguments.

What happened

The argument matcher backtracked.

Affected and patched versions

Affected
cross-spawn before 7.0.5 and the 6.0.x line before 6.0.6.
Patched
cross-spawn 7.0.5 and 6.0.6.

How to check your server

Check

npm ls cross-spawn

How to fix and harden

  1. Upgrade cross-spawn on the major you already use.
  2. It is usually a transitive dependency. Commit the lockfile after npm update.

Fix

npm ls cross-spawn

Sources

Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON