Miggo Logo

CVE-2021-32723: Regular Expression Denial of Service (ReDoS) in Prism

7.4

CVSS Score
3.1

Basic Information

EPSS Score
0.58221%
Published
6/28/2021
Updated
2/1/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:N/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
prismjsnpm< 1.24.01.24.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from regex patterns with: 1) Unbalanced/improper character class escaping 2) Nested quantifiers without proper anchors 3) Missing negative lookaheads. The commit fixes show specific regex modifications adding missing quote handling (') in character classes and adding negative lookaheads ((?![\w$])) to prevent ambiguous matches. These patterns are used in syntax highlighting of untrusted input, making them direct attack vectors for ReDoS when processing malicious payloads.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

Som* l*n*u***s ***or* *.**.* *r* vuln*r**l* to R**ul*r *xpr*ssion **ni*l o* S*rvi** (R**oS). ### Imp**t W**n Prism is us** to *i**li**t untrust** (us*r-*iv*n) t*xt, *n *tt**k*r **n *r**t * strin* t**t will t*k* * v*ry v*ry lon* tim* to *i**li**t. *

Reasoning

T** vuln*r**ility st*ms *rom r***x p*tt*rns wit*: *) Un**l*n***/improp*r ***r**t*r *l*ss *s**pin* *) N*st** qu*nti*i*rs wit*out prop*r *n**ors *) Missin* n***tiv* look*****s. T** *ommit *ix*s s*ow sp**i*i* r***x mo*i*i**tions ***in* missin* quot* **n