CVE-2026-140008: minimatch Quadratic Compile Time For Long Vulnerability

HIGH
Advisory Identifier: GHSA-cf2h-pxjq-68xw
CWE-407
Published
Advisory Summary

CVE-2026-140008 is a HIGH quadratic compile time for long vulnerability (CWE-407: Inefficient Algorithmic Complexity) affecting minimatch libraries in the npm ecosystem. The issue involves quadratic compile time for long wildcard patterns (regression in 11.0.0 `mergerows`). Remediation is available by upgrading affected packages to version 11.0.7.

CVE-2026-140008 at a Glance

CVE Identifier CVE-2026-140008
GHSA Identifier GHSA-cf2h-pxjq-68xw
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-407: Inefficient Algorithmic Complexity
Affected Product minimatch
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-140008

To remediate this vulnerability, upgrade all affected minimatch dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

minimatch fixed: 11.0.7
npm install minimatch@11.0.7
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls minimatch

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-140008, inspect your project dependencies using npm:

npm ls minimatch

Analyze the terminal output to locate any version of minimatch in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 11.0.7), your application is affected.

Note: The npm ls minimatch 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-407: Inefficient Algorithmic Complexity, where an algorithm in a product has an inefficient worst-case computational complexity that may be detrimental to system performance and can be triggered by an attacker, typically using crafted manipulations that ensure that the worst case is being reached. In minimatch, 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

**Summary.** `mergeRows()` (`src/index.ts` ~813-852, introduced in 2e1d896) iterates every part position and, for each row with a wildcard there, copies and joins the whole row to build a Map key. For a pattern made of many wildcard-only path parts this is quadratic in the number of parts, even with a single row. It runs in `new Minimatch`, so any uncached pattern pays it. **Measured** on 11.0.6 with a pattern of `*` parts joined by `/`: 1000 parts 22 ms, 2000 parts 72 ms, 4000 parts 190 ms, 8000 parts 805 ms (about 4× per doubling). Extrapolated to the 64 KB pattern limit (~32,000 parts), one compile blocks for roughly 13 s. A leading brace group of distinct words multiplies the rows and the cost. **Suggested fix.** Build merge keys incrementally (or hash per position) instead of joining the full row at each position, or skip merging when there is only one row; and count the work against `braceExpandMax` or a new limit.

CVE-2026-140008 Affected minimatch Versions

1 component(s)
Fixed Versions:
11.0.7
Product / Package Ecosystem Affected Versions Fixed Version
minimatch
npm
≥ 11.0.0
< 11.0.7
11.0.7

References

Frequently Asked Questions

What is CVE-2026-140008?
CVE-2026-140008 is a security vulnerability in minimatch involving Quadratic compile time for long wildcard patterns (regression in 11.0.0 `mergeRows`) under CWE-407: Inefficient Algorithmic Complexity.
Which minimatch versions are affected?
Affected versions include releases prior to 11.0.7 across affected packages: minimatch.
What version fixes CVE-2026-140008?
Upgrading to 11.0.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is minimatch affected?
Yes, minimatch is affected in releases prior to 11.0.7. Upgrade your dependency to 11.0.7 or later.
What CWE is associated with CVE-2026-140008?
CVE-2026-140008 is classified under CWE-407: Inefficient Algorithmic Complexity (An algorithm in a product has an inefficient worst-case computational complexity that may be detrimental to system performance and can be triggered by an attacker, typically using crafted manipulations that ensure that the worst case is being reached.).
How can I check npm dependencies for CVE-2026-140008?
Run the dependency tree command: 'npm ls minimatch'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-cf2h-pxjq-68xw",
  "modified" : "2026-12-01T18:00:15Z",
  "published" : "2026-12-01T18:00:15Z",
  "aliases" : [ "CVE-2026-140008" ],
  "summary" : "minimatch: Quadratic compile time for long wildcard patterns (regression in 11.0.0 `mergeRows`)",
  "details" : "**Summary.** `mergeRows()` (`src/index.ts` ~813-852, introduced in 2e1d896) iterates every part position and, for each row with a wildcard there, copies and joins the whole row to build a Map key. For a pattern made of many wildcard-only path parts this is quadratic in the number of parts, even with a single row. It runs in `new Minimatch`, so any uncached pattern pays it.\n\n**Measured** on 11.0.6 with a pattern of `*` parts joined by `/`: 1000 parts 22 ms, 2000 parts 72 ms, 4000 parts 190 ms, 8000 parts 805 ms (about 4× per doubling). Extrapolated to the 64 KB pattern limit (~32,000 parts), one compile blocks for roughly 13 s. A leading brace group of distinct words multiplies the rows and the cost.\n\n**Suggested fix.** Build merge keys incrementally (or hash per position) instead of joining the full row at each position, or skip merging when there is only one row; and count the work against `braceExpandMax` or a new limit.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "minimatch"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "11.0.0"
      }, {
        "fixed" : "11.0.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 11.0.6"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/minimatch/security/advisories/GHSA-cf2h-pxjq-68xw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-140008"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/minimatch/commit/8a26917fa43e2b865dd6017f7acf6ac2fd5190cd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/isaacs/minimatch"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-407" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-01T18:00:15Z",
    "nvd_published_at" : "2026-11-30T22:17:30Z"
  }
}