CVE-2026-140006

Authorization Bypass
Affects
minimatch
in
No items found.
Versions
>=7.4.0 <11.0.8

Patch Available.

Overview

minimatch is a glob matching utility for JavaScript. It is the matching library used internally by node-glob.

An authorization bypass vulnerability (CVE-2026-140006) has been identified in the minimatch.escape() function, which allows attackers who control text that an application escapes and then uses as a glob pattern to make that pattern match paths other than the literal input. An escaped pattern can match more paths than intended, which opens an allowlist, or match nothing, which empties a denylist or ignore list.

Per OWASP: Access control enforces policy such that users cannot act outside of their intended permissions. Failures typically lead to unauthorized information disclosure, modification, or destruction of all data or performing a business function outside the user's limits.

This issue affects minimatch versions 7.4.0 and greater, before 11.0.8.

Details

Module Info

Vulnerability Info

This Medium-severity vulnerability is found in the minimatch package in minimatch versions 7.4.0 and greater, before 11.0.8. minimatch.escape() is documented to escape all magic characters in a glob pattern so that the result only ever matches the literal string. Applications use it to embed untrusted text, such as a user-supplied file name, in a pattern that is then used for authorization, filtering or path selection. The function only replaces characters with a regular expression:

export const escape = (
  s: string,
  {
    windowsPathsNoEscape = false,
    magicalBraces = false,
  }: Pick<MinimatchOptions, 'windowsPathsNoEscape' | 'magicalBraces'> = {},
) => {
  // don't need to escape +@! because we escape the parens
  // that make those magic, and escaping ! as [!] isn't valid,
  // because [!]] is a valid glob class meaning not ']'.
  if (magicalBraces) {
    return windowsPathsNoEscape ?
        s.replace(/[?*()[\]{}]/g, '[$&]')
      : s.replace(/[?*()[\]\\{}]/g, '\\$&')
  }
  return windowsPathsNoEscape ?
      s.replace(/[?*()[\]]/g, '[$&]')
    : s.replace(/[?*()[\]\\]/g, '\\$&')
}

No branch handles the first character of the pattern. A leading ! is left as it is, and when the pattern is parsed every leading ! makes it a negated pattern. escape('!secret.txt') returns !secret.txt, which matches every path except secret.txt, for example passwd. A leading # is also left as it is, and a pattern that starts with # is a comment that matches nothing. escape('#notes.md') returns #notes.md, which does not even match #notes.md.

Escaped backslashes do not survive brace expansion either. When a pattern contains a {...} group, braceExpand() passes the whole pattern to the brace-expansion library:

export const braceExpand = (
  pattern: string,
  options: MinimatchOptions = {},
) => {
  assertValidPattern(pattern)

  if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
    // shortcut. no need to expand.
    return [pattern]
  }

  return expand(pattern, { max: options.braceExpandMax })
}

brace-expansion turns each escaped backslash \\ back into a single \, which then escapes the next character instead. For the user text x\*, escape() returns x\\\*. With a brace group in the pattern, whether appended by the application (escape(input) + '.{js,ts}') or supplied in the user text itself with default options, the expanded pattern is x\\*.js: a literal backslash followed by a live * wildcard, which matches x\anything.js. With both windowsPathsNoEscape and magicalBraces set, escape() writes a literal brace as [{] or [}], but brace-expansion does not know about [...] classes and still expands x[{]a,b[}] into x[]a] and x[b[], so the pattern matches xa and not x{a,b}.

Steps to Reproduce

1. Install an affected version: npm install minimatch@11.0.7.

2. Run the following script with Node.js:

import { minimatch } from 'minimatch'

const allow = minimatch.escape('!secret.txt')
console.log(minimatch('passwd', allow)) // true: the escaped literal matches another file

const deny = minimatch.escape('#notes.md')
console.log(minimatch('#notes.md', deny)) // false: the escaped literal matches nothing

const withBraces = minimatch.escape('x\\*') + '.{js,ts}'
console.log(minimatch('x\\anything.js', withBraces)) // true: the escaped '*' is a wildcard again

3. Each line prints the opposite of what a literal-only pattern should return.

Mitigation

Upstream supports minimatch versions earlier than 11 only under a paid commercial contract, so those versions are not expected to receive public updates to address this issue. For more information, see here.

Users of the affected components should apply one of the following mitigations:

  • Upgrade affected applications to a supported minimatch release that contains the fix.
  • Leverage a commercial support partner like HeroDevs for post-EOL security support.

Credits

No items found.
Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
Medium
ID
CVE-2026-140006
PROJECT Affected
minimatch
Versions Affected
>=7.4.0 <11.0.8
NES Versions Affected
Published date
November 30, 2026
≈ Fix date
Fixed in
Category
Authorization Bypass
Vex Document
Download VEXHow do I use it?
Sign up for the latest vulnerability alerts fixed in
Rss feed icon
Subscribe via RSS
or

By submitting the form I acknowledge receipt of our Privacy Policy.

Thanks for signing up for our Newsletter! We look forward to connecting with you.
Oops! Something went wrong while submitting the form.