CVE-2026-85999: Soup Sieve polynomial-time ReDoS in whitespace trimming regex

CVE-2026-85999 · Severity: medium · CVSS 5.3 · Published 2026-09-17

Soup Sieve, a CSS selector parser used by BeautifulSoup for web scraping and HTML parsing, contains a denial-of-service vulnerability in its whitespace/comment trimming logic. An attacker can provide a valid CSS selector with a long run of whitespace or comments (e.g., a descendant combinator with thousands of spaces) to cause the parser to consume excessive CPU time—up to 10+ seconds for a ~20 KB selector—blocking the application from serving requests.

Technologies: soupsieve (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-85999 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-85999 being exploited in the wild.
How severe is CVE-2026-85999?
Medium severity, with a CVSS score of 5.3, published 17 September 2026.
Which products and versions are affected?
soupsieve (PyPI) < 2.9.0, ECOSYSTEM:introduced=0,fixed=2.9.0.
Is there a fix for CVE-2026-85999?
Yes. soupsieve (PyPI): upgrade to 2.9.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-85999 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-85999?
Check whether you run soupsieve (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • soupsieve (PyPI): upgrade to 2.9.0 or later
    pip install "soupsieve>=2.9.0"

Technical details

The vulnerability is a polynomial-time regular expression denial of service (ReDoS) in the `RE_WS_END` regex pattern (`{WSC}*$`), which trims trailing whitespace and comments before tokenizing. The pattern is not anchored at the start, so `.search()` retries the match at every string offset. When a long run of whitespace or CSS comments appears mid-selector (e.g., in a descendant combinator like `a` + many spaces + `b`), the greedy quantifier `*` consumes the entire run at each offset, fails on the `$` anchor (because non-whitespace follows), and the regex engine backtracks—producing O(n²) complexity. The vulnerability triggers on perfectly valid selectors and requires only that an attacker can supply user-controlled CSS selectors to `soupsieve.compile()`, `soupsieve.select()`, or BeautifulSoup's `soup.select()`. No malformed input or parser error is necessary; the quadratic cost is inherent to the regex design in the normal parsing path.

Affected products

  • Isaac Muse Soup Sieve 2.8.4, 2.9, and likely earlier

Identifiers

  • CVE-2026-85999
  • GHSA-j934-xhv5-fg8f
  • PYSEC-2026-4171

Timeline

  • 2026-09-17: disclosed: Vulnerability advisory published
  • 2026-02-17: other: CVE-2026-85999 assigned

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.