At a glance
- Soup Sieve has a ReDoS vulnerability when compiling certain CSS selectors.
- pip:soupsieve versions 2.10 and earlier are affected; an untrusted selector can hang a worker.
- Upgrade to Soup Sieve 3.0.2 or later; do not use version 3.0.0, which was withdrawn from PyPI.
Soup Sieve ReDoS vulnerability CVE-2026-126191: upgrade to a patched version
Soup Sieve has a ReDoS flaw when compiling certain CSS selectors, potentially hanging workers if applications process user-supplied selectors. Versions 2.10 and earlier are affected; upgrade to 3.0.2 or later, and do not use 3.0.0, which was withdrawn from PyPI.
In this article
GitHub Advisories published advisory GHSA-6655-6qjp-jx7x for ReDoS vulnerability CVE-2026-126191 in Soup Sieve. The flaw occurs during CSS selector compilation and is relevant to applications processing user-supplied selectors.
Overview and technical details
Soup Sieve is a Python library for parsing and selecting HTML elements with CSS selectors, including when BeautifulSoup calls it through .select(). The vulnerability is in the selector compilation process.
| Field | Details |
|---|---|
| CVE / GHSA | CVE-2026-126191 / GHSA-6655-6qjp-jx7x |
| CWE | CWE-1333 (Inefficient Regular Expression Complexity) |
| CVSS | 7.5 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H) |
| Source | GitHub Advisories |
Affected systems
| Product | Affected versions | Fixed versions |
|---|---|---|
| pip:soupsieve | 2.10 and earlier | 3.0.2 or later |
The risk is relevant when an application compiles untrusted CSS selectors supplied by users, such as a web scraping service or a tool that lets users define extraction rules.
Mechanism and impact
The IDENTIFIER/CSS_ESCAPES regex in css_parser.py:119-124 can backtrack exponentially when compiling a valid selector containing an ambiguous digit-escape string such as \9 in an attribute or tag name. The issue occurs before SELECTOR_LIMIT is checked; a selector of about 60 bytes can hang a worker, causing denial of service.
It can be triggered through soupsieve.compile() or BeautifulSoup .select() when an application passes a user-supplied selector for compilation.
System checks
Check the installed Soup Sieve version in the Python environment:
python -m pip show soupsieveVersion 3.0.2 or later includes the fix; version 2.10 and earlier needs upgrading.
Remediation and mitigation
Upgrade
pip:soupsieveto version 3.0.2 or later, prioritizing applications that compile untrusted CSS selectors.Do not use version 3.0.0 to upgrade: it fixed the issue but was withdrawn from PyPI.
After upgrading, rerun the version check and confirm that the installed package is version 3.0.2 or later.