CVE-2026-33671: Picomatch has a ReDoS vulnerability via extglob quantifiers
Impact picomatch is vulnerable to Regular Expression Denial of Service (ReDoS) when processing crafted extglob patterns. Certain patterns using extglob quantifiers such as +() and (), especially when combined with overlapping alternatives or nested extglobs, are compiled into regular expressions that can exhibit catastrophic backtracking on non-matching input.
Examples of problematic patterns include +(a|aa), +(|?), +(+(a)), (+(a)), and +(+(+(a))). In local reproduction, these patterns caused multi-second event-loop blocking with relatively short inputs. For example, +(a|aa) compiled to ^(?:(?=.)(?:a|aa)+)$ and took about 2 seconds to reject a 41-character non-matching input, while nested patterns such as +(+(a)) and (+(a)) took around 29 seconds to reject a 33-character input on a modern M1 MacBook.
Applications are impacted when they allow untrusted users to supply glob patterns that are passed to picomatch for compilation or matching. In those cases, an attacker can cause excessive CPU consumption and block the Node.js event loop, resulting in a denial of service. Applications that only use trusted, developer-controlled glob patterns are much less likely to be exposed in a security-relevant way.
Patches This issue is fixed in picomatch 4.0.4, 3.0.2 and 2.3.2.
Users should upgrade to one of these versions or later, depending on their supported release line.
Workarounds If upgrading is not immediately possible, avoid passing untrusted glob patterns to picomatch.
Possible mitigations include: - disable extglob support for untrusted patterns by using noextglob: true - reject or sanitize patterns containing nested extglobs or extglob quantifiers such as +() and () - enforce strict allowlists for accepted pattern syntax - run matching in an isolated worker or separate process with time and resource limits - apply application-level request throttling and input validation for any endpoint that accepts glob patterns
Resources - Picomatch repository: https://github.com/micromatch/picomatch - lib/parse.js and lib/constants.js are involved in generating the vulnerable regex forms - Comparable ReDoS precedent: CVE-2024-4067 (micromatch) - Comparable generated-regex precedent: CVE-2024-45296 (path-to-regexp)
Other sources
Picomatch has a ReDoS vulnerability via extglob quantifiers
— Microsoft
Picomatch is a glob matcher written JavaScript. Versions prior to 4.0.4, 3.0.2, and 2.3.2 are vulnerable to Regular Expression Denial of Service (ReDoS) when processing crafted extglob patterns. Certain patterns using extglob quantifiers such as +() and (), especially when combined with overlapping alternatives or nested extglobs, are compiled into regular expressions that can exhibit catastrophic backtracking on non-matching input. Applications are impacted when they allow untrusted users to supply glob patterns that are passed to picomatch for compilation or matching. In those cases, an attacker can cause excessive CPU consumption and block the Node.js event loop, resulting in a denial of service. Applications that only use trusted, developer-controlled glob patterns are much less likely to be exposed in a security-relevant way. This issue is fixed in picomatch 4.0.4, 3.0.2 and 2.3.2. Users should upgrade to one of these versions or later, depending on their supported release line. If upgrading is not immediately possible, avoid passing untrusted glob patterns to picomatch. Possible mitigations include disabling extglob support for untrusted patterns by using noextglob: true, rejecting or sanitizing patterns containing nested extglobs or extglob quantifiers such as +() and (), enforcing strict allowlists for accepted pattern syntax, running matching in an isolated worker or separate process with time and resource limits, and applying application-level request throttling and input validation for any endpoint that accepts glob patterns.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/picomatchto a version that resolves this vulnerability.Fixed in 2.3.2 - Upgrade
Upgrade
npm/picomatchto a version that resolves this vulnerability.Fixed in 3.0.2 - Upgrade
Upgrade
npm/picomatchto a version that resolves this vulnerability.Fixed in 4.0.4 - Upgrade
Upgrade
picomatchto a version that resolves this vulnerability.Fixed in 4.0.4 - Upgrade
Upgrade
picomatchto a version that resolves this vulnerability.Fixed in 3.0.2 - Upgrade
Upgrade
picomatchto a version that resolves this vulnerability.Fixed in 2.3.2 - Configuration
When compiling/matching glob patterns from untrusted users, disable extglob support by setting `noextglob: true` (prevents processing extglob quantifiers like `+()` and `*()`).
picomatch noextglob = true - Configuration
For endpoints that accept glob patterns from untrusted users, reject or sanitize patterns containing nested extglobs or extglob quantifiers such as `+()` and `*()` (examples given: `+(a|aa)`, `+(*|?)`, `+(+(a))`, `*(+(a))`, `+(+(+(a)))`).
application endpoint(s) using picomatch glob_pattern_validation = reject - Compensating control
Run glob compilation/matching in an isolated worker or separate process with time and resource limits to prevent catastrophic backtracking from blocking the Node.js event loop.
- Compensating control
Apply application-level request throttling for any endpoint that accepts glob patterns, to reduce the impact of repeated expensive pattern compilations/matches.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-33671?
CVE-2026-33671 has a moderate severity level due to its potential for causing Denial of Service through regular expression exploitation.
How do I fix CVE-2026-33671?
To mitigate CVE-2026-33671, upgrade to picomatch version 2.3.2 or 3.0.2 or 4.0.4 as soon as possible.
What is the impact of CVE-2026-33671?
The impact of CVE-2026-33671 is that it allows attackers to exploit crafted extglob patterns, resulting in Regular Expression Denial of Service.
Which versions of picomatch are affected by CVE-2026-33671?
Versions of picomatch prior to 2.3.2, 3.0.0 to 3.0.2, and 4.0.0 to 4.0.4 are affected by CVE-2026-33671.
What should I do if I cannot upgrade to a safe version for CVE-2026-33671?
If upgrading is not an option, consider applying input validation or using alternative libraries to avoid vulnerable patterns.