picomatch
Affected
- introduced
4.0.0, fixed4.0.4(semver)
Fixed versions
4.0.4
Fix
- Fixed version
4.0.4npm install [email protected]
Advisory
Also known as: CVE-2026-33671
Picomatch has a ReDoS vulnerability via extglob quantifiers
Impactpicomatch 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:
noextglob: true+() and *()Resources
lib/parse.js and lib/constants.js are involved in generating the vulnerable regex formsmicromatch)path-to-regexp)High Basis: The source's own band: HIGH
4.0.0, fixed 4.0.4 (semver)4.0.4
4.0.4npm install [email protected]3.0.0, fixed 3.0.2 (semver)3.0.2
3.0.2npm install [email protected]0, fixed 2.3.2 (semver)2.3.2
2.3.2npm install [email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0