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

Source: https://junglewise.ai/threats/cve-2026-85999-soup-sieve-polynomial-time-redos-in-whitespace-trimming-regex  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-09-17. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

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)](https://junglewise.ai/threats/technologies/soupsieve). Vendors: [PyPI](https://junglewise.ai/threats/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

  ```sh
  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

## Related threats

- [Soup Sieve ReDoS via general sibling combinator in :has()](https://junglewise.ai/threats/cve-2026-126192-soup-sieve-is-a-css-selector-library-designed-to-be-used-with)
- [Soup Sieve polynomial DoS in descendant combinator matching](https://junglewise.ai/threats/cve-2026-126190-soup-sieve-is-a-css-selector-library-designed-to-be-used-with)
- [Soup Sieve ReDoS in IDENTIFIER and VALUE selector patterns](https://junglewise.ai/threats/cve-2026-86000-soup-sieve-redos-in-identifier-and-value-selector-patterns)
- [facelessuser soupsieve ReDoS in CSS selector parser](https://junglewise.ai/threats/cve-2026-49477-facelessuser-soupsieve-redos-in-css-selector-parser)
- [facelessuser Soup Sieve denial of service via memory exhaustion](https://junglewise.ai/threats/cve-2026-49476-facelessuser-soup-sieve-denial-of-service-via-memory-exhaustion)
