GHSA-r8cj-3554-33mr: Justhtml Justhtml Introduces Denial-of-service Hardening Vulnerability

LOW
CWE-400 CWE-835 CWE-407
Published
Advisory Summary

GHSA-r8cj-3554-33mr is a LOW justhtml introduces denial-of-service hardening vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Justhtml libraries in the PyPI ecosystem. The issue involves justhtml introduces denial-of-service hardening. Remediation is available by upgrading affected packages to version 1.18.0.

GHSA-r8cj-3554-33mr at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-r8cj-3554-33mr
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Justhtml
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix GHSA-r8cj-3554-33mr

To remediate this vulnerability, upgrade all affected Justhtml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

justhtml fixed: 1.18.0
pip install justhtml>=1.18.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show justhtml

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-r8cj-3554-33mr, inspect your installed packages using pip:

pip show justhtml

Analyze the terminal output to locate any version of Justhtml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.18.0), your application is affected.

Note: The pip show justhtml command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Justhtml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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.0` ## Fixed version - `justhtml` `1.18.0` released on May 4, 2026 ## Impact ### 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`.

GHSA-r8cj-3554-33mr Affected Justhtml Versions

1 component(s)
Fixed Versions:
1.18.0
Product / Package Ecosystem Affected Versions Fixed Version
justhtml
PyPI
< 1.18.0
1.18.0

References

Frequently Asked Questions

What is GHSA-r8cj-3554-33mr?
GHSA-r8cj-3554-33mr is a security vulnerability in Justhtml involving justhtml introduces denial-of-service hardening under CWE-400: Uncontrolled Resource Consumption.
Which Justhtml versions are affected?
Affected versions include releases prior to 1.18.0 across affected packages: justhtml.
What version fixes GHSA-r8cj-3554-33mr?
Upgrading to 1.18.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is justhtml affected?
Yes, justhtml is affected in releases prior to 1.18.0. Upgrade your dependency to 1.18.0 or later.
What CWE is associated with GHSA-r8cj-3554-33mr?
GHSA-r8cj-3554-33mr is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check PyPI dependencies for GHSA-r8cj-3554-33mr?
Run the dependency tree command: 'pip show justhtml'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-r8cj-3554-33mr",
  "modified" : "2026-05-08T18:19:30Z",
  "published" : "2026-05-08T18:19:30Z",
  "aliases" : [ ],
  "summary" : "justhtml introduces denial-of-service hardening",
  "details" : "## 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`.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "justhtml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.18.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-r8cj-3554-33mr"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/EmilStenstrom/justhtml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-407", "CWE-835" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-08T18:19:30Z",
    "nvd_published_at" : null
  }
}