Packages / minimatch / Security

HighVulnerabilityGHSA-3ppc-4f35-3m26CVE-2026-26996Published 18 Feb 2026

minimatch has a ReDoS via repeated wildcards with non-matching literal in pattern

Your version

Affected releases · minimatch

  • 10.x10.0.0 – 10.2.0Fixed in 10.2.1
  • 9.x9.0.0 – 9.0.5Fixed in 9.0.6
  • 8.x8.0.0 – 8.0.4Fixed in 8.0.5
  • 7.x7.0.0 – 7.4.6Fixed in 7.4.7
  • 6.x6.0.0 – 6.2.0Fixed in 6.2.1
  • 5.x5.0.0 – 5.1.6Fixed in 5.1.7
  • 4.x4.0.0 – 4.2.3Fixed in 4.2.4
  • 3.x3.0.0 – 3.1.2Fixed in 3.1.3
  • 2.x and older0.0.1 – 2.0.10No fix, no longer updated

On 10.x, the newest line:

npm install minimatch@10.2.1
Every release on a timeline
11.x
  1. Not affected

    11.0.0 – 11.0.9

    10 releases, latest

10.x
  1. Affected

    10.0.0 – 10.2.0

    9 releases

  2. Fixed

    10.2.1 – 10.2.6

    6 releases

9.x
  1. Affected

    9.0.0 – 9.0.5

    6 releases

  2. Fixed

    9.0.6 – 9.0.9

    4 releases

8.x
  1. Affected

    8.0.0 – 8.0.4

    5 releases

  2. Fixed

    8.0.5 – 8.0.7

    3 releases

7.x
  1. Affected

    7.0.0 – 7.4.6

    16 releases

  2. Fixed

    7.4.7 – 7.4.9

    3 releases

6.x
  1. Affected

    6.0.0 – 6.2.0

    17 releases

  2. Fixed

    6.2.1 – 6.2.3

    3 releases

5.x
  1. Affected

    5.0.0 – 5.1.6

    9 releases

  2. Fixed

    5.1.7 – 5.1.9

    3 releases

4.x
  1. Affected

    4.0.0 – 4.2.3

    7 releases

  2. Fixed

    4.2.4 – 4.2.6

    3 releases

3.x
  1. Affected

    3.0.0 – 3.1.2

    11 releases

  2. Fixed

    3.1.3 – 3.1.5

    3 releases

2.x
  1. Affected

    2.0.0 – 2.0.10

    11 releases

1.x
  1. Affected

    1.0.0

    1 release

0.x
  1. Affected

    0.0.1 – 0.4.0

    25 releases

155 stable releases of minimatch, oldest to newest, one row per major.

What happens

Summary

minimatch is vulnerable to Regular Expression Denial of Service (ReDoS) when a glob pattern contains many consecutive * wildcards followed by a literal character that doesn't appear in the test string. Each * compiles to a separate [^/]*? regex group, and when the match fails, V8's regex engine backtracks exponentially across all possible splits.

The time complexity is O(4^N) where N is the number of * characters. With N=15, a single minimatch() call takes ~2 seconds. With N=34, it hangs effectively forever.

Details

Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer.

PoC

When minimatch compiles a glob pattern, each * becomes [^/]*? in the generated regex. For a pattern like ***************X***:

/^(?!\.)[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?X[^/]*?[^/]*?[^/]*?$/

When the test string doesn't contain X, the regex engine must try every possible way to distribute the characters across all the [^/]*? groups before concluding no match exists. With N groups and M characters, this is O(C(N+M, N)) — exponential.

Impact

Any application that passes user-controlled strings to minimatch() as the pattern argument is vulnerable to DoS. This includes:

  • File search/filter UIs that accept glob patterns

  • .gitignore-style filtering with user-defined rules

  • Build tools that accept glob configuration

  • Any API that exposes glob matching to untrusted input


Thanks to @ljharb for back-porting the fix to legacy versions of minimatch.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.