GHSA-vrx2-77f2-ww34: Justhtml Justhtml Has Sanitization Bypass Vulnerability
MODERATEGHSA-vrx2-77f2-ww34 is a MODERATE justhtml has sanitization bypass vulnerability (CWE-436: Interpretation Conflict) affecting Justhtml libraries in the PyPI ecosystem. The issue involves justhtml has sanitization bypass in custom policies and programmatic dom. Remediation is available by upgrading affected packages to version 1.17.0.
GHSA-vrx2-77f2-ww34 at a Glance
How to Fix GHSA-vrx2-77f2-ww34
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.
pip install justhtml>=1.17.0
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-vrx2-77f2-ww34, 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.17.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
GHSA-vrx2-77f2-ww34 Affected Justhtml Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
justhtml
|
PyPI |
< 1.17.0
|
1.17.0
|
References
Frequently Asked Questions
What is GHSA-vrx2-77f2-ww34?
Which Justhtml versions are affected?
What version fixes GHSA-vrx2-77f2-ww34?
Is justhtml affected?
What CWE is associated with GHSA-vrx2-77f2-ww34?
How can I check PyPI dependencies for GHSA-vrx2-77f2-ww34?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vrx2-77f2-ww34",
"modified" : "2026-04-22T21:25:46Z",
"published" : "2026-04-22T21:25:46Z",
"aliases" : [ ],
"summary" : "justhtml has sanitization bypass in custom policies and programmatic DOM",
"details" : "## Summary\n\n`justhtml` `1.17.0` fixes multiple security issues in sanitization, serialization, and programmatic DOM handling.\n\nMost of these issues affected advanced or custom configurations rather than the default safe path.\n\n## Affected versions\n\n- `justhtml` `<= 1.16.0`\n\n## Fixed version\n\n- `justhtml` `1.17.0` released on April 19, 2026\n\n## Impact\n\n### Custom SVG / MathML sanitization policies\nCustom policies that preserved foreign namespaces could allow dangerous content to survive sanitization, including:\n\n- active HTML integration points such as SVG `<foreignObject>`, MathML `<annotation-xml encoding=\"text/html\">`, SVG `<title>` / `<desc>`, and MathML text integration points\n- mutation-XSS parser-differential payloads that looked inert in memory but became active HTML after reparse\n- SVG `filter=\"url(...)\"` attributes that could trigger external fetches\n\nThese issues affected:\n- `JustHTML(..., sanitize=True)` with custom foreign-namespace policies\n- `sanitize()` / `sanitize_dom()`\n- low-level terminal `Sanitize(...)` transform execution\n\n### Preserved `<style>` handling\nConstructor-time sanitization and explicit `Sanitize(...)` transforms did not fully match `sanitize()` / `sanitize_dom()` when custom policies preserved `<style>`.\n\nThat could leave resource-loading CSS such as `@import` or `background-image:url(...)` in sanitized output from HTML string input.\n\n### Programmatic DOM serialization\nProgrammatic `script`, `style`, and `Comment(...)` nodes could still serialize into active markup in some edge cases.\n\nThis could affect applications that build or mutate DOM trees directly before calling `to_html()` or `to_markdown(html_passthrough=True)`.\n\n### Cache mutation and DOM cycle handling\nTwo lower-severity hardening fixes were included:\n\n- compiled sanitize-pipeline caches could be mutated after warming and weaken later sanitization\n- parent/child cycles in programmatic DOM trees could cause infinite loops in operations such as `to_html()` and `sanitize_dom()`\n\n## Default configuration\n\nMost of the issues above did **not** affect ordinary parsed HTML with the default `JustHTML(..., sanitize=True)` configuration.\n\nThe main risk areas were:\n\n- custom policies that preserve SVG or MathML\n- custom policies that preserve `<style>`\n- programmatic DOM construction or mutation\n- low-level direct sanitizer/transform APIs\n\n## Recommended action\n\nUpgrade to `justhtml` `1.17.0`.\n\nIf users cannot upgrade immediately:\n\n- avoid preserving SVG or MathML for untrusted input\n- avoid preserving `<style>` for untrusted input\n- avoid mutating programmatic DOM trees with untrusted `script`, `style`, or comment content\n- avoid mutating warmed policy internals or sanitizer caches\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:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:L/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "justhtml"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.17.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-vrx2-77f2-ww34"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/EmilStenstrom/justhtml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-436", "CWE-471", "CWE-79", "CWE-835" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-22T21:25:46Z",
"nvd_published_at" : null
}
}