CVE-2026-140007: minimatch Global Pattern Cache Retains Large Vulnerability

MODERATE
Advisory Identifier: GHSA-hqmv-qgp3-jx75
CVSS 5.9
CWE-400
Published
Advisory Summary

CVE-2026-140007 is a MODERATE (CVSS 5.9) global pattern cache retains large vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting minimatch libraries in the npm ecosystem. The issue involves global pattern cache retains large expansions, enabling memory exhaustion. Remediation is available by upgrading affected packages to version 11.0.8.

CVE-2026-140007 at a Glance

CVE Identifier CVE-2026-140007
GHSA Identifier GHSA-hqmv-qgp3-jx75
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product minimatch
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-140007

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.8
npm install minimatch@11.0.8
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-140007, 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.8), 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. 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 minimatch 11.0.3 through 11.0.7 retain the 256 most recent compiled `Minimatch` objects in a module-level cache. The cache is bounded only by entry count; each object can retain up to 100,000 expanded pattern rows. An application that passes untrusted, unique patterns to the top-level `minimatch()` function can therefore be terminated with a few very small inputs. ## Root cause Commit `52d2aecceb71dae7f1b19675e74e044eb472c1e6` changed `minimatch()` to store each compiled object in a 256-entry `Map`. The key includes the complete pattern and options, so unique attacker-controlled patterns create distinct retained entries. There is no total cache-weight or per-entry expansion limit below the existing `braceExpandMax` default of 100,000. The cache first ships in 11.0.3. Version 11.0.1 is a confirmed negative control. ## Proof of concept Install minimatch 11.0.4, save as `poc.mjs`, and run with `node --max-old-space-size=128 --expose-gc poc.mjs`: ```js import { minimatch } from 'minimatch' for (let i = 0; i < 4; i++) { const pattern = `{1..100000}/unique-${i}` minimatch('no-match', pattern, { optimizationLevel: 2 }) global.gc() console.log(i + 1, process.memoryUsage()) } ``` On 11.0.4, the process terminates with: ```text FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory ``` The same command exits normally on 11.0.1. With three calls and the normal heap limit, forced-GC heap grew from 4.36 MB to 112.27 MB and RSS from 50.9 MB to 262.7 MB. As a smaller repeated control, ten independent processes each compiled ten unique 5,000-expansion patterns. On 11.0.4 the cached top-level function retained a median 17,371,504 heap bytes after forced GC. The direct `new Minimatch()` control retained 234,000 bytes, and the 11.0.1 top-level function showed no measurable retained-heap growth. ## Impact Applications that accept attacker-controlled glob patterns and call the top-level `minimatch()` function can be crashed through memory exhaustion. Applications using only trusted patterns are not exposed. No confidentiality, integrity, filesystem, or code-execution impact is claimed. Confirmed affected: 11.0.3 through 11.0.7. No patched version is currently available. ## Suggested remediation Bound the cache by total retained weight or expansion count and do not cache large compiled patterns. Removing the global cache or making it opt-in for trusted patterns would also prevent the retention. ## Duplicate review and disclosure Public issues, pull requests, and advisories were searched for cache retention, OOM, `braceExpandMax`, and the 256-pattern cache. Issues #269 and #270 discuss caching performance but do not document this retention/OOM condition. OpenAI Codex assisted with source review, local reproduction, negative controls, version analysis, duplicate checks, and drafting. All tests were local; no external service was contacted. The account owner reviewed the evidence and explicitly authorized this private submission.

CVE-2026-140007 Affected minimatch Versions

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

References

Frequently Asked Questions

