NodeJS/brace-expansion/1.1.11


Brace expansion as known from sh/bash

https://www.npmjs.com/package/brace-expansion
MIT

2 Security Vulnerabilities

brace-expansion: Zero-step sequence causes process hang and memory exhaustion

Published date: 2026-03-26T18:29:42Z
CVE: CVE-2026-33750
Links:

Impact

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.

The loop in question:

https://github.com/juliangruber/brace-expansion/blob/daa71bcb4a30a2df9bcb7f7b8daaf2ab30e5794a/src/index.ts#L184

test() is one of

https://github.com/juliangruber/brace-expansion/blob/daa71bcb4a30a2df9bcb7f7b8daaf2ab30e5794a/src/index.ts#L107-L113

The increment is computed as Math.abs(0) = 0, so the loop variable never advances. On a test machine, the process hangs for about 3.5 seconds and allocates roughly 1.9 GB of memory before throwing a RangeError. Setting max to any value has no effect because the limit is only checked at the output combination step, not during sequence generation.

This affects any application that passes untrusted strings to expand(), or by error sets a step value of 0. That includes tools built on minimatch/glob that resolve patterns from CLI arguments or config files. The input needed is just 10 bytes.

Patches

Upgrade to versions - 5.0.5+

A step increment of 0 is now sanitized to 1, which matches bash behavior.

Workarounds

Sanitize strings passed to expand() to ensure a step value of 0 is not used.

Affected versions: ["1.1.12", "1.1.11", "1.1.10", "1.1.9", "1.1.8", "1.1.7", "1.1.6", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.0.1", "1.0.0", "0.0.0", "2.0.2", "2.0.1", "2.0.0", "3.0.1", "3.0.0", "5.0.4", "5.0.3", "5.0.2", "4.0.1", "4.0.0"]
Secure versions: [1.1.13, 2.0.3, 3.0.2, 5.0.5]
Recommendation: Update to version 5.0.5.

brace-expansion Regular Expression Denial of Service vulnerability

Published date: 2025-06-09T21:30:51Z
CVE: CVE-2025-5889
Links:

A vulnerability was found in juliangruber brace-expansion up to 1.1.11/2.0.1/3.0.0/4.0.0. It has been rated as problematic. Affected by this issue is the function expand of the file index.js. The manipulation leads to inefficient regular expression complexity. The attack may be launched remotely. The complexity of an attack is rather high. The exploitation is known to be difficult. The exploit has been disclosed to the public and may be used. Upgrading to version 1.1.12, 2.0.2, 3.0.1 and 4.0.1 is able to address this issue. The name of the patch is a5b98a4f30d7813266b221435e1eaaf25a1b0ac5. It is recommended to upgrade the affected component.

Affected versions: ["4.0.0", "3.0.0", "1.1.11", "1.1.10", "1.1.9", "1.1.8", "1.1.7", "1.1.6", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.0.1", "1.0.0", "2.0.1", "2.0.0"]
Secure versions: [1.1.13, 2.0.3, 3.0.2, 5.0.5]
Recommendation: Update to version 5.0.5.

30 Other Versions

Version License Security Released
5.0.5 MIT 2026-03-24 - 17:58 10 days
5.0.4 MIT 1 2026-02-27 - 09:37 about 1 month
5.0.3 MIT 1 2026-02-22 - 11:37 about 1 month
5.0.2 MIT 1 2026-02-12 - 08:18 about 2 months
4.0.1 MIT 1 2025-06-11 - 07:04 10 months
4.0.0 MIT 2 2024-02-27 - 11:56 about 2 years
3.0.2 MIT 2026-03-27 - 08:41 7 days
3.0.1 MIT 1 2025-06-11 - 08:44 10 months
3.0.0 MIT 2 2023-10-07 - 13:31 over 2 years
2.0.3 MIT 2026-03-27 - 08:40 7 days
2.0.2 MIT 1 2025-06-11 - 08:48 10 months
2.0.1 MIT 2 2021-02-22 - 16:18 about 5 years
2.0.0 MIT 2 2020-10-05 - 11:41 over 5 years
1.1.13 MIT 2026-03-27 - 08:39 7 days
1.1.12 MIT 1 2025-06-11 - 08:52 10 months
1.1.11 MIT 2 2018-02-10 - 07:42 about 8 years
1.1.10 MIT 2 2018-02-09 - 21:13 about 8 years
1.1.9 MIT 2 2018-02-09 - 09:53 about 8 years
1.1.8 MIT 2 2017-06-12 - 07:19 almost 9 years
1.1.7 MIT 2 2017-04-07 - 08:13 almost 9 years
1.1.6 MIT 4 2016-07-20 - 20:48 over 9 years
1.1.5 MIT 4 2016-06-15 - 11:21 almost 10 years
1.1.4 MIT 4 2016-05-01 - 19:14 almost 10 years
1.1.3 MIT 4 2016-02-11 - 18:51 about 10 years
1.1.2 MIT 4 2015-11-28 - 12:58 over 10 years
1.1.1 MIT 4 2015-09-27 - 21:58 over 10 years
1.1.0 MIT 4 2014-12-16 - 18:58 over 11 years
1.0.1 MIT 4 2014-12-03 - 07:58 over 11 years
1.0.0 MIT 4 2014-11-30 - 09:58 over 11 years
0.0.0 MIT 3 2013-10-13 - 12:58 over 12 years