CVE-2026-102277

CVE-2026-102277 is a medium-severity uncontrolled resource consumption vulnerability in brace-expansion (npm), affecting versions >= 4.0.0, < 5.0.12. It is fixed in 5.0.12, 3.0.9, 2.1.7, 1.1.21.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

brace-expansion: Quadratic-time expansion of the {a},b} rewrite causes CPU denial of service

Expanding {a},b}-shaped input takes time quadratic in the number of literal } characters, blocking the event loop.

Bash preserves a quirk where a brace group followed by a comma set still expands ({a},b}). The parser implements this by rewriting the string and restarting the scan. Each pass absorbs exactly one } and re-scans from the beginning, so n trailing braces cost n full passes.

Reproduction

const build = n => '{a}' + '}'.repeat(n) + ',z}'

for (const n of [8000, 16000, 32000, 64000, 128000]) {
  const t = Date.now()
  expand(build(n))
  console.log(n, Date.now() - t + 'ms')
}
n input time results
8,000 8 KB 110 ms 2
16,000 16 KB 446 ms 2
32,000 32 KB 1.7 s 2
64,000 64 KB 6.9 s 2
128,000 128 KB 27.7 s 2

ms/n^2 is flat at ~1.7 and each doubling of n costs exactly 4.0x - quadratic. 128 KB of input blocks the event loop for nearly half a minute to produce two results.

Mechanism

Instrumenting the rewrite branch confirms it runs exactly n + 1 times, once per literal }, each re-scanning the whole string.

There is a second multiplier. The rewrite replaces the group's closing } with the internal escClose sentinel, which is '\0CLOSE' + Math.random() + '\0' - about 25 characters. The working string therefore grows by ~25 characters on every pass:

n input length final string length
1,000 1,006 26,006
8,000 8,006 208,006

So the input is inflated roughly 26x, and that factor multiplies both the quadratic constant and peak memory. This makes it partly a memory-pressure issue as well as a CPU one.

Why max and maxLength do not help

The cost is in parsing, before the result set exists. The payload yields 2 results regardless of size, so neither bound is ever reached.

Affected versions

Verified affected on 1.1.18, 2.1.4, 3.0.6 and 5.0.9, all within a few percent of each other (~460-490 ms at n=16,000).

Severity note

Scored 5.3 Medium (A:L) for consistency with GHSA-3jxr-9vmj-r5cp, the other algorithmic-complexity advisory on this package (CWE-407), which uses the same vector. The stack-exhaustion advisories on this package score A:H because they crash the process outright; this one stalls it.

Impact

An application passing an untrusted pattern to expand(), directly or through minimatch / glob, can have its event loop blocked for tens of seconds by a payload well under minimatch's 65,536-character cap. For a single-threaded Node server that is a full stall, not just a slow request.

Degraded availability rather than a crash - the process recovers once the expansion completes.

Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service. Typical impact: denial of service.

CVE-2026-102277 has a CVSS score of 5.3 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (5.0.12, 3.0.9, 2.1.7, 1.1.21); upgrading removes the vulnerable code path.

Affected versions

brace-expansion (>= 4.0.0, < 5.0.12) brace-expansion (>= 3.0.0, < 3.0.9) brace-expansion (>= 2.0.0, < 2.1.7) brace-expansion (< 1.1.21)

Security releases

brace-expansion → 5.0.12 (npm) brace-expansion → 3.0.9 (npm) brace-expansion → 2.1.7 (npm) brace-expansion → 1.1.21 (npm)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

The rewrite loop gets an iteration bound. Past the cap the remaining string is treated as non-expanding and returned literally, consistent with the existing max / maxLength caps, which truncate rather than throw.

Note this bounds the number of passes, not the cost of each: worst-case work remains proportional to cap x input length. The cap is set low enough that the residual is bounded in practice, and far above what any realistic {a},b} input needs.

Frequently Asked Questions

  1. What is CVE-2026-102277? CVE-2026-102277 is a medium-severity uncontrolled resource consumption vulnerability in brace-expansion (npm), affecting versions >= 4.0.0, < 5.0.12. It is fixed in 5.0.12, 3.0.9, 2.1.7, 1.1.21. Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service.
  2. How severe is CVE-2026-102277? CVE-2026-102277 has a CVSS score of 5.3 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of brace-expansion are affected by CVE-2026-102277? brace-expansion (npm) versions >= 4.0.0, < 5.0.12 is affected.
  4. Is there a fix for CVE-2026-102277? Yes. CVE-2026-102277 is fixed in 5.0.12, 3.0.9, 2.1.7, 1.1.21. Upgrade to this version or later.
  5. Is CVE-2026-102277 exploitable, and should I be worried? Whether CVE-2026-102277 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2026-102277 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2026-102277?
    • Upgrade brace-expansion to 5.0.12 or later
    • Upgrade brace-expansion to 3.0.9 or later
    • Upgrade brace-expansion to 2.1.7 or later
    • Upgrade brace-expansion to 1.1.21 or later

Other vulnerabilities in brace-expansion

Stop the waste.
Protect your environment with Kodem.