CVE-2026-126191: Soup Sieve: Exponential ReDoS in selector compilation via \9-run in CSS_ESCAPES/IDENTIFIER
Soup Sieve is a CSS selector library designed to be used with Beautiful Soup 4. Prior to 3.0, the CSSESCAPES and IDENTIFIER regular-expression subpatterns can backtrack exponentially on runs of ambiguous digit escapes in an attribute-name or tag position of an otherwise valid selector. The failure occurs during selector compilation through soupsieve.compile() or Beautiful Soup select() before SELECTORLIMIT is applied, so an application that accepts untrusted selector strings can have a worker stalled by a short input. This issue is fixed in version 3.0.
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Soup Sieveto a version that resolves this vulnerability.Fixed in 3.0
Event History
Frequently Asked Questions
Which applications are realistically exposed to this issue?
Applications using Soup Sieve prior to 3.0 are exposed if they accept untrusted CSS selector strings and compile them with soupsieve.compile() or pass them to Beautiful Soup select(). The issue affects selector compilation before SELECTOR_LIMIT is applied.
What does an attacker need to do to trigger the denial of service?
An attacker needs to supply an otherwise valid selector containing a run of ambiguous digit escapes in an attribute-name or tag position. No authentication or user interaction is required according to the supplied CVSS vector.
Are selector-length limits sufficient mitigation?
No. The exponential backtracking occurs during selector compilation before SELECTOR_LIMIT is applied, and a short malicious selector can stall a worker.
What should be done if the application cannot be upgraded immediately?
Do not allow untrusted users to provide arbitrary selector strings to Soup Sieve compilation or Beautiful Soup select(). Restrict selector input to trusted or tightly controlled values until upgrading to version 3.0.
How can I determine whether my deployment is affected?
Check whether Soup Sieve is a version prior to 3.0 and whether the application compiles selector strings from untrusted input using soupsieve.compile() or Beautiful Soup select(). Deployments that do not accept untrusted selector strings are not described as exploitable by the provided information.