Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. soupsieve
  4. ›
  5. CVE-2026-85999

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

September 17, 2026

Before tokenizing, selector_iter trims leading/trailing whitespace and comments by running two regexes over the whole raw selector with .search(). The trailing one, RE_WS_END = re.compile(r'{WSC}*$'), is anchored only at the end ($), not the start. Because .search() retries the pattern at every offset, a long run of whitespace or CSS comments that is not sitting exactly at the end of the string makes each retry greedily consume the run and then fail $, producing O(n²) time. This triggers on perfectly valid selectors — e.g. a descendant combinator with a long whitespace gap, a + " "*n + b — so no malformed input is required. A single valid ~20 KB selector stalls the interpreter for ~10 s of CPU.

References

  • github.com/advisories/GHSA-j934-xhv5-fg8f
  • github.com/facelessuser/soupsieve/commit/cf198fcddc9230f06ed39f974eba0ce076b85cda
  • github.com/facelessuser/soupsieve/releases/tag/2.9
  • github.com/facelessuser/soupsieve/security/advisories/GHSA-j934-xhv5-fg8f
  • nvd.nist.gov/vuln/detail/CVE-2026-85999

Code Behaviors & Features

Detect and mitigate CVE-2026-85999 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.9.0

Fixed versions

  • 2.9.0

Solution

Upgrade to version 2.9.0 or above.

Impact 5.3 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Learn more about CVSS

Weakness

  • CWE-1333: Inefficient Regular Expression Complexity
  • CWE-400: Uncontrolled Resource Consumption

Source file

pypi/soupsieve/CVE-2026-85999.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 22 Sep 2026 12:20:54 +0000.