Miggo Logo

CVE-2022-25858: Terser insecure use of regular expressions leads to ReDoS

7.5

CVSS Score
3.1

Basic Information

EPSS Score
0.82815%
Published
7/16/2022
Updated
4/11/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
tersernpm< 4.8.14.8.1
tersernpm>= 5.0.0, < 5.14.25.14.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot 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.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

T** p**k*** t*rs*r ***or* *.*.*, *rom *.*.* *n* ***or* *.**.* *r* vuln*r**l* to R**ul*r *xpr*ssion **ni*l o* S*rvi** (R**oS) *u* to ins**ur* us*** o* r**ul*r *xpr*ssions.

Reasoning

T** vuln*r**ility st*ms *rom two k*y *un*tions **n*lin* r***x pro**ssin*: *) *ST_R***xp *v*lu*tion in *v*lu*t*.js pr*viously l**k** r***xp_is_s*** v*li**tion, *llowin* **n**rous p*tt*rns. *) *ST_**ll optimiz*tion in in**x.js *r**t** R***xp inst*n**s