{"id":"CVE-2026-4671","aliases":["CVE-2026-4671","GHSA-r8cj-3554-33mr"],"related":[],"kind":"vulnerability","state":"published","title":"justhtml before 1.18.0 Denial of Service via CSS Selector","summary":"justhtml before 1.18.0 contains multiple low-severity denial-of-service issues in CSS selector handling and linkification. Applications that evaluate attacker-controlled selector strings (via query(), matches(), or selector-based transforms), run selector matching over very large untrusted documents, construct DOM trees from untrusted structure, or enable linkification over attacker-controlled text may consume disproportionate CPU or memory. Triggers include oversized selectors, large selector lists, oversized compound selectors, long combinator chains, deeply nested functional pseudo-classes, repeated token/positional matching, cyclic DOM graphs causing non-terminating traversal, and punctuation-heavy or trailing-bracket linkification input. These are availability-only concerns and do not by themselves allow script execution, data disclosure, or sanitizer bypass. Default JustHTML(sanitize=True) usage is not expected to be exposed, since selectors are normally supplied by application code.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"justhtml before 1.18.0 contains multiple low-severity denial-of-service issues in CSS selector handling and linkification. Applications that evaluate attacker-controlled selector strings (via query(), matches(), or selector-based transforms), run selector matching over very large untrusted documents, construct DOM trees from untrusted structure, or enable linkification over attacker-controlled text may consume disproportionate CPU or memory. Triggers include oversized selectors, large selector lists, oversized compound selectors, long combinator chains, deeply nested functional pseudo-classes, repeated token/positional matching, cyclic DOM graphs causing non-terminating traversal, and punctuation-heavy or trailing-bracket linkification input. These are availability-only concerns and do not by themselves allow script execution, data disclosure, or sanitizer bypass. Default JustHTML(sanitize=True) usage is not expected to be exposed, since selectors are normally supplied by application code.","source":"cvelist"},{"lang":"en","text":"## Summary\n\n`justhtml` `1.18.0` fixes multiple low-severity denial-of-service hardening issues in CSS selector handling and linkification.\n\nThese issues are availability concerns. They do not allow script execution, data disclosure, or sanitizer bypass by themselves.\n\n## Affected versions\n\n- `justhtml` `< 1.18.0`\n\n## Fixed version\n\n- `justhtml` `1.18.0` released on May 4, 2026\n\n## Impact\n\n### CSS selector handling\n\nApplications that evaluate attacker-controlled selector strings, or that run selector-based transform pipelines over attacker-controlled documents, could consume disproportionate CPU or memory.\n\nThe affected selector patterns included oversized selectors, large selector lists, oversized compound selectors, long combinator chains, deeply nested functional pseudo-classes such as `:not(...)`, repeated attribute/class token matching over large values, repeated sibling or ancestor scans, repeated positional pseudo-class work, and `:contains(...)` over large descendant text.\n\nProgrammatically constructed malformed DOM graphs could also trigger non-terminating or duplicate traversal in some selector paths, including cyclic/shared child graphs, cyclic parent chains, and cyclic text traversal for `:contains(...)`.\n\n### Linkification\n\nAttacker-controlled text containing punctuation-heavy input or URL candidates ending in long runs of unmatched closing brackets could cause repeated rescanning and consume disproportionate CPU when linkification was enabled.\n\n## Default configuration\n\nOrdinary sanitization of parsed HTML with the default `JustHTML(..., sanitize=True)` configuration is not expected to expose untrusted users to selector injection, because selectors are normally supplied by application code.\n\nThe main risk areas are:\n\n- applications that accept selector strings from untrusted users and pass them to `query(...)`, `matches(...)`, or selector-based transforms\n- custom transform or sanitization pipelines that run selector matching over very large untrusted documents\n- applications that construct or mutate DOM trees programmatically from untrusted structure\n- applications that enable `Linkify(...)` over attacker-controlled text\n\n## Fixes in 1.18.0\n\n`1.18.0` adds generalized selector resource controls and removes several repeated-work hot paths:\n\n- shared selector limits for parse and match operations\n- structural caps for selector length, selector lists, compound selectors, complex selectors, and parse depth\n- match-operation and string-byte budgets\n- per-query matcher state for caches and cycle guards\n- precomputed or cached ancestor, sibling, positional, attribute-token, text-content, `:not(...)`, `:empty`, and `:nth-child(...)` work\n- consistent enforcement across public parsing, `query(...)`, tag-only query fast paths, transform selector compilation, and sanitization transform matching\n- linkification hardening for punctuation-heavy inputs and trailing bracket trimming\n\n## CWE mapping\n\n- CWE-400: Uncontrolled Resource Consumption\n- CWE-407: Inefficient Algorithmic Complexity\n- CWE-835: Loop with Unreachable Exit Condition\n\n## Recommended action\n\nUpgrade to `justhtml` `1.18.0`.\n\nIf users cannot upgrade immediately:\n\n- do not pass untrusted selector strings to `query(...)`, `matches(...)`, or selector-based transforms\n- restrict the size of untrusted documents before selector matching or linkification\n- avoid constructing programmatic DOM graphs from untrusted structure\n- avoid enabling `Linkify(...)` on very large attacker-controlled text\n\n## Credit\n\nDiscovered during an internal security review of `justhtml`.","format":"markdown","source":"ghsa"},{"lang":"es","text":"justhtml anterior a la versión 1.18.0 contiene múltiples problemas de denegación de servicio de baja gravedad en el manejo de selectores CSS y la linkificación. Las aplicaciones que evalúan cadenas de selectores controladas por el atacante (a través de query(), matches() o transformaciones basadas en selectores), ejecutan la coincidencia de selectores sobre documentos no confiables muy grandes, construyen árboles DOM a partir de estructuras no confiables, o habilitan la linkificación sobre texto controlado por el atacante pueden consumir una cantidad desproporcionada de CPU o memoria. Los desencadenantes incluyen selectores de tamaño excesivo, listas de selectores grandes, selectores compuestos de tamaño excesivo, cadenas de combinadores largas, pseudoclases funcionales profundamente anidadas, coincidencia repetida de tokens/posicional, gráficos DOM cíclicos que causan un recorrido no terminante, y entrada de linkificación con mucha puntuación o corchetes finales. Estas son preocupaciones solo de disponibilidad y no permiten por sí mismas la ejecución de scripts, la divulgación de datos o la omisión del saneador. El uso predeterminado de JustHTML(sanitize=True) no se espera que esté expuesto, ya que los selectores son normalmente proporcionados por el código de la aplicación.","source":"nvd"}],"published":"2026-05-08T18:19:30.000Z","modified":"2026-10-12T16:10:00.220Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"rating","rating":"LOW"}],"cwes":["CWE-400","CWE-407","CWE-835"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"1.18.0","status":"affected"},{"type":"semver","version":"1.18.0","status":"unaffected"}],"vendor":"EmilStenstrom","product":"justhtml","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.18.0"}],"ecosystem":"PyPI","package":"justhtml","purl":"pkg:pypi/justhtml","source":"ghsa"}],"references":[{"url":"https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-r8cj-3554-33mr","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/justhtml-before-denial-of-service-via-css-selector","tags":["third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/EmilStenstrom/justhtml","tags":["package"],"sources":["ghsa"]}],"credits":["EmilStenstrom"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-08-24T18:08:58.030Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-4671","url":"https://www.cve.org/CVERecord?id=CVE-2026-4671","licence":"CVE Terms of Use","modified":"2026-08-24T18:09:57.316Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-r8cj-3554-33mr","url":"https://github.com/advisories/GHSA-r8cj-3554-33mr","licence":"CC-BY-4.0","modified":"2026-08-24T03:55:59.727Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-4671","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-4671","licence":"Public domain","modified":"2026-10-12T16:10:00.220Z"}],"updatedAt":"2026-11-25T22:59:34.966Z","epss":{"score":0.00652,"percentile":0.45982,"date":"2026-11-30T12:00:22.000Z"}}