CVE-2024-4067: Regular Expression Denial of Service (ReDoS) in micromatch
5.3
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| micromatch | npm | < 4.0.8 | 4.0.8 |
Vulnerability Intelligence
Miggo AI
Root 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.