Packages / micromatch / Security

ModerateVulnerabilityGHSA-952p-6rrq-rcjvCVE-2024-4067Published 14 May 2024

Regular Expression Denial of Service (ReDoS) in micromatch

Your version

Affected releases · micromatch

  • 4.x4.0.0 – 4.0.7Fixed in 4.0.8
  • 3.x and older0.1.0 – 3.1.10No fix, no longer updated

On 4.x, the newest line:

npm install micromatch@4.0.8
Every release on a timeline
4.x
  1. Affected

    4.0.0 – 4.0.7

    8 releases

  2. Fixed

    4.0.8

    1 release, latest

3.x
  1. Affected

    3.0.0 – 3.1.10

    17 releases

2.x
  1. Affected

    2.0.0 – 2.3.11

    21 releases

1.x
  1. Affected

    1.0.0 – 1.6.2

    18 releases

0.x
  1. Affected

    0.1.0 – 0.2.2

    4 releases

69 stable releases of micromatch, oldest to newest, one row per major.

What happens

The NPM package micromatch prior to version 4.0.8 is vulnerable to Regular Expression Denial of Service (ReDoS). The vulnerability occurs in micromatch.braces() in index.js because the pattern .* will greedily match anything. By passing a malicious payload, the pattern matching will keep backtracking to the input while it doesn't find the closing bracket. As the input size increases, the consumption time will also increase until it causes the application to hang or slow down. There was a merged fix but further testing shows the issue persisted prior to #266. This issue should be mitigated by using a safe pattern that won't start backtracking the regular expression due to greedy matching.

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.