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

> An attacker can cause a denial of service in applications using Soup Sieve by providing crafted CSS selectors that trigger quadratic CPU consumption during parsing.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 17 Sep 2026
- **Updated:** 22 Sep 2026
- **Also known as:** AZL-103322, CLEANSTART-2026-IA02205, CLEANSTART-2026-RB27894, DEBIAN-CVE-2026-85999, ECHO-dfdf-dd36-a3ed, GHSA-j934-xhv5-fg8f, MINI-5gph-mh72-ch4v, MINI-6grq-2rm4-pv7x, MINI-7526-g7q2-xjmq, MINI-7w7h-c665-42cc, MINI-hw8p-cxqh-6254, MINI-mqqr-cvqp-4xf5, MINI-rmj9-2vf8-q2jf, PYSEC-2026-4171, UBUNTU-CVE-2026-85999

## What is CVE-2026-85999?

CVE-2026-85999 is a medium-severity denial of service vulnerability in facelessuser soupsieve, published on 17 Sep 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official 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.

Weakness: CWE-400 (Uncontrolled Resource Consumption), CWE-1333 (Inefficient Regular Expression Complexity)

## Which versions are affected by CVE-2026-85999?

3 open source packages ship an affected version, including soupsieve.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `soupsieve` | PyPI | All versions | 2.9.0 |
| `soupsieve` | PyPI | All versions | 2.9.0 |
| `soupsieve` | PyPI | All versions | 2.9.0 |

## How do I fix CVE-2026-85999?

Upgrade soupsieve to 2.9.0 or later.

## Is CVE-2026-85999 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-85999 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-85999 and fix it if it is affected.

What it is: CVE-2026-85999 is a medium-severity denial of service vulnerability in facelessuser soupsieve, published on 17 Sep 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-85999 exists.

Affected packages and fixed versions:
- soupsieve (PyPI): affected all versions; fixed in 2.9.0
- soupsieve (PyPI): affected all versions; fixed in 2.9.0
- soupsieve (PyPI): affected all versions; fixed in 2.9.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-85999/ (Markdown: https://insights.sbomify.com/CVE-2026-85999/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-85999
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-85999
- OSV: https://osv.dev/vulnerability/CVE-2026-85999

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-85999/
Summaries are generated and may contain mistakes; the official description above is the record.
