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

- Severity: Medium 5.3 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.35%, higher than 30% of CVEs (2026-12-01)
- Published: 2026-09-17T15:23:37.457Z
- Modified: 2026-10-01T17:56:03.541Z
- Also known as: GHSA-j934-xhv5-fg8f, PYSEC-2026-4171
- Weaknesses: CWE-400, CWE-1333
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial
- 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.

(As written by CVE List.)

## Affected

- facelessuser soupsieve: < 2.9
- soupsieve (PyPI): before 2.9.0

## Every score

- GitHub_M: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`
- GitHub: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`
- PyPA Advisory Database: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`

## References

- <https://github.com/facelessuser/soupsieve/security/advisories/GHSA-j934-xhv5-fg8f> (web)
- <https://github.com/facelessuser/soupsieve/commit/cf198fcddc9230f06ed39f974eba0ce076b85cda> (web)
- <https://github.com/facelessuser/soupsieve/releases/tag/2.9> (web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-85999> (advisory)
- <https://github.com/facelessuser/soupsieve> (package)
- <https://pypi.org/project/soupsieve> (package)
- <https://github.com/advisories/GHSA-j934-xhv5-fg8f> (advisory)

## Sources

- CVE List: [CVE-2026-85999](https://www.cve.org/CVERecord?id=CVE-2026-85999), CVE Terms of Use, modified 2026-09-22
- GitHub Advisory Database: [GHSA-j934-xhv5-fg8f](https://github.com/advisories/GHSA-j934-xhv5-fg8f), CC-BY-4.0, modified 2026-10-01
- NVD: [CVE-2026-85999](https://nvd.nist.gov/vuln/detail/CVE-2026-85999), Public domain, modified 2026-09-23
- PyPA Advisory Database: [PYSEC-2026-4171](https://osv.dev/vulnerability/PYSEC-2026-4171), CC-BY-4.0, modified 2026-10-01

---

Page: https://cve.day/CVE-2026-85999 · Whole record: https://cve.day/CVE-2026-85999.json · Rebuilt by cve.day 2026-11-25T22:59:39.273Z
