brace-expansion: Quadratic-time expansion of the `{a},b}` rewrite causes CPU denial of service
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 1.1.21, 2.1.7, 3.0.9, and 5.0.12, the expand function handles untrusted {a},b}-shaped patterns with many trailing closing braces by restarting its scan once for each trailing closing brace. The successive full-input rescans with linear working-string growth cause quadratic CPU time and memory pressure that can block the Node.js event loop. The process eventually recovers, making the impact a recoverable CPU denial of service. This issue is fixed in versions 1.1.21, 2.1.7, 3.0.9, and 5.0.12.
From the CVE record · GitHub_M
The brace-expansion expand function repeatedly rescans certain untrusted patterns with many trailing closing braces, causing quadratic CPU use and memory pressure. If an application passes attacker-controlled patterns to expand, the resulting work can temporarily block the Node.js event loop; the process eventually recovers.
Check applications using npm brace-expansion versions before 1.1.21, 2.1.0 through 2.1.6, 3.0.0 through 3.0.8, or 4.0.0 through 5.0.11.