Description
Soup Sieve is a CSS selector library designed to be used with Beautiful Soup 4. Prior to 4.0.1, Soup Sieve repeatedly searches descendant subtrees for each candidate evaluated by :has() and repeatedly reevaluates a parent containing :has(> ...) for each child, causing quadratic matching on deeply nested or wide attacker-influenced HTML or XML. Applications using ordinary fixed selectors through select(), select_one(), or Beautiful Soup CSS APIs against untrusted documents can have a worker occupied for seconds or minutes, while applications that process only trusted documents are not affected. Selectors compiled with NOCACHE continue to use the old uncached behavior. This issue is fixed in version 4.0.1.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| facelessuser | soupsieve | < 4.0.1 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | soupsieve | No fix yet | — |
| Ubuntu 26.04 LTS | soupsieve | No fix yet | — |
| Ubuntu 24.04 LTS | soupsieve | No fix yet | — |
| Ubuntu 22.04 LTS | soupsieve | No fix yet | — |
| Ubuntu 20.04 LTS | soupsieve | No fix yet | — |
References
- https://github.com/facelessuser/soupsieve/security/advisories/GHSA-8jvp-3x96-xpqw
- https://github.com/facelessuser/soupsieve/pull/352
- https://github.com/facelessuser/soupsieve/commit/0469c148f5501ec2127e0d65b77c2a1c395fa379
- https://github.com/facelessuser/soupsieve/commit/305fbf6b8c1f6ff05fec55d1e5bb28d80d22de44
- https://github.com/facelessuser/soupsieve/releases/tag/4.0.1