PyPI
CVE-2026-126193
Soup Sieve: Uncontrolled recursion in CSS parser lets nested pseudo-class selectors exhaust the Python call stack
- Severity
- Medium 5.3
- Published
- 13 Nov 2026
- Last changed
- 13 Nov 2026
- Added to UpHeron
- 23 Nov 2026
- Fixed in
- 3.0.2
- Exploit chance
- 0.5% in the next 30 daysHigher than 43% of CVEs. EPSS by FIRST, 24 Nov 2026
- Weakness
- Uncontrolled recursion (CWE-674)
- Attack
- Over the network · No login needed · No user action needed
- Attacker can
- Slow it down
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L- Also known as
- GHSA-7g44-g9rc-x53w
- Sources
- OSV.dev and GitHub
Description
The Soup Sieve CSS selector parser recurses once per level of nested pseudo-class selector (:is(), :not(), :where(), :has()) without any limit on nesting depth. An unauthenticated attacker who can supply a CSS selector string to soupsieve.compile(), soupsieve.select(), or Beautiful Soup's soup.select() / soup.select_one() can force the parser to exceed Python's recursion limit with a small crafted input (about 1.6 KB, roughly 330 nesting levels), raising an uncontrolled RecursionError. Because this exception is not part of the parser's documented error contract, applications that catch only ValueError or SelectorSyntaxError see an unexpected failure of the request or task that parsed the selector.
The parser dispatches each opening pseudo-class token to parse_pseudo_open, which calls back into parse_selectors to parse the pseudo-class body. Every nesting level therefore adds Python stack frames, and no counter, depth guard, or RecursionError handler bounds this descent.
Workarounds
For those on older versions where the algorithm is still recursive, a try/except block that captures RecursionError can be added around calls if accepting untrusted user input is allowed.
Affected software
| Software | Affected versions |
|---|---|
soupsievePyPI · osv:PyPI:soupsieve |
|
About soupsieve
Vulnerabilities in soupsieve
- In our list
- 4
- Published in the last 12 months
- 4
- Critical, last 12 months
- 0
- High, last 12 months
- 2
- Known exploited
- 0
- CVE-2026-126191Soup Sieve: Exponential ReDoS in selector compilation via \9-run in CSS_ESCAPES/IDENTIFIERHigh 7.5 13 Nov 2026
- CVE-2026-126190Soup Sieve: Polynomial-time denial of service in the descendant combinatorHigh 7.5 13 Nov 2026
- CVE-2026-126192Soup Sieve: General sibling combinator inside :has() matches untrusted HTML in quadratic timeMedium 13 Nov 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-126193
- GitHub Advisory Database https://github.com/advisories/GHSA-7g44-g9rc-x53w