Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit crafted SVG/MathML HTML to application
-
DeliveryBypass justhtml sanitization under custom foreign-namespace policy
-
ExploitMalicious markup preserved in sanitized output
-
ExecutionVictim browser loads rendered content
-
PersistHTML5 parser reactivates payload at namespace integration point
-
ImpactAttacker JavaScript executes in victim browser session
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation of the primary XSS vectors requires the target application to use justhtml with a custom sanitization policy that explicitly preserves SVG or MathML foreign namespace elements (overriding the default deny behavior), or to preserve <style> elements for untrusted HTML input. Applications using only the default JustHTML(..., sanitize=True) configuration without custom foreign-namespace or <style> policies are explicitly confirmed by the vendor to be unaffected by most issues. The programmatic DOM serialization issue additionally requires the application to construct or mutate DOM trees directly in code (using justhtml's node APIs) before calling to_html() or to_markdown(html_passthrough=True). Exploitation is further constrained by the requirement for a victim user to load or view the rendered output in a browser (UI:A per the CVSS 4.0 vector), meaning server-side-only processing that never renders to a browser is not affected by the XSS impact. The cache mutation issue requires repeated sanitization passes on the same pipeline instance to degrade security over time. |
| Impact | The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N, score 5.1) reflects a network-reachable XSS affecting only the subsequent system (end-user browser), with user interaction required (UI:A) and no direct impact on the server-side vulnerable component (VC/VI/VA all N). The score of 5.1 is consistent with medium severity. EPSS data was not provided in the source intelligence, limiting probabilistic exploitation forecasting. This CVE does not appear in the CISA KEV catalog and no public proof-of-concept exploit code was identified, reducing immediate exploitation urgency. Critically, the vendor and GHSA advisory explicitly confirm that the default JustHTML(..., sanitize=True) configuration is not affected by most issues - the real risk is concentrated in applications using non-default custom policies that preserve SVG/MathML namespaces or <style> elements, or those performing direct programmatic DOM construction. The SVG filter="url(...)" and CSS resource-loading issues introduce a secondary risk vector (server-side request forgery or data exfiltration via CSS) beyond pure XSS. The cache mutation finding is lower severity but could silently degrade security posture over time. Overall, real-world risk is low for applications using default configurations and medium for those with custom foreign-namespace policies exposed to untrusted input. |
| Exploit ScenarioDerived | An attacker submits a crafted HTML fragment containing a mutation-XSS payload that uses an SVG <foreignObject> or MathML <annotation-xml encoding="text/html"> integration point to an application that calls justhtml with a custom policy permitting foreign namespaces (for example, a content platform allowing rich media embeds). The payload appears inert in justhtml's internal DOM and passes sanitization, but when the application renders the sanitized output in a user's browser, the HTML5 parser re-enters HTML content model at the integration point boundary, activating embedded JavaScript. No public proof-of-concept code has been identified, but the mXSS technique is well-documented in public research and skilled attackers familiar with parser-differential payloads could construct one from the advisory description alone. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 23, 2026
Sanitization bypass in justhtml (Python HTML sanitization library) before version 1.17.0 enables cross-site scripting in applications using custom policies that preserve SVG or MathML namespaces, custom policies that preserve <style> blocks, or programmatic DOM construction prior to serialization. Crafted HTML input containing mutation-XSS parser-differential payloads, HTML integration points such as SVG <foreignObject> or MathML <annotation-xml encoding="text/html">, or resource-loading CSS constructs can survive sanitization and activate as executable markup after browser reparse. No public exploit code has been identified and the CISA KEV list does not list this CVE; notably, the default JustHTML(..., sanitize=True) configuration is not affected by most of the reported issues.
RemediationAI
Upgrade justhtml to version 1.17.0, released April 19, 2026, which fully addresses all reported sanitization bypass, serialization, and DOM handling issues. The vendor advisory is at https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-vrx2-77f2-ww34 and the VulnCheck advisory is at https://www.vulncheck.com/advisories/justhtml-before-multiple-cross-site-scripting-vulnerabilities. For applications that cannot immediately upgrade, the vendor recommends: removing any custom policies that preserve SVG or MathML namespaces for untrusted input (trade-off: this disables SVG/MathML rendering entirely but eliminates the primary attack surface); removing custom policies that preserve <style> elements from untrusted input (trade-off: disables CSS passthrough); and avoiding programmatic construction or mutation of DOM trees from untrusted data before calling to_html() or to_markdown(html_passthrough=True). Applications using only the default JustHTML(..., sanitize=True) path without custom policies have significantly reduced exposure but should still upgrade to benefit from the cache mutation and DOM cycle hardening fixes.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
justhtml (cpe:2.3:a:emilstenstrom:justhtml:*:*:*:*:*:*:*:*) is a Python HTML sanitization and serialization library available on PyPI. The root cause class is CWE-79 (Improper Neutralization of Input During Web Page Generation / XSS), manifesting across three distinct attack surfaces. First, foreign-namespace handling: when custom sanitization policies permit SVG or MathML elements, parser-context boundaries create opportunities for mutation-XSS (mXSS) - payloads that appear inert in the library's DOM representation but reactivate as executable HTML when the browser's HTML5 parser re-serializes the document tree. HTML integration points (SVG <foreignObject>, MathML <annotation-xml encoding="text/html">, SVG <title>/<desc>, and MathML text integration points) are particularly dangerous because they toggle the parser's content model between foreign and HTML contexts. Second, <style> preservation inconsistency: constructor-time sanitization and direct Sanitize() transforms handled preserved <style> blocks differently from the sanitize()/sanitize_dom() APIs, leaving @import and background-image:url() constructs that trigger external resource fetches (a CSS exfiltration vector in addition to XSS). Third, programmatic DOM serialization: script, style, and Comment nodes built directly in code could serialize into active markup via to_html() or to_markdown(html_passthrough=True). Two auxiliary hardening issues - sanitize-pipeline cache mutation after warming (weakening later sanitization passes) and parent/child DOM cycles causing infinite loops - were also fixed in 1.17.0.
Know when Justhtml gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
AC:H reflects mandatory non-default configuration (custom SVG/MathML policy); scope changed because XSS impacts victim browser separately from server.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
Lifecycle Timeline
1DescriptionCVE.org
justhtml before 1.17.0 contains multiple security issues in sanitization, serialization, and programmatic DOM handling. When custom policies preserve foreign namespaces (SVG/MathML), dangerous content such as HTML integration points (SVG <foreignObject>, MathML <annotation-xml encoding="text/html">) and mutation-XSS parser-differential payloads could survive sanitization and become active HTML after reparse; SVG filter="url(...)" and preserved <style> could leave resource-loading CSS (@import, background-image:url()). Programmatic script/style/Comment nodes could serialize into active markup. Additional hardening fixes address sanitize-pipeline cache mutation and DOM parent/child cycles that could cause infinite loops. Most issues affect advanced or custom configurations rather than the default JustHTML(..., sanitize=True) safe path.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.
Uncontrolled recursion in the justhtml Python HTML parsing library (all versions through 1.9.1) allows any remote unauth
Sanitizer bypass in the justhtml Python library (versions <= 1.11.0) allows attacker-controlled input to survive as raw
Cross-site scripting via HTML sanitization bypass affects justhtml (a Python HTML parsing/sanitization library by EmilSt
Sanitization bypass in justhtml (a Python HTML/Markdown sanitization library) before 1.15.0 lets attacker-controlled inp
Uncontrolled resource consumption in justhtml before 1.18.0 enables denial-of-service conditions through CPU and memory
Cross-site scripting in justhtml 0.9.0-1.21.0 allows an attacker who can control the text content of HTML code or pre el
Cross-site scripting in justhtml before 3.11.0 allows remote unauthenticated attackers to execute arbitrary JavaScript i
Mutation XSS in justhtml (versions ≤1.11.0) allows injection of arbitrary HTML into serialized output when applications
Mutation XSS (mXSS) in justhtml 1.13.0 and earlier enables markup injection bypass against applications using non-defaul
Cross-site scripting in justhtml versions before 1.13.0 allows attackers who control `<pre>` element content to break ou
EUVD-2026-64655
GHSA-f8m6-5gph-fw7f
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB