Miggo Logo

CVE-2024-4067: Regular Expression Denial of Service (ReDoS) in micromatch

5.3

CVSS Score
3.1

Basic Information

EPSS Score
0.3274%
Published
5/14/2024
Updated
8/28/2024
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:L
Package NameEcosystemVulnerable VersionsFirst Patched Version
micromatchnpm< 4.0.84.0.8

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability description explicitly states that the ReDoS occurs in micromatch.braces() in index.js due to the greedy nature of the .* pattern in a regular expression. I analyzed the provided commit SHAs (500d5d6f42f0e8dfa1cb5464c6cb420b1b6aaaa0 and 03aa8052171e878897eee5d7bb2ae0ae83ec2ade), which are patches for this vulnerability. Both commits show an identical change in index.js within the micromatch.braces function. Specifically, the vulnerable regular expression /\\{.*\\}/ used with .test(pattern) was replaced by a call to a new helper function hasBraces(pattern). This directly confirms that micromatch.braces was the function containing the vulnerable code. The patch evidence is the line removed from this function, which contained the problematic regex. The new function hasBraces is part of the fix and not the vulnerable component.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

T** NPM p**k*** `mi*rom*t**` prior to v*rsion *.*.* is vuln*r**l* to R**ul*r *xpr*ssion **ni*l o* S*rvi** (R**oS). T** vuln*r**ility o**urs in `mi*rom*t**.*r***s()` in `in**x.js` ****us* t** p*tt*rn `.*` will *r***ily m*t** *nyt*in*. *y p*ssin* * m*l

Reasoning

T** vuln*r**ility **s*ription *xpli*itly st*t*s t**t t** R**oS o**urs in `mi*rom*t**.*r***s()` in `in**x.js` *u* to t** *r***y n*tur* o* t** `.*` p*tt*rn in * r**ul*r *xpr*ssion. I *n*lyz** t** provi*** *ommit S**s (**********************************