Improper Encoding or Escaping of Output Affecting minimatch package, versions >=7.4.0 <11.0.8


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.29% (23rd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-MINIMATCH-23184402
  • published1 Dec 2026
  • disclosed30 Nov 2026
  • creditagntflw

Introduced: 30 Nov 2026

NewCVE-2026-140006  (opens in a new tab)
CWE-116  (opens in a new tab)

How to fix?

Upgrade minimatch to version 11.0.8 or higher.

Overview

minimatch is a minimal matching utility.

Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output via minimatch.escape() in src/escape.ts, which fails to neutralize four classes of special input before the result is used as a glob pattern. A leading ! passes through unescaped and becomes a negation operator, causing the pattern to match every path except the intended literal. A leading # passes through and becomes a comment, causing the pattern to match nothing. When the escaped output is combined with a brace group (either caller-supplied or present in the user text itself), brace-expansion collapses the \\ escape sequence and reactivates the following magic character (such as *), widening the match. With { windowsPathsNoEscape: true, magicalBraces: true }, brace-literal encoding using character classes ([{]) is misinterpreted by brace-expansion, producing patterns that match unintended strings and fail to match the intended literal. Applications that pass attacker-controlled text through escape() and use the result for authorization, filtering, or path-selection decisions may grant or deny access to unintended paths.

Workaround

Until upgrading, the following per-behavior mitigations can be applied (each measured on 11.0.5):

  • Behaviors 1 and 2 (leading ! and #): pass { nonegate: true, nocomment: true } when matching escaped patterns.
  • Behavior 3 (escaped backslash plus brace group): do not combine escaped text with a brace group, and use { magicalBraces: true } so user braces are escaped. Alternatively, pass nobrace: true to stop the over-match, but note that the caller's brace group then also becomes literal.
  • Behavior 4 (windowsPathsNoEscape + magicalBraces): pass nobrace: true when matching.

CVSS Base Scores

version 4.0
version 3.1