Skip to content
OpenAdvisories
Medium · 5.3 CVE-2026-85999 EUVD-2026-81690GHSA-j934-xhv5-fg8fPYSEC-2026-4171

Soup Sieve: Polynomial-time ReDoS (O(n²)) in the whitespace/comment trimming regex `RE_WS_END` (triggers on VALID selectors)

Published Sep 17, 2026 · Updated Sep 22, 2026 · Assigned by GitHub_M

Description

Soup Sieve is a CSS selector library designed to be used with Beautiful Soup 4. Prior to 2.9, selector_iter in src/soupsieve/css_parser.py trims the raw selector with RE_WS_END, an end-anchored WSC whitespace-and-comment expression used with search(), so the regular expression engine retries a greedy scan at every starting offset. An attacker-controlled valid selector containing a long internal whitespace run, or a selector containing a long CSS comment run followed by another token, causes quadratic CPU work before tokenization. User-controlled selectors can reach the path through soupsieve.compile() and BeautifulSoup.select(), while applications using only hard-coded selectors are unaffected. This root cause is separate from the IDENTIFIER and VALUE backtracking vulnerability because the cost occurs in RE_WS_END.search during trimming rather than token matching. The resulting CPU consumption can hold the Python GIL, exhaust workers, and stall a service without causing memory corruption or code execution. The issue is fixed in version 2.9.

Affected products

VendorProductAffectedFixed
facelessuser soupsieve < 2.9 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 soupsieve 4.1-1 —
Debian 13 soupsieve No fix yet —
Debian 12 soupsieve No fix yet —
ReleasePackageFixed inAdvisory
Ubuntu 26.10 soupsieve No fix yet —
Ubuntu 26.04 LTS soupsieve No fix yet —
Ubuntu 24.04 LTS soupsieve No fix yet —
Ubuntu 22.04 LTS soupsieve No fix yet —
Ubuntu 20.04 LTS soupsieve No fix yet —
ReleasePackageFixed inAdvisory
SLES 15 SP7 python-soupsieve 1.9.5-150200.3.6.1 SUSE-SU-2026:5164-1
SLES 3 python-soupsieve 2.5-150600.3.6.1 SUSE-SU-2026:4365-1
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 16.0 python-soupsieve 2.6-160000.5.1 SUSE-SU-2026:24267-1
SLES 16.0 python-soupsieve 2.6-160000.5.1 SUSE-SU-2026:24267-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed python-soupsieve 2.9.2-1.1 openSUSE-SU-2026:11866-1
openSUSE Leap 16.0 python-soupsieve 2.6-160000.5.1 openSUSE-SU-2026:22149-1

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 3 python-soupsieve No fix yet —

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling datadog-agent-7.77-core-integrations +3 No fix yet —
Wolfi rolling datadog-agent-7.81-core-integrations 7.81.3-r20 —
Wolfi rolling open-webui 0.11.3-r7 —

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI soupsieve < 2.9.0 2.9.0 GHSA-j934-xhv5-fg8f

Advisories 5

References