CVE-2026-140007: minimatch: Global pattern cache retains large expansions, enabling memory exhaustion

Published Nov 30, 2026
·
Updated

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.

Other sources

minimatch is a minimal matching utility for converting glob expressions into JavaScript RegExp objects. From 11.0.3 until 11.0.8, the top-level minimatch() function stores compiled Minimatch objects in a module-level 256-entry Map whose entries are bounded by count but not by retained expansion weight below the braceExpandMax ceiling. An application that accepts unique attacker-controlled glob patterns can retain objects containing up to 100,000 expanded rows per entry, causing memory exhaustion and process termination; direct construction with new Minimatch() is not affected by this cache behavior. This issue is fixed in version 11.0.8.

— MITRE

Affected Software

7 affected componentsFixes available
npm/minimatch>=11.0.3<11.0.8
npm/minimatch>=11.0.3<=11.0.7
11.0.8
npm/minimatch>=11.0.3<11.0.8
11.0.8
debian/node-minimatch*
debian/node-minimatch*
debian/node-minimatch*
debian/node-minimatch<=5.1.1+~5.1.2-1, <=9.0.3-6, <=9.0.7-2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/minimatch to a version that resolves this vulnerability.

    Fixed in 11.0.8
  2. Compensating control

    Bound the minimatch compiled-pattern cache by total retained weight or expansion count, and do not cache large compiled patterns.

Event History

Nov 30, 2026
CVE Published
via MITRE·09:35 PM
Data Sourced
via MITRE·09:35 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:17 PM
DescriptionSeverityWeakness
Dec 1, 2026
Advisory Published
via GitHub·06:05 PM
Data Sourced
via GitHub·06:05 PM
DescriptionSeverityWeaknessAffected Software
Dec 2, 2026
Data Sourced
via OSV·10:00 AM
Affected Software
Dec 3, 2026
Exploit Published
via CISA·03:55 PM

Frequently Asked Questions

1

Which applications are realistically exposed to memory exhaustion?

Applications using minimatch() versions 11.0.3 through 11.0.7 are exposed if they accept unique, attacker-controlled glob patterns. The risk is specifically tied to the top-level minimatch() cache retaining large brace-expansion results.

2

What does an attacker need to exploit this issue?

An attacker needs network access to an application endpoint or workflow that passes attacker-controlled, unique glob patterns to the top-level minimatch() function. Exploitation requires high attack complexity, but does not require privileges or user interaction.

3

Are applications using new Minimatch() affected?

No. Direct construction with new Minimatch() is not affected by the module-level cache behavior described here.

4

What can be done if upgrading is not immediately possible?

Avoid passing untrusted glob patterns to the top-level minimatch() function, particularly unique patterns with large brace expansions. Restricting or rejecting attacker-controlled brace expansion patterns can reduce the ability to fill the cache with high-memory entries.

5

How can I determine whether my application is affected?

Check whether it uses npm/minimatch version 11.0.3 through 11.0.7 and calls the top-level minimatch() function on glob patterns supplied by untrusted users or external inputs. Version 11.0.8 contains the fix.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203