Packages / micromatch / Security
Regular Expression Denial of Service (ReDoS) in micromatch
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.8Every release on a timeline
Affected
4.0.0 – 4.0.7
8 releases
Fixed
4.0.8
1 release, latest
Affected
3.0.0 – 3.1.10
17 releases
Affected
2.0.0 – 2.3.11
21 releases
Affected
1.0.0 – 1.6.2
18 releases
Affected
0.1.0 – 0.2.2
4 releases
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.