Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft parser-differential SVG/MathML payload
-
DeliverySubmit to app via form or API
-
Exploitjusthtml custom policy passes mutated markup as safe
-
ExecutionSanitized output stored or reflected in page
-
PersistVictim browser re-parses foreign-namespace subtree
-
ImpactXSS 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 requires the target application to use justhtml with a custom SanitizationPolicy that explicitly sets drop_foreign_namespaces=False AND either allowlists SVG or MathML elements, or allowlists raw-text containers such as <style>. Applications using the default JustHTML(sanitize=True) configuration are confirmed unaffected. What limits exploitation: the attacker has no network-level authentication barrier (PR:N), but the necessary non-default configuration must have been deliberately chosen by the application developer; a victim user must also actively load or interact with the page containing the mutated markup (UI:A required). Server-side or filesystem access is not required, and the impact is bounded to the victim's browser session - server integrity and confidentiality are not directly affected. |
| Impact | The CVSS 4.0 score of 5.1 (AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N) reflects a network-reachable, unauthenticated attack requiring active user interaction, with impact scoped to the subsequent browser context (SC:L/SI:L) rather than the server itself. The score's use of AT:N warrants scrutiny: the vulnerability is conditional on the application being deliberately configured with a non-default custom policy that preserves foreign namespaces - a prerequisite that, in CVSS 4.0 terms, arguably justifies AT:P (attack requirements present), which would further lower the score. This is therefore a realistic but genuinely narrow risk: only applications that have consciously opted into custom foreign-namespace policies are exposed. The exploitation is not automated (UI:A) and impact is bounded to browser-side confidentiality and integrity, not server compromise. No CISA KEV listing and no POC code were identified, so exploitation appears theoretical rather than observed. For affected deployments the risk is real - successful XSS can lead to session hijacking or credential theft - but the default-configuration exclusion significantly reduces the affected population. |
| Exploit ScenarioDerived | An attacker targeting an application that renders user-supplied HTML through justhtml with a custom foreign-namespace policy (e.g., a rich-text editor supporting SVG) submits a carefully crafted payload - for example, nested SVG or MathML elements with script-bearing attributes - that justhtml's parser evaluates as benign and passes. When another authenticated user's browser loads the sanitized output and its HTML5 parser re-serializes the foreign-namespace subtree, the markup mutates into an active script node, executing attacker-controlled JavaScript in the victim's session context. No public POC has been identified at time of analysis, but the mXSS technique is well-documented and the mutation primitive is reproducible given knowledge of the specific parser differential. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 23, 2026
Mutation XSS (mXSS) in justhtml 1.13.0 and earlier enables markup injection bypass against applications using non-default custom SanitizationPolicy configurations that preserve foreign namespaces. Specially crafted input sanitizes to apparently clean markup that is subsequently reinterpreted as executable script when re-parsed by a browser - a classic parser-differential attack. No public exploit identified at time of analysis and this CVE is not in CISA KEV; however, the no-special-authentication-required network attack vector and the availability of a confirmed patch commit make prompt upgrading the correct response for any application using affected custom policies.
RemediationAI
Upgrade justhtml to version 1.14.0, available via pip (pip install --upgrade justhtml). The upstream patch commit is 8adc4dfe31723dc522f44338f9bd98381c92b076 on the EmilStenstrom/justhtml repository. For applications that cannot immediately upgrade, three specific workarounds are available per the GHSA advisory: (1) Ensure drop_foreign_namespaces=True in all custom SanitizationPolicy instances - this closes the foreign-namespace parser-differential path but will strip SVG and MathML elements that the application may intentionally render, so verify rendering requirements before applying; (2) Remove foreign namespace elements (SVG, MathML) from any custom allowlists - acceptable only if the application does not depend on rich-content rendering; (3) Remove raw-text containers such as <style> from custom allowlists - may break intended inline CSS if applications use embedded stylesheets in user content. None of these workarounds affect applications already using the default sanitize=True configuration, which requires no action. The advisory is at https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-r758-8hxw-4845.
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 is a Python HTML sanitization library (pip/justhtml, CPE: cpe:2.3:a:emilstenstrom:justhtml) designed to strip unsafe markup from untrusted input. The vulnerability class is CWE-79 (Improper Neutralization of Input During Web Page Generation / XSS), manifesting specifically as a mutation XSS via parser-differential behaviour. mXSS exploits the gap between what a sanitizer's internal parser considers valid and what a downstream browser HTML5 parser will re-serialize from the same byte sequence. When a custom SanitizationPolicy permits foreign namespace elements - SVG or MathML via drop_foreign_namespaces=False - or allowlists raw-text containers such as <style>, the sanitizer's tree construction may produce serialized HTML that a browser's speculative re-parsing will reinterpret differently, hoisting script-injecting nodes outside of their sanitized context. The default JustHTML(sanitize=True) path was confirmed not vulnerable; only explicitly constructed custom policies trigger the issue. Fixed version is 1.14.0, with the upstream patch commit at github.com/EmilStenstrom/justhtml/commit/8adc4dfe31723dc522f44338f9bd98381c92b076.
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 the non-default custom policy prerequisite beyond attacker control; scope changes to browser context (S:C) with bounded C:L/I:L XSS impact; UI:R because victim must load the page.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
Lifecycle Timeline
1DescriptionCVE.org
justhtml versions 1.13.0 and earlier contain a parser-differential / mutation cross-site scripting (mXSS) vulnerability when using a custom SanitizationPolicy that preserves foreign namespaces (e.g., drop_foreign_namespaces=False with allowlisted SVG/MathML elements or raw-text containers such as <style>). Specially crafted input can sanitize into markup that appears safe but becomes unsafe when re-parsed by a browser or another HTML parser, allowing markup injection. The default safe configuration (sanitize=True) is not affected. Fixed in 1.14.0.
Blast Radius
ecosystem impact- 1 pypi packages depend on justhtml (1 direct, 0 indirect)
Ecosystem-wide dependent count for version 1.13.0.
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
Cross-site scripting in justhtml versions before 1.13.0 allows attackers who control `<pre>` element content to break ou
Sanitization bypass in justhtml (Python HTML sanitization library) before version 1.17.0 enables cross-site scripting in
EUVD-2026-64654
GHSA-3227-3f97-9f2q
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB