Packages / brace-expansion / Security

ModerateVulnerabilityGHSA-f886-m6hf-6m8vCVE-2026-33750Published 26 Mar 2026

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

Your version

Affected releases · brace-expansion

  • 5.x5.0.2 – 5.0.4Fixed in 5.0.5
  • 4.x4.0.0 – 4.0.1No fix on this line yet
  • 3.x3.0.0 – 3.0.1Fixed in 3.0.2
  • 2.x2.0.0 – 2.0.2Fixed in 2.0.3
  • 1.x1.0.0 – 1.1.12Fixed in 1.1.13
  • 0.0.x0.0.0No fix on this line yet

On 5.x, the newest line:

npm install brace-expansion@5.0.5
Every release on a timeline
5.x
  1. Affected

    5.0.2 – 5.0.4

    3 releases

  2. Fixed

    5.0.5 – 5.0.13

    9 releases, latest

4.x
  1. Affected

    4.0.0 – 4.0.1

    2 releases

3.x
  1. Affected

    3.0.0 – 3.0.1

    2 releases

  2. Fixed

    3.0.2 – 3.0.10

    9 releases

2.x
  1. Affected

    2.0.0 – 2.0.2

    3 releases

  2. Fixed

    2.0.3 – 2.1.8

    10 releases

1.x
  1. Affected

    1.0.0 – 1.1.12

    15 releases

  2. Fixed

    1.1.13 – 1.1.22

    10 releases

0.x
  1. Affected

    0.0.0

    1 release

64 stable releases of brace-expansion, oldest to newest, one row per major.

What happens

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:

github.com/juliangruber/brace-expansion/blob/da…

test() is one of

github.com/juliangruber/brace-expansion/blob/da…

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.

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.