PortGate

Advisories · Node.js & Next.js

CVE-2022-25883 High CVSS 7.5

semver regular-expression denial of service

Disclosed 2022 · Last reviewed 2 Dec 2026

A version range could make the semver parser spend a long time on one string.

What happened

The range parser backtracked on a crafted version.

Affected and patched versions

Affected
The semver npm package before 7.5.2, 6.3.1, and 5.7.2.
Patched
7.5.2, 6.3.1, 5.7.2, and later on those lines.

How to check your server

Check

npm ls semver

How to fix and harden

  1. Upgrade semver on the major your lockfile already uses.
  2. Run npm audit in CI and commit the lockfile.

Fix

npm ls semver

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