brace-expansion DoS via unbounded expansion length causing an out-of-memory process crash
juliangruber brace-expansion
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| brace-expansion npm |
|
|
juliangruber brace-expansion
| Product | Affected | Fixed in |
|---|---|---|
| brace-expansion npm |
|
|
brace-expansion through 5.0.7 is vulnerable to denial of service via memory exhaustion. The expand() function limits the number of results with a max option (default 100,000) but does not bound the length of each result string. By chaining multiple brace groups, an attacker keeps the result count under the limit while making each result progressively longer, so total memory scales with both count and string length until the process hits a fatal, uncatchable out-of-memory error. About 7.5 KB of input ('{a,b}'.repeat(1500)) crashes a default Node.js process. Any application that passes attacker-influenced strings to brace-expansion.expand() - directly or transitively via minimatch / glob brace patterns - can be crashed by a small request. Fixed in 5.0.8 by adding a maxLength option (default 4,000,000) that bounds accumulated output and intermediate arrays.
From the CVE record · seal
brace-expansion can exhaust memory because expand() limits the number of results but not their length. An attacker who can influence strings passed to expand(), directly or through minimatch or glob brace patterns, can crash the application with a small input; no authentication or user interaction requirement is specified.
Check applications using npm brace-expansion versions <1.1.17, >=2.0.0 <2.1.3, >=3.0.0 <3.0.3, or >=4.0.0 <5.0.8.