CVE-2021-43307: Regular expression denial of service in semver-regex
N/A
CVSS Score
Basic Information
CVE ID
GHSA ID
EPSS Score
0.86203%
CWE
Published
6/3/2022
Updated
7/19/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
-
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| semver-regex | npm | < 3.1.4 | 3.1.4 |
| semver-regex | npm | >= 4.0.0, < 4.0.3 | 4.0.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from the regex pattern returned by semverRegex() in index.js. The commit diff shows critical additions of lazy quantifiers (? modifiers) to {0,100} ranges and other groups, which directly addresses catastrophic backtracking. The added test case in test.js specifically measures execution time when testing ReDoS-prone patterns like '0.0.1-...', confirming the regex's test() method was vulnerable. Since semverRegex() is the sole function generating the regex pattern, and the patch exclusively modifies this function's output, it is conclusively identified as the vulnerable component.