Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSupply malicious text node with closing tag sequence
-
DeliveryApplication processes DOM with permissive custom policy
-
Exploitsanitize_dom() serializes text literally without escaping
-
ExecutionSerialized output contains injected HTML markup
-
PersistVictim browser renders serialized page
-
ImpactInjected script executes in victim browser context
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 that the target application uses justhtml with a custom sanitization policy that explicitly permits retention of <style> or <script> elements, overriding the default policy which discards their contents. The application must additionally accept attacker-controlled input that ends up as a text node inside one of these permitted elements, and the serialized HTML output must subsequently be rendered in a victim's browser (UI:A - user interaction required). Applications using only the built-in default policy are completely unaffected regardless of version. Limiting factors include: the non-default custom policy requirement, the need for downstream browser rendering of the serialized output, and required user interaction to trigger execution. |
| Impact | The CVSS 4.0 score of 5.1 (Medium) with SC:L/SI:L and UI:A accurately reflects the constrained impact: only the subsequent system (the victim's browser) is affected, with low confidentiality and integrity impact, and user interaction is required to trigger rendering. The critical limiting factor is the non-default configuration prerequisite - applications must explicitly override the default policy to retain style or script elements before this serialization path is reachable, substantially narrowing the realistic attack surface to a subset of justhtml deployments. No KEV listing exists and active exploitation has not been confirmed. EPSS data was not provided in the source intelligence; given the narrow prerequisite, real-world exploitation probability is likely low even among affected deployments. The vulnerability is a genuine concern for any application that uses justhtml with a permissive policy for style or script elements, and upgrading to 1.12.0 should be treated as routine hygiene rather than an emergency response for teams not using such a custom policy. |
| Exploit ScenarioDerived | An attacker submits content containing a text node inside a permitted <style> element with the value </style><img src=x onerror=alert(document.cookie)>. When the application passes the resulting DOM through sanitize_dom() with a custom policy retaining style elements and then renders the serialized string in a browser, the literal </style> closes the style block and the injected img tag executes attacker JavaScript in the victim's browser session. No public exploit code has been identified at time of analysis, but the GHSA advisory exposes source-level detail sufficient to construct a proof of concept. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 23, 2026
Mutation XSS in justhtml (versions ≤1.11.0) allows injection of arbitrary HTML into serialized output when applications use a custom sanitization policy that retains raw-text elements such as <style> or <script>. Attacker-controlled text node content containing a closing tag sequence causes the serializer to break out of the raw-text context, inserting attacker-supplied markup into the final HTML string rendered by a victim's browser. No public exploit has been identified at time of analysis, but a vendor-released patch exists in version 1.12.0.
RemediationAI
Upgrade justhtml to version 1.12.0, which contains the vendor-released patch confirmed by GitHub Security Advisory GHSA-qvc2-mg72-jjhx (https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-qvc2-mg72-jjhx) and the VulnCheck advisory (https://www.vulncheck.com/advisories/justhtml-before-mutation-xss-via-raw-text-elements). If an immediate upgrade is not feasible, the most effective workaround is to revise the custom sanitization policy to drop or strip style and script elements entirely, aligning it with the default policy behavior; this eliminates the vulnerable serialization path at the cost of losing any intentional style or script passthrough in the output. No other compensating control fully mitigates the flaw without restricting these element types, as the vulnerability is inherent to their literal serialization.
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 package, CPE: cpe:2.3:a:emilstenstrom:justhtml:*:*:*:*:*:*:*:*) that produces safe HTML from untrusted DOM trees via sanitize_dom(). The root cause (CWE-79: Improper Neutralization of Input During Web Page Generation) resides in serialize.py, where text children of elements in the frozenset _LITERAL_TEXT_SERIALIZATION_ELEMENTS (containing 'script' and 'style') are emitted verbatim via return text instead of being passed through _escape_text(). This is a classic mutation XSS (mXSS) pattern: a text node containing </style>injected HTML is safely inert in a live DOM, but when serialized literally it produces a string that a browser re-parses as closing the <style> element and introducing arbitrary markup. The vulnerability path is only reachable when the caller supplies a custom policy that permits retention of style or script elements; the default justhtml policy discards their contents and is therefore completely unaffected.
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 because exploitation requires a non-default custom policy retaining style/script elements; S:C and UI:R reflect browser-side XSS impact requiring victim interaction.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
Lifecycle Timeline
1DescriptionCVE.org
justhtml before 1.12.0 (versions <= 1.11.0) contains a mutation cross-site scripting (mXSS) vulnerability in the serialization of raw-text elements such as <style> and <script>. When a DOM tree is processed by sanitize_dom() using a custom policy that keeps these elements, text nodes inside them are serialized literally without escaping, allowing attacker-controlled text containing the matching closing tag sequence to break out of the raw-text context and inject arbitrary HTML into the serialized output. The default sanitization policy is not affected because it drops the contents of style and script.
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 (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
Sanitization bypass in justhtml (Python HTML sanitization library) before version 1.17.0 enables cross-site scripting in
EUVD-2026-64660
GHSA-rc3v-3cc7-h7h5
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB