Packages / minimatch / Security
minimatch has potential denial of service via globparts amplification
Affected releases · minimatch
- 11.x11.0.0Fixed in 11.0.1
- 10.x10.0.0 – 10.2.6No fix on this line yet
- 9.x9.0.0 – 9.0.9No fix on this line yet
- 8.x8.0.0 – 8.0.7No fix on this line yet
- 7.x7.0.0 – 7.4.9No fix on this line yet
On 11.x, the newest line:
npm install minimatch@11.0.1Every release on a timeline
Affected
11.0.0
1 release
Fixed
11.0.1 – 11.0.9
9 releases, latest
Affected
10.0.0 – 10.2.6
15 releases
Affected
9.0.0 – 9.0.9
10 releases
Affected
8.0.0 – 8.0.7
8 releases
Affected
7.0.0 – 7.4.9
19 releases
What happens
minimatch 10.2.6 contains an attacker-controlled pattern amplification in firstPhasePreProcess() when optimizationLevel >= 2.
researcher: Reid Downing (b1nv0id) files:
src/index.ts: 690-770
src/index.ts: 780-796
issue: input-controlled growth of globParts during first-phase preprocessing, followed by quadratic second-phase processing.
the **/../ transformation clones a globparts entry and appends the clone to the same globparts array:
parts.splice(gs, 1) const other = parts.slice(0) other[gs] = '**' globParts.push(other)
this occurs inside a do...while (didSomething) fixpoint loop, allowing generated entries to be processed again.
the expanded globparts array is subsequently processed by secondPhasePreProcess(), which performs pairwise comparisons:
for (let i = 0; i < globParts.length - 1; i++) {
for (let j = i + 1; j < globParts.length; j++) {
this.partsMatch(...)
}
}an attacker who can supply a glob pattern can therefore cause additional pattern entries to be generated during preprocessing, followed by quadratic pairwise processing, resulting in excessive cpu and memory consumption.
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.