brace-expansion: Zero-step sequence causes process hang and memory exhaustion
juliangruber brace-expansion
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| brace-expansion npm |
|
|
juliangruber brace-expansion
| Product | Affected | Fixed in |
|---|---|---|
| brace-expansion npm |
|
|
The brace-expansion library generates arbitrary strings containing a common prefix and suffix. Prior to versions 5.0.5, 3.0.2, 2.0.3, and 1.1.13, a brace pattern with a zero step value (e.g., `{1..2..0}`) causes the sequence generation loop to run indefinitely, making the process hang for seconds and allocate heaps of memory. Versions 5.0.5, 3.0.2, 2.0.3, and 1.1.13 fix the issue. As a workaround, sanitize strings passed to `expand()` to ensure a step value of `0` is not used.
From the CVE record · GitHub_M
The npm brace-expansion package can enter an indefinite sequence-generation loop when expand() receives a brace pattern with a zero step, such as {1..2..0}. An attacker who can supply a string passed to expand() could cause the process to hang and allocate large amounts of memory; the input does not specify whether this requires network access, authentication, or user interaction.
Teams using npm brace-expansion versions >=4.0.0 <5.0.5, >=3.0.0 <3.0.2, >=2.0.0 <2.0.3, or <1.1.13 should check their deployments.