justhtml
Affected
- introduced
0, fixed1.18.0(ecosystem)
Fixed versions
1.18.0
Fix
- Fixed version
1.18.0pip install --upgrade justhtml==1.18.0
Advisory
Also known as: CVE-2026-4671
justhtml introduces denial-of-service hardening
Summary
justhtml 1.18.0 fixes multiple low-severity denial-of-service hardening issues in CSS selector handling and linkification.
These issues are availability concerns. They do not allow script execution, data disclosure, or sanitizer bypass by themselves.
Affected versions
justhtml < 1.18.0Fixed version
justhtml 1.18.0 released on May 4, 2026Impact
CSS selector handling
Applications that evaluate attacker-controlled selector strings, or that run selector-based transform pipelines over attacker-controlled documents, could consume disproportionate CPU or memory.
The 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.
Programmatically 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(...).
Linkification
Attacker-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.
Default configuration
Ordinary 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.
The main risk areas are:
query(...), matches(...), or selector-based transformsLinkify(...) over attacker-controlled textFixes in 1.18.0
1.18.0 adds generalized selector resource controls and removes several repeated-work hot paths:
:not(...), :empty, and :nth-child(...) workquery(...), tag-only query fast paths, transform selector compilation, and sanitization transform matchingCWE mapping
Recommended action
Upgrade to justhtml 1.18.0.
If users cannot upgrade immediately:
query(...), matches(...), or selector-based transformsLinkify(...) on very large attacker-controlled textCredit
Discovered during an internal security review of justhtml.
Low Basis: The source's own band: LOW
0, fixed 1.18.0 (ecosystem)1.18.0
1.18.0pip install --upgrade justhtml==1.18.0Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0