Skip to content

⬆️ Updates wcmatch to v11 [SECURITY] - #3587

Open
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/pypi-wcmatch-vulnerability
Open

renovate[bot] wants to merge 1 commit into
masterfrom
renovate/pypi-wcmatch-vulnerability

Conversation

@renovate

@renovate renovate Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
wcmatch ==8.3 → ==11.2 age confidence

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


wcmatch: Polynomial-time ReDoS when matching untrusted names against multi-star patterns (default flags)

CVE-2026-132276 / GHSA-53pm-wgxf-c6qf

More information

Details

Summary

With default flags, a pattern that contains several * wildcards takes polynomial time, O(n^k) for k stars, to reject a crafted file name. The pattern is an ordinary developer constant such as *_*_*_*_*.csv; only the string being matched comes from the attacker. A 255-byte file name (the maximum on common filesystems) takes 73 s with fnmatch.fnmatch() and 86 s with glob.globmatch(). The standard library's fnmatch handles the same input in under a millisecond.

This is different from GHSA-84v8-qmgq-9g88: that advisory covers extglob patterns, while this case needs no flags and no attacker-controlled pattern.

Details

Every * is translated to a lazy .*? (_STAR, wcmatch/_wcparse.py:212; _PATH_STAR [^/]*?, :218), which is emitted in _handle_star (:1405-1424):

*_*_*_*_*.csv  ->  ^(?s:(?=.)(?![.]).*?_.*?_.*?_.*?_.*?\.csv)$

When the subject consists of many _ and does not end in .csv, the regex engine tries every way of splitting it between the stars. CPython fixed the same problem in its own fnmatch (bpo-40480) by making every star segment except the last one atomic.

PoC
import time, fnmatch as std
from wcmatch import fnmatch, glob

for pat, n in [('*_*_*_*.csv', 255), ('*_*_*_*.csv', 400), ('*_*_*_*_*.csv', 150),
               ('*_*_*_*_*.csv', 200), ('*_*_*_*_*.csv', 255)]:
    name = '_' * n
    t = time.perf_counter(); fnmatch.fnmatch(name, pat); w = time.perf_counter() - t
    t = time.perf_counter(); std.fnmatchcase(name, pat); s = time.perf_counter() - t
    print(f'{pat:15} len={n}  wcmatch={w:.3f}s  stdlib={s:.5f}s')

t = time.perf_counter(); glob.globmatch('uploads/' + '_' * 255, 'uploads/*_*_*_*_*.csv')
print(f'globmatch {time.perf_counter() - t:.2f}s')

wcmatch 11.1, CPython 3.13, macOS:

*_*_*_*.csv     len=255  wcmatch=1.412s   stdlib=0.00001s
*_*_*_*.csv     len=400  wcmatch=8.599s   stdlib=0.00004s
*_*_*_*_*.csv   len=150  wcmatch=5.333s   stdlib=0.00003s
*_*_*_*_*.csv   len=200  wcmatch=22.415s  stdlib=0.00007s
*_*_*_*_*.csv   len=255  wcmatch=72.732s  stdlib=0.00047s
globmatch 85.75s

glob.glob('*_*_*_*.csv', root_dir=d) on a real directory that contains one file named '_' * 255 takes 1.7 s.

Impact

Applications that match untrusted names against multi-star patterns can be blocked on a single CPU core for minutes per name. Examples: upload handlers, archive or object-store key filters, and glob/WcMatch scans of directories where other users can create files. No authentication is needed.

Fix

Emit every star segment except the last one as an atomic group, as the standard library does. On Python 3.11 and later use (?>.*?_); on 3.10 use the lookahead/backreference form from fnmatch._join_translated_parts. For example:

^(?s:(?=.)(?![.])(?>.*?_)(?>.*?_)(?>.*?_)(?>.*?_).*?\.csv)$

This rejects the 255-byte name in under 1 ms. On my spot-check inputs it gives the same results as the current regex. The same change applies to _PATH_STAR.

Severity

  • CVSS Score: 5.9 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

facelessuser/wcmatch (wcmatch)

v11.2

Compare Source

11.2

  • NEW: Drop support for Python 3.10.
  • FIX: Require bracex 3.2 for various bug fixes.
  • FIX: Filter filename iterables without evaluating their "truthiness", allowing collections such as numpy
    arrays (@​Lushiyao5).
  • FIX: Improve performance when multiple * are used for file name matching. Performance is only improved in
    cases where variable length EXTGLOB patterns would not interfere with matching. Issue found by (@​gistrec).
  • FIX: Apply one pattern limit to includes and exclusions when scanning with glob and iglob, and preserve
    unlimited expansion across multiple patterns with negative limits.
  • FIX: Use the documented default limit of 1000 patterns in WcMatch instead of 32.
  • FIX: Preserve unlimited pattern expansion with exclusions in compiled matchers and translation, and enforce
    finite limits when exclusions consume the entire pattern budget.
  • FIX: Fix an invalid regular expression error when an EXTGLOB/EXTMATCH inverse group, !(...), is followed
    by an extended group that contains another extended group, e.g. !(a)@(b|*(c)).
  • FIX: Fix an EXTGLOB/EXTMATCH star group, *(...), being matched as literal text when it directly follows
    another *, e.g. a**(b).
  • FIX: Fix glob and iglob returning the same path twice when two patterns find it and case is ignored, e.g.
    ['A*', '*b'] with IGNORECASE and a file named Ab. Files that only differ by case are no longer treated as
    duplicates when the file system is case sensitive.
  • FIX: According to Bash, a file name that starts with an extended group should never match . or ...
  • FIX: Preserve leading-dot restrictions for wildcards after extended groups that can match an empty string,
    such as ?(a)*, and avoid returning . and .. from these directory scans.
  • FIX: Fix rglob treating a pattern that starts with ** or *** as if it started with *, e.g. **/a.txt
    with GLOBSTAR missed a.txt in the searched folder and returned a.txt from inside a symlinked folder.

v11.1

Compare Source

11.1

  • NEW: Add support for Python 3.15.
  • FIX: Fix WindowsPath subclass construction on Python 3.12+ (#​238).
  • FIX: Fix symlink prefixes for multiple GLOBSTAR captures (#​239).

v11.0.1

Compare Source

11.0.1

  • DOCS: Provide information in documentation that discloses information about what should or should not be
    expected from Wildcard Match in regards to security, and provide general information to allow users to make good
    decisions.
  • FIX: Fix an issue where in some cases dot handling was not correct within an extended glob pattern when
    EXTGLOB/EXTMATCH was enabled.

v11.0

Compare Source

11.0

  • NEW: Reduce/combine nested EXTGLOB/EXTMATCH regular expression patterns when possible to reduce deeply
    nested patterns.
  • NEW: Added ZSH style numerical ranges (<0-9>) via new NUMRANGE flag.
  • BREAK: Previously, translation would have a capture group for every extended glob pattern when
    EXTGLOB/EXTMATCH was enabled. Due to the new feature added that reduces extended glob group nesting, groups no
    longer appear exactly as specified. Moving forward, capturing groups are not included by default. If you need the
    old behavior, it can be enabled in a translate() call via the CAPTURE flag. This flag will cause extended glob
    reduction to be turned off and for capturing groups to be enabled.
  • FIX: Avoid reparsing sequences that have already been deemed not valid.
  • FIX: Halt EXTGLOB/EXTMATCH parsing once an unclosed extended glob pattern is encountered.
  • FIX: Fix case where an empty string would not match a pattern targeting an empty string.
  • FIX: Ensure that consecutive stars are collapsed into a single regular expression pattern.
  • FIX: Fix parsing SPLIT not accounting for POSIX character class.

v10.2.1

Compare Source

10.2.1

  • FIX: Properly update project requirements to ensure usage of bracex 3.0.

v10.2

Compare Source

10.2

  • NEW: Require bracex 3.0 for bug fixes.
  • NEW: Drop support for Python 3.9 which is "end of life".

v10.1

Compare Source

10.1

  • NEW: Drop support for Python 3.8 which is "end of life".
  • NEW: Add support for Python 3.14.
  • NEW: Add wcmatch.glob.compile(pattern) and wcmatch.fnmatch.compile(pattern) to allow for precompiled matcher
    objects that can be reused.

v10.0

Compare Source

10.0

  • NEW: Added GLOBSTARLONG which adds support for the Zsh style *** which acts like ** with GLOBSTAR but
    but traverses symlinks.
  • NEW: pathlib.match will respect symlink rules (when the REALPATH flag is given). Hidden file rules will
    be respected at all times. Enable DOTALL to match hidden files.
  • NEW: Symlinks should not be traversed when GLOBSTAR is enabled unless FOLLOW is also enabled, but they
    should still be matched. Prior to this change, symlinks were not traversed and they were ignored from matching
    which contradicts how Bash works and could be confusing to users.
  • FIX: Fix some inconsistencies with globmatch and symlink handling when REALPATH is enabled.

v9.0

Compare Source

9.0

  • NEW: Remove deprecated function glob.raw_escape.
  • NEW: Officially support Python 3.13.

v8.5.2

Compare Source

8.5.2

  • FIX: Fix pathlib issue with inheritance on Python versions greater than 3.12.
  • FIX: Fix EXTMATCH case with !(...) patterns.

v8.5.1

Compare Source

8.5.1

  • FIX: Fix issue with type check failure in wcmatch.glob.

v8.5

Compare Source

8.5

  • NEW: Formally support Python 3.11 (no change).
  • NEW: Add support for Python 3.12 (pathlib changes).
  • NEW: Drop Python 3.7 support.
  • FIX: Fix handling of current directory when magic and non-magic patterns are mixed in glob pattern list.

v8.4.1

Compare Source

8.4.1

  • FIX: Windows drive path separators should normalize like other path separators.
  • FIX: Fix a Windows pattern parsing issue that caused absolute paths with ambiguous drives to not parse correctly.

v8.4

Compare Source

8.4

  • NEW: Drop support for Python 3.6.
  • NEW: Switch to Hatch backend instead of Setuptools.
  • NEW: Add new exclude option to fnmatch, pathlib, and glob methods that allows exclusion patterns to be
    specified directly without needing to enable NEGATE and prepend patterns with !. exclude accepts a separate
    pattern or pattern list. exclude should not be used in conjunction with NEGATE. One or the other should be used.

Configuration

📅 Schedule: (in timezone Europe/Moscow)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@socket-security

Copy link
Copy Markdown

Dependency limit exceeded — report not shown.

This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report.

Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard.

Socket is always free for open source. If this is a public open source project under an OSI-approved license, contact us to request a free Business plan upgrade.

@github-actions github-actions Bot added the docs label Nov 21, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scan Summary

Tool Critical High Medium Low Status
Dependency Scan (universal) 2 15 13 3 ❌
Shell Script Analysis 0 0 0 195 ✅
Security Audit for Infrastructure 14 92 8 32 ❌
Kotlin Static Analysis 0 0 0 0 ✅
Python Source Analyzer 0 0 0 0 ✅
Kotlin Security Audit 0 0 0 0 ✅
Secrets Audit 0 4 0 0 ❌

Recommendation

Please review the findings from Code scanning alerts before approving this pull request. You can also configure the build rules or add suppressions to customize this bot 👍

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants