CVE-2026-132276: Polynomial-Time Regular Expression Denial of Service (ReDoS) in wcmatch
Vulnerability ID: CVE-2026-132276
CVSS Score: 5.9
Published: 2026-11-20
CVE-2026-132276 (GHSA-53pm-wgxf-c6qf) is an algorithmic complexity and Regular Expression Denial of Service (ReDoS) vulnerability in the Python wcmatch wildcard and glob matching library prior to version 11.2. Under default flags, matching a non-matching attacker-controlled filename against a static developer-defined pattern containing multiple star (*) wildcards separated by literal delimiters causes polynomial-time backtracking O(n^k) in the compiled regular expression. A single 255-byte filename evaluated against a 5-star pattern consumes approximately 86 seconds of 100% CPU time, allowing unauthenticated attackers to induce severe availability degradation.
TL;DR
wcmatch versions prior to 11.2 translate wildcard stars () into ungrouped lazy regular expression quantifiers (.? or [^/]?). When an application matches untrusted filenames against a static pattern containing multiple star wildcards separated by literals (such as *_*_.csv), non-matching inputs containing repeated delimiter characters trigger polynomial-time backtracking O(n^k). Upgrading to wcmatch 11.2 resolves the issue by wrapping intermediate star segments in Python 3.11+ atomic groups (?>...), reducing matching complexity to linear time O(n).
⚠️ Exploit Status: POC
Technical Details
- CVE / GHSA ID: CVE-2026-132276 / GHSA-53pm-wgxf-c6qf
- Weakness Class: CWE-1333: Inefficient Regular Expression Complexity (ReDoS)
- CVSS v3.1 Score: 5.9 Medium (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H)
- Affected Versions: wcmatch < 11.2 (all versions up to and including 11.1)
- Patched Version: wcmatch >= 11.2 (requires Python >= 3.11)
- Attack Vector: Attacker-controlled filename/string matched against multi-star developer pattern
- Time Complexity: O(n^k) polynomial time in <= 11.1; reduced to O(n) linear time in 11.2
- Exploit Status: Public Proof-of-Concept available (CISA KEV: Not Listed)
Affected Systems
- wcmatch (PyPI package by facelessuser)
- wcmatch: < 11.2 (Fixed in:
11.2)
Code Analysis
Commit: 83491aa
Wrap non-extended-glob single stars, except the last, in atomic groups to prevent multi-star backtracking
diff --git a/wcmatch/_wcparse.py b/wcmatch/_wcparse.py --- a/wcmatch/_wcparse.py +++ b/wcmatch/_wcparse.py @@ -314,7 +314,15 @@ class ExtPromote(str): class InvPlaceholder(str): - """Placeholder for inverse pattern !(...).""" + """Placeholder for inverse pattern `!(...)`.""" + + +class AtomicStar(str): + """Track `*` as needing to be an atomic `*`.""" + + +class ExtGroup(str): + """Track a top level extended glob group.""" class PathNameException(Exception): @@ -939,6 +947,7 @@ def __init__(self, pattern: AnyStr, flags: int = 0) -> None: self.capture = self.translate and bool(flags & CAPTURE) self.case_sensitive = get_case(flags) self.in_list = False + self.emitted_star = -1 self.inv_nest = False self.flags = flags self.inv_ext = 0 @@ -1508,6 +1517,10 @@ def _handle_star(self, i: util.StringIter, current: list[str]) -> None: current.append(sep) self.set_start_dir() else: + if not self.in_list: + if self.emitted_star == -1: + self.emitted_star = len(current) + value = AtomicStar(value) current.append(value) Exploit Details
- GitHub: Standalone PoC exploit harness and differential test suite demonstrating O(n^5) polynomial ReDoS on 255-byte filenames.
Mitigation Strategies
- Upgrade wcmatch to version 11.2 or newer on Python 3.11+ runtimes to enable atomic star grouping.
- Enforce strict maximum length bounds on untrusted filenames and strings prior to wildcard evaluation.
- Replace complex multi-star delimiter patterns with deterministic string splitting (str.split or str.count) or pre-compiled regular expressions utilizing explicit atomic groups.
- Execute untrusted file globbing or wildcard matching in isolated worker processes with strict execution timeouts.
Remediation Steps:
- Verify that the target Python runtime is version 3.11 or newer (
python3 --version). - Update project dependency specifications (
requirements.txtorpyproject.toml) to requirewcmatch>=11.2. - Run
pip install --upgrade "wcmatch>=11.2"across affected environments and rebuild application containers. - Audit any remaining patterns that explicitly enable the non-default
wcmatch.EXTGLOBflag alongside multiple*wildcards to ensure untrusted inputs are length-bounded.
References
- CVE-2026-132276 Record on CVE.org
- NVD Vulnerability Detail: CVE-2026-132276
- GitHub Security Advisory GHSA-53pm-wgxf-c6qf
- GitHub Fix Commit: facelessuser/wcmatch@83491aadde57780330f993620083e979f645c80c
- wcmatch Release 11.2 Tag
- Proof-of-Concept Repository (googlesky/CVE-2026-132276)
- CVEProject cvelistV5 Repository Entry for CVE-2026-132276
- Related CPython Upstream Fix (bpo-40480)
Read the full report for CVE-2026-132276 on our website for more details including interactive diagrams and full exploit analysis.
