CVE-2026-126192
## Summary Matching a selector that puts a general-sibling combinator inside `:has()`, such as `div:has(a ~ b)`, against untrusted HTML runs in O(n²) time in the number of sibling elements. A single small document with a few thousand siblings ties the process up for a minute of CPU, so an application that runs a fixed selector of this shape over HTML it doesn't control can be stalled by one request. `:has` is powerful, but much in the same way poor regular expressions can be crafted to cause catastrophic backtracking with greedy capturing, has can be used to create non-ideal scenarios that can cause large portions of the tree to be evaluated for one or many elements if not used thoughtfully. This behavior is not exclusive to Soup Sieve, but browsers make note of these potential performance issues themselves: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/:has#performance_considerations. With all of that said, there is room for improvements that can in some cases greatly improve performance. ## Details `:has(a ~ b)` asks "does this element contain an `a` that has a later sibling `b`?". When no `b` is present, soupsieve can't short-circuit, and it answers the question with a nested scan: `match_future_child` walks every candidate `a` under the scope, and for each one the general-sibling branch of `match_future_relations` walks all of that `a`'s following siblings looking for `b`. With n siblings that is (n-1) + (n-2) + ... + 1 comparisons, i.e. O(n²). The adjacent-sibling form `div:has(a + b)` stays linear, because its branch checks only the one immediately following sibling per candidate. So the cost is specific to the general-sibling `~` (and `~` nested inside `:has`), and it shows up on the common case where the right-hand side simply isn't there. ## Proof of concept Installed from PyPI: `pip install soupsieve==2.9.2 beautifulsoup4`. ```python import time import soupsieve from bs4 import BeautifulSoup selector = "div:has(a ~ b)" fo
Properties
- Severity
- medium
- Summary
- Soup Sieve: General sibling combinator inside :has() matches untrusted HTML in quadratic time
- Nvd fetched at
- 2026-11-14T00:40:25.638091+00:00
- Epss score
- 0.00477
- Cvss severity
- MEDIUM
- Cvss score
- 6.3
- Retrieved at
- 2026-11-14T00:51:03+00:00
- Ghsa published
- 2026-11-13T00:45:18Z
- Source url
- https://github.com/advisories/GHSA-4j63-6c4x-wfg4
- Ghsa updated
- 2026-11-13T00:45:19Z
- Ghsa id
- GHSA-4j63-6c4x-wfg4
- Last source
- FIRST EPSS
- Score
- 6.3
- Cvss version
- 4.0
- Cve id
- CVE-2026-126192
- Cvss vector
- CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
- First seen by Signal
- 2026-11-12T19:59:23+00:00
- Name
- CVE-2026-126192
- Is ghsa only
- false
- Vector
- CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Related Entities (4)
HAS_WEAKNESS (2)
AFFECTS (1)
VULNERABLE_TO (1)
Related research
Explore deeper with Ninja Signal's threat intelligence graph