{"id":"CVE-2026-141514","aliases":["GHSA-3924-r96c-gp9w"],"url":"https://o3.security/vulnerability/CVE-2026-141514","summary":"minimatch: Proto Key Bypasses Cache-Key Weighting in minimatch's Shared Matcher Cache","details":"### Summary\n\nminimatch's module-global matcher cache can be poisoned by a `__proto__` key in the `options` object passed to `minimatch()`. `optionsKey()` scores that key the same as no options at all, while `copyOptions()`'s bare `for...in` loop re-parents its copy onto the attacker's prototype instead of copying it as an own property — one caller doing this is enough to flip the cached matcher's case-sensitivity for every later, unrelated caller matching the same pattern string.\n\n\n### Details\n\n`src/index.ts:229-234`, `optionsKey()` has no `case '__proto__'`, so it falls through to `default` and contributes weight `0`:\n\n```ts\nconst optionsKey = (o: MinimatchOptions): number | string => {\n  for (const k in o) {\n    switch (k) {\n      // ... no 'case \"__proto__\":' branch ...\n      default:\n        n += (booleanWeights.get(k) ?? 0) * tri(v)\n```\n\n`src/index.ts:291-296`, `copyOptions()` copies with a plain assignment, not `Object.defineProperty`, so `__proto__` runs through the real setter instead of landing as an own key:\n\n```ts\nconst copyOptions = (o?: MinimatchOptions) => {\n  const copy: Record<string, unknown> = {}\n  for (const k in o) copy[k] = (o as Record<string, unknown>)[k]\n  return copy as MinimatchOptions\n}\n```\n\n`cachedMinimatch()` (`src/index.ts:298-323`) then stores the `Minimatch` built from the poisoned `copyOptions(options)` under the key `optionsKey(options)` returns — the same key a later, option-less call will look up. Neither function has the one missing check that matters here: special-case `__proto__` before it reaches assignment.\n\n\n### Proof of concept\n\n```js\nimport { minimatch } from 'minimatch'\n\nconst smuggled = JSON.parse('{\"__proto__\":{\"nocase\":true}}')\n// attacker's own call — nocase takes effect for them\nconst r1 = minimatch(file, patternLower, smuggled)\n...\n```\n\nThen, with no knowledge of the call above, a second, fully-trusted caller matches the same pattern with zero options:\n\n```js\n// SEPARATE caller, SAME pattern string, DEFAULT options\nconst r2 = minimatch(file, patternLower)\n```\n\n## Result\n\n```\nminimatch(\"FOO-....TXT\", \"foo-....txt\", smuggled) = true\nminimatch(\"FOO-....TXT\", \"foo-....txt\")  [no options]  = true  (expected false)\nminimatch(<untouched UPPER>, <untouched lower pattern>) [no options] = false  (expected false)\ncache-poisoned: true\nglobal Object.prototype polluted: NO\n```\n\n`r2 = true` is the proof: a second, independent call with no options at all gets back the attacker's poisoned matcher. The untouched-pattern control stays `false`, and `Object.prototype` itself is never touched — this is cache poisoning, not classic global prototype pollution.\n\n\n### Impact\n\nAny process that relies on the default, process-global `minimatch()` cache to evaluate security-relevant patterns (allow/deny lists, package-name filters) loses the integrity of that decision the moment one code path builds `options` from untrusted JSON — README.md's own stated default, \"compared case sensitively, unless `nocase:true` is set,\" breaks for a bystander caller. This is not remote code execution and not data disclosure — it's a single boolean match-outcome flip, scoped to the shared cache, that persists until the entry is evicted.\n\n## Suggested Fix\n\n```ts\n// copyOptions(): never let __proto__ become the copy's own prototype\nconst copyOptions = (o?: MinimatchOptions) => {\n  const copy = Object.create(null) as Record<string, unknown>\n  for (const k in o) if (k !== '__proto__') copy[k] = (o as Record<string, unknown>)[k]\n  return copy as MinimatchOptions\n}\n```","published":"2026-12-01T20:37:23.347Z","modified":"2026-12-04T04:45:14.991586103Z","cvss":{"score":3.7,"severity":"LOW","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N"},"epss":{"score":0.00575,"percentile":0.48913,"asOf":"2026-12-04"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"npm","name":"minimatch","fixedVersion":"11.0.10"}],"fix":{"url":"https://github.com/isaacs/minimatch/commit/1c1198638b1df8fa0d688b55380bbfbe59fee908","label":"isaacs/minimatch@1c11986"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/141xxx/CVE-2026-141514.json"},{"type":"ADVISORY","url":"https://github.com/isaacs/minimatch/security/advisories/GHSA-3924-r96c-gp9w"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-141514"},{"type":"FIX","url":"https://github.com/isaacs/minimatch/commit/1c1198638b1df8fa0d688b55380bbfbe59fee908"},{"type":"PACKAGE","url":"https://github.com/isaacs/minimatch"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-12-04T04:45:14.991586103Z"}}