GHSA-4p64-v8f5-r2gx: Justhtml Multiple Security Fixes Vulnerability

LOW
Advisory Summary

GHSA-4p64-v8f5-r2gx is a LOW multiple security fixes vulnerability (CWE-436: Interpretation Conflict) affecting Justhtml libraries in the PyPI ecosystem. The issue involves multiple security fixes in justhtml. Remediation is available by upgrading affected packages to version 1.16.0.

GHSA-4p64-v8f5-r2gx at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-4p64-v8f5-r2gx
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-436: Interpretation Conflict
Affected Product Justhtml
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix GHSA-4p64-v8f5-r2gx

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.16.0
pip install justhtml>=1.16.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-4p64-v8f5-r2gx, 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.16.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-436: Interpretation Conflict, where product a handles inputs or steps differently than product b, which causes a to perform incorrect actions based on its perception of b's state. 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.16.0` fixes multiple security issues in sanitization, serialization, and programmatic DOM handling. Most of these issues affected one of these advanced paths rather than ordinary parsed HTML with the default safe settings: - programmatic DOM input to `sanitize()` or `sanitize_dom()` - reused or mutated sanitization policy objects - custom policies that preserve foreign namespaces such as SVG or MathML ## Affected versions - `justhtml` `<= 1.15.0` ## Fixed version - `justhtml` `1.16.0` released on April 12, 2026 ## Impact ### Policy reuse and mutation Nested mutation of sanitization policy internals could weaken later sanitization by leaving stale compiled sanitizers active, or by mutating exported default policy internals process-wide. ### In-memory sanitization gaps Programmatic DOM sanitization could miss dangerous mixed-case tag names such as `ScRiPt` or `StYlE`, and custom `drop_content_tags` values such as `{"SCRIPT"}` could silently fail to drop dangerous subtrees. ### Serialization injection Crafted programmatic doctype names could serialize into active markup before the document body. ### Foreign-namespace policy bypasses Custom policies that preserve SVG or MathML could allow active SVG features to survive sanitization, including: - animation elements such as `<set>` and `<animate>` that mutate already-sanitized attributes after sanitization - presentation attributes such as `fill`, `clip-path`, `mask`, `marker-start`, and `cursor` containing external `url(...)` references - programmatic DOM trees that claim `namespace="html"` but serialize as `<svg>` or `<math>`, bypassing foreign-content checks ### Rawtext hardening gap Mixed-case programmatic `style` or `script` nodes could bypass rawtext hardening and preserve active stylesheet content such as remote `@import` rules. ## Default configuration Most of these issues did **not** affect the normal `JustHTML(..., sanitize=True)` path for ordinary parsed HTML. The main exceptions were policy-mutation issues, which could weaken later sanitization if code mutated nested state on reused policy objects or exported defaults. ## Recommended action Upgrade to `justhtml` `1.16.0`. If you cannot upgrade immediately: - do not mutate `DEFAULT_POLICY`, `DEFAULT_DOCUMENT_POLICY`, or nested policy internals - avoid reusing policy objects after mutating nested state - avoid preserving SVG or MathML for untrusted input - avoid preserving `style` or `script` in custom policies for untrusted input - avoid serializing untrusted programmatic doctypes or DOM trees ## Credit Discovered during an internal security review of `justhtml`.

GHSA-4p64-v8f5-r2gx Affected Justhtml Versions

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

References

Frequently Asked Questions

What is GHSA-4p64-v8f5-r2gx?
GHSA-4p64-v8f5-r2gx is a security vulnerability in Justhtml involving Multiple security fixes in justhtml under CWE-436: Interpretation Conflict.
Which Justhtml versions are affected?
Affected versions include releases prior to 1.16.0 across affected packages: justhtml.
What version fixes GHSA-4p64-v8f5-r2gx?
Upgrading to 1.16.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.16.0. Upgrade your dependency to 1.16.0 or later.
What CWE is associated with GHSA-4p64-v8f5-r2gx?
GHSA-4p64-v8f5-r2gx is classified under CWE-436: Interpretation Conflict (Product A handles inputs or steps differently than Product B, which causes A to perform incorrect actions based on its perception of B's state.).
How can I check PyPI dependencies for GHSA-4p64-v8f5-r2gx?
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-4p64-v8f5-r2gx",
  "modified" : "2026-04-14T20:05:10Z",
  "published" : "2026-04-14T20:05:10Z",
  "aliases" : [ ],
  "summary" : "Multiple security fixes in justhtml",
  "details" : "## Summary\n\n`justhtml` `1.16.0` fixes multiple security issues in sanitization, serialization, and programmatic DOM handling.\n\nMost of these issues affected one of these advanced paths rather than ordinary parsed HTML with the default safe settings:\n\n- programmatic DOM input to `sanitize()` or `sanitize_dom()`\n- reused or mutated sanitization policy objects\n- custom policies that preserve foreign namespaces such as SVG or MathML\n\n## Affected versions\n\n- `justhtml` `<= 1.15.0`\n\n## Fixed version\n\n- `justhtml` `1.16.0` released on April 12, 2026\n\n## Impact\n\n### Policy reuse and mutation\nNested mutation of sanitization policy internals could weaken later sanitization by leaving stale compiled sanitizers active, or by mutating exported default policy internals process-wide.\n\n### In-memory sanitization gaps\nProgrammatic DOM sanitization could miss dangerous mixed-case tag names such as `ScRiPt` or `StYlE`, and custom `drop_content_tags` values such as `{\"SCRIPT\"}` could silently fail to drop dangerous subtrees.\n\n### Serialization injection\nCrafted programmatic doctype names could serialize into active markup before the document body.\n\n### Foreign-namespace policy bypasses\nCustom policies that preserve SVG or MathML could allow active SVG features to survive sanitization, including:\n\n- animation elements such as `<set>` and `<animate>` that mutate already-sanitized attributes after sanitization\n- presentation attributes such as `fill`, `clip-path`, `mask`, `marker-start`, and `cursor` containing external `url(...)` references\n- programmatic DOM trees that claim `namespace=\"html\"` but serialize as `<svg>` or `<math>`, bypassing foreign-content checks\n\n### Rawtext hardening gap\nMixed-case programmatic `style` or `script` nodes could bypass rawtext hardening and preserve active stylesheet content such as remote `@import` rules.\n\n## Default configuration\n\nMost of these issues did **not** affect the normal `JustHTML(..., sanitize=True)` path for ordinary parsed HTML.\n\nThe main exceptions were policy-mutation issues, which could weaken later sanitization if code mutated nested state on reused policy objects or exported defaults.\n\n## Recommended action\n\nUpgrade to `justhtml` `1.16.0`.\n\nIf you cannot upgrade immediately:\n\n- do not mutate `DEFAULT_POLICY`, `DEFAULT_DOCUMENT_POLICY`, or nested policy internals\n- avoid reusing policy objects after mutating nested state\n- avoid preserving SVG or MathML for untrusted input\n- avoid preserving `style` or `script` in custom policies for untrusted input\n- avoid serializing untrusted programmatic doctypes or DOM trees\n\n## Credit\n\nDiscovered during an internal security review of `justhtml`.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:U"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "justhtml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.16.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.15.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-4p64-v8f5-r2gx"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/EmilStenstrom/justhtml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-178", "CWE-436", "CWE-471", "CWE-79" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-14T20:05:10Z",
    "nvd_published_at" : null
  }
}