Dec 1, 2026·11 min read·1 visit
minimatch versions 11.0.0 through 11.0.6 contain an O(N^2) quadratic time complexity flaw in mergeRows() during glob pattern compilation. Supplying long patterns with repeated wildcards blocks the Node.js event loop, causing an unauthenticated Denial of Service. Upgrade to minimatch 11.0.7 to resolve the issue.
An algorithmic complexity vulnerability (CWE-407) in the JavaScript glob-matching package minimatch affects versions 11.0.0 through 11.0.6. The flaw originates in the mergeRows() optimization method in src/index.ts, which repeatedly clones and joins entire pattern arrays across every wildcard segment position. This creates quadratic O(N^2) compilation overhead for patterns containing repeated slash-separated wildcards, blocking the single-threaded Node.js event loop and resulting in an unauthenticated Denial of Service.
minimatch is a foundational glob-matching library within the Node.js ecosystem used to convert shell glob expressions into JavaScript RegExp objects and compiled state machines. It is deployed across build pipelines, static asset servers, file-watching utilities, and HTTP reverse proxies to filter file paths and route rules. When applications expose path filtering or pattern matching functionality to external users, minimatch compilation becomes directly reachable from untrusted input.
CVE-2026-140008 (also tracked as GHSA-cf2h-pxjq-68xw) is an inefficient algorithmic complexity vulnerability (CWE-407) affecting minimatch versions 11.0.0 through 11.0.6. The defect was introduced in commit 6f9f13168f7172d2ef824eef6c3a47e1517ae94a, which implemented a glob row merging optimization via the mergeRows() method in src/index.ts. This optimization aimed to consolidate redundant path traversal rows generated by brace expansion and wildcard combinations before executing filesystem walks.
Due to an inefficient key-generation mechanism inside mergeRows(), compiling a glob pattern with $N$ slash-separated wildcard segments requires $O(N^2)$ string copying and concatenation operations. Notably, the vulnerable routine executes even when a pattern expands into only a single row where no merging is mathematically possible. When combined with brace expansions that generate $R$ distinct pattern rows, the algorithmic complexity scales to $O(R \times N^2)$.
Because JavaScript code in Node.js executes synchronously on a single-threaded event loop, invoking new Minimatch(pattern) or related compilation entry points with a pattern containing several thousand wildcard segments monopolizes CPU execution. During this compilation window, the Node.js runtime cannot process incoming network connections, timers, or I/O callbacks, resulting in an application-wide Denial of Service (DoS).
During pattern compilation, minimatch splits brace-expanded glob expressions into a two-dimensional array of path segments stored in this.globParts and a corresponding set of compiled matchers in this.set. Each inner array represents a row of slash-delimited path portions. The mergeRows() method iterates over these rows to identify subsets that are identical at every segment position except for a specific index $k$, allowing those rows to be combined into a single extglob expression at position $k$.
In vulnerable versions (11.0.0 to 11.0.6), mergeRows() determines whether rows match outside of index $k$ by constructing a string lookup key for a Map<string, number[]>() grouping table. For every segment position $k$ from $0$ to len - 1 (where len is the maximum number of slash-separated segments $N$), the method iterates through every row $i$ in this.set and checks whether the segment at row[k] is an instance of Matcher or PENDING and passes the extSafe() check.
To build the comparison key for row $i$ at index $k$, the implementation clones the entire row array using the spread operator (const parts = [...this.globParts[i]!]), overwrites the element at index $k$ with an empty string (parts[k] = ''), and joins the entire array back into a single slash-delimited string (parts.join('/')). Both the array cloning and the join('/') operation require iterating over all $N$ elements of the row, incurring an $O(N)$ time and memory allocation cost per execution.
Because this $O(N)$ array duplication and string serialization occurs inside the outer loop that runs $N$ times (once for each wildcard position $k$), the total work performed per row is $\mathcal{O}(N \times N) = \mathcal{O}(N^2)$. Furthermore, mergeRows() lacked an early-exit guard for single-row patterns (this.set.length < 2). Consequently, a simple pattern consisting solely of repeated wildcards (*/*/*...) with no brace expansions still undergoes the full $O(N^2)$ key construction pass across every segment position.
The vulnerability resides in the mergeRows() method of the Minimatch class within src/index.ts. In versions 11.0.0 through 11.0.6, the grouping logic relied on full-row array spreads and string concatenation inside nested loops:
// Vulnerable implementation in src/index.ts (minimatch 11.0.0 - 11.0.6)
let merged = true
while (merged) {
merged = false
const len = Math.max(0, ...this.set.map(r => r.length))
for (let k = 0; k < len; k++) {
// the rows that are the same other than at portion k
const groups = new Map<string, number[]>()
this.set.forEach((row, i) => {
if (
!(row[k] instanceof Matcher || row[k] === PENDING) ||
!extSafe(this.globParts[i]![k]!)
) {
return
}
// BUG: O(N) array copy and O(N) string join inside an O(N) loop over k
const parts = [...this.globParts[i]!]
parts[k] = ''
const key = `${row.length}/${parts.join('/')}`
const g = groups.get(key)
if (g) g.push(i)
else groups.set(key, [i])
})
// ... row merging logic ...
}
}Commit 8a26917fa43e2b865dd6017f7acf6ac2fd5190cd resolves the flaw through two structural changes. First, it introduces an immediate bounds check (if (this.set.length < 2) return) at the start of the while loop and immediately following any row drop operation. This eliminates all mergeRows() processing for single-row patterns that do not use brace expansion.
// Patched implementation in src/index.ts (minimatch 11.0.7)
let merged = true
while (merged) {
merged = false
// FIX 1: Early exit if fewer than 2 rows exist; a single row cannot merge
if (this.set.length < 2) return
let keys = this.#mergeKeys()
const len = Math.max(0, ...this.set.map(r => r.length))
for (let k = 0; k < len; k++) {
const groups = new Map<number, number[]>()
const R = this.set.length + 1
this.set.forEach((row, i) => {
if (
!(row[k] instanceof Matcher || row[k] === PENDING) ||
!extSafe(this.globParts[i]![k]!)
) {
return
}
// FIX 2: O(1) numeric key lookup using precomputed prefix and suffix IDs
const { pre, suf } = keys[i]!
const key = pre[k]! * R + suf[k + 1]!
const g = groups.get(key)
if (g) g.push(i)
else groups.set(key, [i])
})
// ...
if (drop.size) {
merged = true
this.set = this.set.filter((_, i) => !drop.has(i))
this.globParts = this.globParts.filter((_, i) => !drop.has(i))
if (this.set.length < 2) return
keys = this.#mergeKeys()
}
}
}Second, the patch introduces the private #mergeKeys() helper method, which replaces string concatenation with a linear-time $O(R \times N)$ dynamic programming approach. #mergeKeys() assigns unique integer IDs to each distinct path segment string across all rows. It then performs a forward pass ($k = 0 \dots len - 1$) to compute cumulative prefix IDs (pre[k] representing segments $0..k$) and a backward pass ($k = len - 1 \dots 0$) to compute cumulative suffix IDs (suf[k] representing segments $k..n$).
// Linear-time prefix/suffix ID computation added in commit 8a26917fa43e2b865dd6017f7acf6ac2fd5190cd
#mergeKeys(): { pre: number[]; suf: number[] }[] {
const partIds = new Map<string, number>()
const ids = this.globParts.map(parts =>
parts.map(s => {
let id = partIds.get(s)
if (id === undefined) partIds.set(s, (id = partIds.size))
return id
}),
)
const P = partIds.size
const len = Math.max(0, ...ids.map(r => r.length))
const keys = ids.map(r => ({
pre: [0] as number[],
suf: new Array<number>(r.length + 1).fill(0),
}))
for (let k = 0; k < len; k++) {
const m = new Map<number, number>()
ids.forEach((r, i) => {
if (k >= r.length) return
const { pre } = keys[i]!
const key = pre[k]! * P + r[k]!
let id = m.get(key)
if (id === undefined) m.set(key, (id = m.size + 1))
pre.push(id)
})
}
for (let k = len - 1; k >= 0; k--) {
const m = new Map<number, number>()
ids.forEach((r, i) => {
if (k >= r.length) return
const { suf } = keys[i]!
const key = suf[k + 1]! * P + r[k]!
let id = m.get(key)
if (id === undefined) m.set(key, (id = m.size + 1))
suf[k] = id
})
}
return keys
}With pre and suf precomputed in $O(R \times N)$ time, two rows are identical outside of index $k$ if and only if they share the exact same prefix ID pre[k] and suffix ID suf[k + 1] and have identical total lengths (which is implicitly encoded by suf[k + 1] because suffix numbering starts from the end of each row). Inside the main for (let k = 0; k < len; k++) loop, computing the lookup key pre[k]! * R + suf[k + 1]! is an $O(1)$ arithmetic operation, reducing the entire mergeRows() pass per merge iteration from $O(R \times N^2)$ to $O(R \times N)$.
> [!NOTE]
> Fix Completeness Assessment: The patch completely resolves the quadratic complexity in mergeRows(). Because pre[k] and suf[k + 1] are bounded by this.set.length + 1 ($R$), the composite numeric key pre[k] * R + suf[k + 1] is bounded by $R^2$. Since minimatch limits total brace expansion permutations before reaching mergeRows(), $R^2$ remains well within Number.MAX_SAFE_INTEGER ($2^{53} - 1$), preventing integer hash collisions. Furthermore, recalculating keys = this.#mergeKeys() only occurs when drop.size > 0 (at most $R - 1$ times total), bounding the worst-case overall runtime to $O(R^2 \times N)$ when rows repeatedly merge.
Exploiting CVE-2026-140008 requires no authentication or specialized privileges if an application exposes an endpoint or configuration parser that passes user-controlled strings into new Minimatch(pattern), minimatch(target, pattern), or minimatch.filter(pattern). The attacker constructs a string containing thousands of slash-separated wildcard segments (*/*/*...) and submits it to the target application.
In a single-row attack scenario, an input of 16,000 wildcard segments (a payload of 31,999 bytes) forces mergeRows() to execute 16,000 outer iterations. In each iteration, an array of 16,000 elements is cloned and joined into a ~32 KB string, resulting in $2.56 \times 10^8$ array element operations and allocating roughly 512 MB of short-lived string objects on the V8 heap. This triggers both CPU saturation and frequent V8 garbage collection pauses.
import { Minimatch } from 'minimatch'
import { performance } from 'node:perf_hooks'
// Proof of Concept 1: Single-row wildcard pattern (31,999 bytes)
const singleRowPattern = Array(16000).fill('*').join('/')
const startSingle = performance.now()
new Minimatch(singleRowPattern)
const elapsedSingle = performance.now() - startSingle
console.log(`Single-row compilation took: ${Math.round(elapsedSingle)} ms`)
// Proof of Concept 2: Multi-row brace expansion pattern
// Bypasses single-row checks and multiplies workload across 16 rows
const stars = Array(8000).fill('*').join('/')
const words = Array.from({ length: 16 }, (_, i) => `w${i}`).join(',')
const multiRowPattern = `{${words}}*/${stars}`
const startMulti = performance.now()
new Minimatch(multiRowPattern)
const elapsedMulti = performance.now() - startMulti
console.log(`Multi-row compilation took: ${Math.round(elapsedMulti)} ms`)As shown in the second proof-of-concept vector above (adapted from the upstream regression test suite in test/merge-rows.ts), an attacker can combine a leading brace expansion {w0,w1,...,w15}* with a trailing chain of wildcards. The brace expansion generates 16 distinct rows of 8,001 segments each. Every segment position satisfies row[k] instanceof Matcher and extSafe(), forcing the grouping logic to evaluate all 16 rows across all 8,001 positions before merging them into @(w0*|w1*|...) at index 0.
In vulnerable versions (<= 11.0.6), executing either payload blocks the Node.js process for tens of seconds per request. In patched version 11.0.7, the single-row payload returns instantaneously via the this.set.length < 2 check, and the 16-row brace-expanded payload compiles in under 200 milliseconds.
The primary impact of CVE-2026-140008 is high availability degradation (Denial of Service) against the vulnerable service. Because Node.js processes client requests concurrently on a single event loop thread by interleaving asynchronous I/O, any synchronous CPU-bound calculation that runs for multiple seconds halts request handling for all connected clients. Health check probes (such as Kubernetes liveness and readiness checks) will time out, potentially triggering cascading container restarts.
Under CVSS v4.0, this vulnerability is scored at 8.7 (High) with the vector 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. The score reflects that the attack is executable over the network (AV:N) with low complexity (AC:L), no special attack requirements (AT:N), no required privileges (PR:N), and no user interaction (UI:N). While confidentiality (VC:N) and integrity (VI:N) are unaffected, the impact to vulnerable system availability is high (VA:H).
The Exploit Prediction Scoring System (EPSS) assigns CVE-2026-140008 a score of 0.00527 (0.53% probability of exploitation in the wild within 30 days), placing it in the 46.12th percentile. The vulnerability is not currently listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, and no standalone weaponized exploit modules have been published to Exploit-DB or Metasploit.
Downstream exposure is concentrated in applications that upgrade directly or transitively to the minimatch 11.x release line (which requires Node.js 20 or higher) and allow users to supply custom filter expressions, workspace search globs, or dynamic proxy routing rules.
To remediate CVE-2026-140008, upgrade minimatch to version 11.0.7 or later. This release incorporates commit 8a26917fa43e2b865dd6017f7acf6ac2fd5190cd, which replaces the quadratic string-joining key construction with the linear-time #mergeKeys() prefix and suffix indexing algorithm.
For projects declaring minimatch as a direct dependency, update the package via npm:
npm install minimatch@^11.0.7If minimatch 11.0.0 through 11.0.6 is pulled into the dependency tree transitively by another package, enforce version resolution using the overrides field in package.json (for npm) or resolutions (for Yarn/pnpm):
{
"overrides": {
"minimatch": "^11.0.7"
}
}In environments where an immediate dependency upgrade cannot be deployed, implement strict input validation before passing external strings to minimatch functions. Restrict user-supplied glob patterns to a reasonable maximum length (for example, 256 characters) and limit the maximum number of path separator segments (/). Even with linear-time compilation, bounding untrusted glob length and complexity is a recommended defense-in-depth practice to limit memory consumption during filesystem traversal.
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| Product | Affected Versions | Fixed Version |
|---|---|---|
minimatch isaacs | >= 11.0.0, < 11.0.7 | 11.0.7 |
| Attribute | Detail |
|---|---|
| CVE ID | CVE-2026-140008 (GHSA-cf2h-pxjq-68xw) |
| Weakness Class | CWE-407: Inefficient Algorithmic Complexity |
| CVSS v4.0 Score | 8.7 High (AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H) |
| EPSS Score | 0.53% (46.12th Percentile) |
| Affected Versions | minimatch >= 11.0.0, < 11.0.7 |
| Patched Version | minimatch 11.0.7 |
| Primary Impact | Unauthenticated Denial of Service via Node.js Event Loop Blocking |
| CISA KEV Status | Not Listed |
The software contains an algorithm whose execution time or resource consumption grows disproportionately relative to input size, permitting resource exhaustion.
A denial-of-service vulnerability exists in the Go library github.com/blakesmith/ar across all released versions. The archive header parser fails to validate that the 10-byte decimal size field of an archive member is non-negative. When an application processes a crafted Unix ar archive (such as a .deb package or .rlib archive) containing a negative member size, a subsequent read operation attempts to reslice an internal byte buffer using the negative integer as the upper bound. This triggers an unhandled Go runtime slice bounds out-of-range panic, terminating the calling process.
Vite+ (vp) versions 0.2.9 through 1.5.0 contain an integrity verification flaw (CWE-494) in the internal package manager bootstrap mechanism. When initializing in an environment where the pinned pnpm distribution is not cached, the runtime queries the registry specified in the local workspace's .npmrc file and validates the downloaded tarball exclusively against the self-reported integrity digest provided by that same registry. An attacker who supplies a repository with a malicious .npmrc pointing to an attacker-controlled registry can achieve arbitrary code execution when a developer or CI runner invokes basic vp commands.
A local OS command injection and dynamic code evaluation vulnerability (CWE-78 / CWE-95) exists in the Vite+ global command-line interface (vp) across versions 0.3.3 through 1.5.0. When resolving package manager dist-tags such as 'latest' with the '--no-install' flag enabled, Vite+ queries the npm registry defined in the local workspace's '.npmrc' file and returns the raw version string without semantic version validation. Because this unvalidated string is interpolated directly into shell environment export statements evaluated by the user's shell wrapper, an attacker controlling the registry can inject shell metacharacters to achieve arbitrary command execution in the developer's local terminal context.
CVE-2026-137196 (also tracked as GHSA-qxr8-q827-836c) is an asymmetric resource consumption and denial-of-service vulnerability affecting the npm package glob (node-glob) in versions 13.0.5 through 14.0.5. When processing primary search patterns, node-glob relies on the minimatch engine with a default safeguard parameter (braceExpandMax: 10_000) to prevent combinatorial explosions during shell brace and directory traversal expansion. However, the Ignore class in src/ignore.ts instantiated its internal minimatch options with optimizationLevel: 2 while omitting the braceExpandMax configuration property. Consequently, applications that pass untrusted input into the ignore option allow attackers to trigger unbounded pattern expansion and quadratic O(n^2) preprocessing loops inside secondPhasePreProcess(), leading to single-threaded Node.js event-loop starvation.
Hugo versions prior to 0.170.0 contain a path traversal and improper symlink resolution vulnerability in the module resolution and vendoring subsystem. By supplying relative traversal sequences in `_vendor/modules.txt` or crafting symbolic links within vendored directory hierarchies, an untrusted third-party theme or Hugo module can bind its module root to an arbitrary directory on the build host. During site compilation, template functions such as `readFile` can access and render sensitive files from the host filesystem into the generated static output.
A stored Cross-Site Scripting (XSS) vulnerability in the Hugo static site generator (versions 0.140.2 prior to 0.170.0) allows content authors to inject arbitrary HTML and JavaScript into generated pages. The flaw resides in the syntax highlighting component (`markup/highlight/highlight.go`), where the `wrapperClass` option is concatenated directly into an HTML `<div class="...">` attribute without HTML entity escaping. Because shortcodes and code fence attributes bypass Goldmark's raw HTML sanitization rules, untrusted contributors in multi-author workflows can achieve client-side script execution in the browsers of site visitors.