CVE-2026-102276: brace-expansion: DoS via uncontrolled recursion in parseCommaParts causing stack exhaustion

Published Sep 28, 2026
·
Updated

Summary

parseCommaParts() can exhaust the native stack and crash the process. There are two distinct ways to trigger it, both reachable from a single untrusted pattern string.

This is the parsing-side counterpart to CVE-2026-14257 / GHSA-mh99-v99m-4gvg. That fix made expand() iterative and documented a constant-stack-depth guarantee, but parseCommaParts() was left recursive, so the guarantee only held for one of the two parsing paths.

Vector 1 - unbounded recursion on post

parseCommaParts() recursed on the remainder of the string once per brace group:

js const postParts = parseCommaParts(post) // unbounded

A brace group containing many comma-separated groups drives one recursion level per group:

js expand('{' + '{a},'.repeat(7000) + 'b}') // RangeError: Maximum call stack size exceeded

About 7,300 repetitions - roughly 29 KB of input - is enough on Node 24; roughly 6,300 (25 KB) on Node 18. The threshold is identical on every affected release line.

Vector 2 - push.apply with an unbounded array

Even with the recursion removed, parseCommaParts() spread whole arrays into an argument list:

js p.push.apply(p, postParts) parts.push.apply(parts, p)

Function.prototype.apply places one argument per element on the stack, so a single large array overflows it. This needs no recursion depth at all - the following reaches a recursion depth of exactly 1:

js expand('{{x},' + 'a,'.repeat(125000) + 'b}') // RangeError: Maximum call stack size exceeded

Threshold is about 124,300 repetitions (~249 KB). This vector was not part of the original report; it was found while verifying the fix. A patch that only de-recurses but keeps push.apply leaves a working denial of service behind.

Why max and maxLength do not help

Both crashes happen during parsing, before any expansion. The payloads produce one result per group, so output size grows linearly with input and is never the limiter. expand(payload, { max: 1, maxLength: 1 }) still overflows.

Impact

Any application that passes an untrusted string to expand() - directly, or through minimatch / glob where it is a user-supplied glob pattern - can be crashed. In Node, a RangeError that the application does not catch terminates the process, so a server that globs user input is exposed to remote unauthenticated denial of service.

minimatch's own MAXPATTERNLENGTH cap (65,536) does not help against vector 1: the overflow threshold sits well below it. Confirmed on minimatch 10.2.6 - a 64,003-byte pattern passes the length check and overflows both minimatch.braceExpand() and new minimatch.Minimatch().

This is an availability-only issue. No code execution and no data exposure.

Not a regression

5.0.8 and 5.0.9 overflow at the same repetition count, so the gap predates the recent advisories; those fixes simply did not reach it. Verified affected on 1.1.18, 2.1.4, 3.0.6, 5.0.8 and 5.0.9, all at an identical threshold.

Patch

parseCommaParts() is rewritten as a loop that carries the partial part across chunks, and every array append uses an element-by-element loop rather than push.apply. The redundant if (!str) return [''] guard is dropped - the loop returns [''] for the empty string on its own.

Equivalence of the old and new implementations was checked by differential testing: exhaustive over every string of {, }, ,, a up to length 7 plus 300,000 random inputs - 322,000 cases, zero mismatches.

Severity note

Scored 7.5 High under CVSS 3.1 for consistency with the other availability advisories on this package (GHSA-mh99-v99m-4gvg, GHSA-rgw5-rvv9-x895), which use the same vector. The reporter self-assessed 6.9 Medium under CVSS 4.0 (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N).

Credit

Reported by baeseungwon1010, with a working proof of concept and a proposed patch. Vector 2 was identified during maintainer verification.

Other sources

brace-expansion: DoS via uncontrolled recursion in parseCommaParts causing stack exhaustion

— Microsoft

The brace-expansion library generates arbitrary strings containing a common prefix and suffix. Prior to 1.1.19, 2.1.5, 3.0.7, and 5.0.10, crafted brace patterns can exhaust the native stack in parseCommaParts because parseCommaParts recursively processes the remainder once per brace group and uses push.apply to pass every element of a very large comma-part array as a function argument. Patterns containing many comma-separated brace groups trigger the recursive path, while the large array triggers the argument-array path without deep recursion. These paths cause recursive and argument-array native stack exhaustion before max or maxLength can limit output, potentially terminating the Node.js process in a process-terminating denial of service. This issue is fixed in versions 1.1.19, 2.1.5, 3.0.7, and 5.0.10.

— MITRE

Affected Software

5 affected componentsFixes available
npm/brace-expansion<1.1.19, <2.1.5, <3.0.7, <5.0.10
npm/brace-expansion<1.1.19
1.1.19
npm/brace-expansion>=2.0.0<2.1.5
2.1.5
npm/brace-expansion>=3.0.0<3.0.7
3.0.7
npm/brace-expansion>=4.0.0<5.0.10
5.0.10

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/brace-expansion to a version that resolves this vulnerability.

    Fixed in 1.1.19
  2. Upgrade

    Upgrade npm/brace-expansion to a version that resolves this vulnerability.

    Fixed in 2.1.5
  3. Upgrade

    Upgrade npm/brace-expansion to a version that resolves this vulnerability.

    Fixed in 3.0.7
  4. Upgrade

    Upgrade npm/brace-expansion to a version that resolves this vulnerability.

    Fixed in 5.0.10
  5. Upgrade

    Upgrade brace-expansion to a version that resolves this vulnerability.

    Fixed in 1.1.19
  6. Upgrade

    Upgrade brace-expansion to a version that resolves this vulnerability.

    Fixed in 2.1.5
  7. Upgrade

    Upgrade brace-expansion to a version that resolves this vulnerability.

    Fixed in 3.0.7
  8. Upgrade

    Upgrade brace-expansion to a version that resolves this vulnerability.

    Fixed in 5.0.10

Event History

Sep 28, 2026
CVE Published
via MITRE·08:50 PM
Data Sourced
via MITRE·08:50 PM
DescriptionSeverityWeakness
Data Sourced
via Red Hat·09:04 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·09:17 PM
DescriptionSeverityWeakness
Sep 29, 2026
Advisory Published
via GitHub·11:44 PM
Data Sourced
via GitHub·11:44 PM
DescriptionSeverityWeaknessAffected Software
Oct 1, 2026
Data Sourced
via Microsoft·08:19 AM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are realistically exposed to this denial of service?

Node.js applications are exposed when they process attacker-controlled brace-expansion patterns. Exploitation can terminate the Node.js process, so services that accept patterns through network requests or other untrusted inputs are particularly relevant.

2

Does limiting expansion output with max or maxLength prevent exploitation?

No. The native stack exhaustion occurs in parseCommaParts before max or maxLength can limit the generated output.

3

What input characteristics trigger the vulnerable paths?

Patterns with many comma-separated brace groups trigger recursive processing of the remaining pattern. A very large comma-part array can also exhaust the native stack through push.apply, even without deep recursion.

4

Which versions contain the fix?

The fixed releases are 1.1.19, 2.1.5, 3.0.7, and 5.0.10. Versions before the corresponding fixed release are affected.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203