What is CVE-2026-140007?
CVE-2026-140007 is a security vulnerability in minimatch involving Global pattern cache retains large expansions, enabling memory exhaustion under CWE-400: Uncontrolled Resource Consumption.
Which minimatch versions are affected?
Affected versions include releases prior to 11.0.8 across affected packages: minimatch.
What version fixes CVE-2026-140007?
Upgrading to 11.0.8 (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.8. Upgrade your dependency to 11.0.8 or later.
What is the CVSS score of CVE-2026-140007?
CVE-2026-140007 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-140007?
CVE-2026-140007 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2026-140007?
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-hqmv-qgp3-jx75",
  "modified" : "2026-12-01T18:05:29Z",
  "published" : "2026-12-01T18:05:29Z",
  "aliases" : [ "CVE-2026-140007" ],
  "summary" : "minimatch: Global pattern cache retains large expansions, enabling memory exhaustion",
  "details" : "## Summary\n\nminimatch 11.0.3 through 11.0.7 retain the 256 most recent compiled `Minimatch` objects in a module-level cache. The cache is bounded only by entry count; each object can retain up to 100,000 expanded pattern rows. An application that passes untrusted, unique patterns to the top-level `minimatch()` function can therefore be terminated with a few very small inputs.\n\n## Root cause\n\nCommit `52d2aecceb71dae7f1b19675e74e044eb472c1e6` changed `minimatch()` to store each compiled object in a 256-entry `Map`. The key includes the complete pattern and options, so unique attacker-controlled patterns create distinct retained entries. There is no total cache-weight or per-entry expansion limit below the existing `braceExpandMax` default of 100,000.\n\nThe cache first ships in 11.0.3. Version 11.0.1 is a confirmed negative control.\n\n## Proof of concept\n\nInstall minimatch 11.0.4, save as `poc.mjs`, and run with `node --max-old-space-size=128 --expose-gc poc.mjs`:\n\n```js\nimport { minimatch } from 'minimatch'\n\nfor (let i = 0; i < 4; i++) {\n  const pattern = `{1..100000}/unique-${i}`\n  minimatch('no-match', pattern, { optimizationLevel: 2 })\n  global.gc()\n  console.log(i + 1, process.memoryUsage())\n}\n```\n\nOn 11.0.4, the process terminates with:\n\n```text\nFATAL ERROR: Ineffective mark-compacts near heap limit\nAllocation failed - JavaScript heap out of memory\n```\n\nThe same command exits normally on 11.0.1. With three calls and the normal heap limit, forced-GC heap grew from 4.36 MB to 112.27 MB and RSS from 50.9 MB to 262.7 MB.\n\nAs a smaller repeated control, ten independent processes each compiled ten unique 5,000-expansion patterns. On 11.0.4 the cached top-level function retained a median 17,371,504 heap bytes after forced GC. The direct `new Minimatch()` control retained 234,000 bytes, and the 11.0.1 top-level function showed no measurable retained-heap growth.\n\n## Impact\n\nApplications that accept attacker-controlled glob patterns and call the top-level `minimatch()` function can be crashed through memory exhaustion. Applications using only trusted patterns are not exposed. No confidentiality, integrity, filesystem, or code-execution impact is claimed.\n\nConfirmed affected: 11.0.3 through 11.0.7. No patched version is currently available.\n\n## Suggested remediation\n\nBound the cache by total retained weight or expansion count and do not cache large compiled patterns. Removing the global cache or making it opt-in for trusted patterns would also prevent the retention.\n\n## Duplicate review and disclosure\n\nPublic issues, pull requests, and advisories were searched for cache retention, OOM, `braceExpandMax`, and the 256-pattern cache. Issues #269 and #270 discuss caching performance but do not document this retention/OOM condition.\n\nOpenAI Codex assisted with source review, local reproduction, negative controls, version analysis, duplicate checks, and drafting. All tests were local; no external service was contacted. The account owner reviewed the evidence and explicitly authorized this private submission.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "minimatch"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "11.0.3"
      }, {
        "fixed" : "11.0.8"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 11.0.7"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/minimatch/security/advisories/GHSA-hqmv-qgp3-jx75"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-140007"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/minimatch/commit/d70a7bbc73140bd771daf5c30869b28dbc48929c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/isaacs/minimatch"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-01T18:05:29Z",
    "nvd_published_at" : "2026-11-30T22:17:30Z"
  }
}