Vulnerabilities in pkg:npm/micromatch
PACKAGECVE-2024-4067 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Micromatch libraries in the npm ecosystem. The issue involves regular expression denial of service (redos) in micromatch. Remediation is available by upgrading affected packages to version 4.0.8.
pkg:npm/micromatch
Vulnerability advisories affecting package pkg:npm/micromatch. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-952p-6rrq-rcjv | CVE-2024-4067 | MODERATE | Regular Expression Denial of Service (ReDoS) in micromatch |
CVE-2024-4067 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2024-4067
To remediate this vulnerability, upgrade all affected Micromatch dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install micromatch@4.0.8
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls micromatch
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-4067, inspect your project dependencies using npm:
npm ls micromatch
Analyze the terminal output to locate any version of Micromatch in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.8), your application is affected.
Note: The npm ls micromatch command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Micromatch, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-4067 Affected Micromatch Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
micromatch
|
npm |
< 4.0.8
|
4.0.8
|
References
Frequently Asked Questions
What is CVE-2024-4067?
Which Micromatch versions are affected?
What version fixes CVE-2024-4067?
Is micromatch affected?
What is the CVSS score of CVE-2024-4067?
What CWE is associated with CVE-2024-4067?
How can I check npm dependencies for CVE-2024-4067?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-952p-6rrq-rcjv",
"modified" : "2024-08-28T13:12:26Z",
"published" : "2024-05-14T18:30:54Z",
"aliases" : [ "CVE-2024-4067" ],
"summary" : "Regular Expression Denial of Service (ReDoS) in micromatch",
"details" : "The NPM package `micromatch` prior to version 4.0.8 is vulnerable to Regular Expression Denial of Service (ReDoS). The vulnerability occurs in `micromatch.braces()` in `index.js` because the pattern `.*` will greedily match anything. By passing a malicious payload, the pattern matching will keep backtracking to the input while it doesn't find the closing bracket. As the input size increases, the consumption time will also increase until it causes the application to hang or slow down. There was a merged fix but further testing shows the issue persisted prior to https://github.com/micromatch/micromatch/pull/266. This issue should be mitigated by using a safe pattern that won't start backtracking the regular expression due to greedy matching.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "micromatch"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.0.8"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-4067"
}, {
"type" : "WEB",
"url" : "https://github.com/micromatch/micromatch/issues/243"
}, {
"type" : "WEB",
"url" : "https://github.com/micromatch/micromatch/pull/247"
}, {
"type" : "WEB",
"url" : "https://github.com/micromatch/micromatch/pull/266"
}, {
"type" : "WEB",
"url" : "https://github.com/micromatch/micromatch/commit/03aa8052171e878897eee5d7bb2ae0ae83ec2ade"
}, {
"type" : "WEB",
"url" : "https://github.com/micromatch/micromatch/commit/500d5d6f42f0e8dfa1cb5464c6cb420b1b6aaaa0"
}, {
"type" : "WEB",
"url" : "https://advisory.checkmarx.net/advisory/CVE-2024-4067"
}, {
"type" : "WEB",
"url" : "https://devhub.checkmarx.com/cve-details/CVE-2024-4067"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/micromatch/micromatch"
}, {
"type" : "WEB",
"url" : "https://github.com/micromatch/micromatch/blob/2c56a8604b68c1099e7bc0f807ce0865a339747a/index.js#L448"
}, {
"type" : "WEB",
"url" : "https://github.com/micromatch/micromatch/releases/tag/4.0.8"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1333" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-08-21T22:58:52Z",
"nvd_published_at" : "2024-05-14T15:42:47Z"
}
}