Miggo Logo

CVE-2021-4306: terminal-kit Inefficient Regular Expression Complexity vulnerability

7.5

CVSS Score
3.1

Basic Information

EPSS Score
0.1613%
Published
1/7/2023
Updated
1/28/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
terminal-kitnpm< 2.1.82.1.8

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The commit diff shows the regex in misc.markupWidth was modified to prevent ReDoS. The original regex pattern had inefficient complexity due to an unrestricted quantifier in the character class [^]]*. This matches the CWE-1333 description and the vulnerability's focus on regex inefficiency. The patch explicitly targets this function's regex, and the GHSA advisory confirms the exploit involved strings like '^['.repeat(bigNumber).

Vulnerable functions

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

WAF Protection Rules

WAF Rule

* vuln*r**ility *l*ssi*i** *s pro*l*m*ti* **s ***n *oun* in *ronv*l t*rmin*l-kit up to *.*.*. *****t** is *n unknown *un*tion. T** m*nipul*tion l***s to in***i*i*nt r**ul*r *xpr*ssion *ompl*xity. Up*r**in* to v*rsion *.*.* **n ***r*ss t*is issu*. T**

Reasoning

T** *ommit *i** s*ows t** r***x in `mis*.m*rkupWi*t*` w*s mo*i*i** to pr*v*nt R**oS. T** ori*in*l r***x p*tt*rn *** in***i*i*nt *ompl*xity *u* to *n unr*stri*t** qu*nti*i*r in t** ***r**t*r *l*ss [^\]]*. T*is m*t***s t** *W*-**** **s*ription *n* t**