CVE-2022-25858: Terser insecure use of regular expressions leads to ReDoS
7.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.82815%
CWE
Published
7/16/2022
Updated
4/11/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| terser | npm | < 4.8.1 | 4.8.1 |
| terser | npm | >= 5.0.0, < 5.14.2 | 5.14.2 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from two key functions handling regex processing: 1) AST_RegExp evaluation in evaluate.js previously lacked regexp_is_safe validation, allowing dangerous patterns. 2) AST_Call optimization in index.js created RegExp instances from parameters without safety checks. The patches explicitly added regexp_is_safe checks to both locations, indicating these were the vulnerable points. The CWE-1333 classification and commit messages confirm these were the ReDoS entry points through unsafe regex construction/evaluation.