Summary
justhtml introduces denial-of-service hardening
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.0
Fixed version
justhtml1.18.0released on May 4, 2026
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:
- applications that accept selector strings from untrusted users and pass them to
query(...),matches(...), or selector-based transforms - custom transform or sanitization pipelines that run selector matching over very large untrusted documents
- applications that construct or mutate DOM trees programmatically from untrusted structure
- applications that enable
Linkify(...)over attacker-controlled text
Fixes in 1.18.0
1.18.0 adds generalized selector resource controls and removes several repeated-work hot paths:
- shared selector limits for parse and match operations
- structural caps for selector length, selector lists, compound selectors, complex selectors, and parse depth
- match-operation and string-byte budgets
- per-query matcher state for caches and cycle guards
- precomputed or cached ancestor, sibling, positional, attribute-token, text-content,
:not(...),:empty, and:nth-child(...)work - consistent enforcement across public parsing,
query(...), tag-only query fast paths, transform selector compilation, and sanitization transform matching - linkification hardening for punctuation-heavy inputs and trailing bracket trimming
CWE mapping
- CWE-400: Uncontrolled Resource Consumption
- CWE-407: Inefficient Algorithmic Complexity
- CWE-835: Loop with Unreachable Exit Condition
Recommended action
Upgrade to justhtml 1.18.0.
If users cannot upgrade immediately:
- do not pass untrusted selector strings to
query(...),matches(...), or selector-based transforms - restrict the size of untrusted documents before selector matching or linkification
- avoid constructing programmatic DOM graphs from untrusted structure
- avoid enabling
Linkify(...)on very large attacker-controlled text
Credit
Discovered during an internal security review of justhtml.
Impact
Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service. Typical impact: denial of service.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is GHSA-R8CJ-3554-33MR? GHSA-R8CJ-3554-33MR is a low-severity uncontrolled resource consumption vulnerability in justhtml (pip), affecting versions < 1.18.0. It is fixed in 1.18.0. Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service.
- Which versions of justhtml are affected by GHSA-R8CJ-3554-33MR? justhtml (pip) versions < 1.18.0 is affected.
- Is there a fix for GHSA-R8CJ-3554-33MR? Yes. GHSA-R8CJ-3554-33MR is fixed in 1.18.0. Upgrade to this version or later.
- Is GHSA-R8CJ-3554-33MR exploitable, and should I be worried? Whether GHSA-R8CJ-3554-33MR is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-R8CJ-3554-33MR is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-R8CJ-3554-33MR? Upgrade
justhtmlto 1.18.0 or later.