Skip to main content

justhtml CVE-2026-6827

| EUVDEUVD-2026-64655 MEDIUM
Cross-site Scripting (XSS) (CWE-79)
2026-08-23 VulnCheck GHSA-f8m6-5gph-fw7f
5.1
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit crafted SVG/MathML HTML to application
  2. Delivery
    Bypass justhtml sanitization under custom foreign-namespace policy
  3. Exploit
    Malicious markup preserved in sanitized output
  4. Execution
    Victim browser loads rendered content
  5. Persist
    HTML5 parser reactivates payload at namespace integration point
  6. Impact
    Attacker 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.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

justhtml 0 <1.16.0

Affected Packages

pypi justhtml fix: 1.16.0, 1.17.0

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

Vendor (VulnCheck) PRIMARY 5.1 MEDIUM
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
vuln.today AI 4.7 MEDIUM

AC:H reflects mandatory non-default configuration (custom SVG/MathML policy); scope changed because XSS impacts victim browser separately from server.

3.1 AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N
4.0 AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Active
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
None
Subsequent system: Confidentiality
Low
Subsequent system: Integrity
Low
Subsequent system: Availability
None

Lifecycle Timeline

1
Patch available
Aug 23, 2026 - 14:01 EUVD

DescriptionCVE.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

EPSS Score
0.2%
Top 92% exploitable
Prevalence
Low
niche Python HTML sanitization library, limited enterprise footprint
Data Quality
6 sources
Confidence: High

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.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

26
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +26
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

CVE-2026-9769 HIGH POC
8.7 Aug 23

Uncontrolled recursion in the justhtml Python HTML parsing library (all versions through 1.9.1) allows any remote unauth

CVE-2026-8445 CRITICAL
9.3 Aug 23

Sanitizer bypass in the justhtml Python library (versions <= 1.11.0) allows attacker-controlled input to survive as raw

CVE-2026-7808 CRITICAL
9.3 Aug 23

Cross-site scripting via HTML sanitization bypass affects justhtml (a Python HTML parsing/sanitization library by EmilSt

CVE-2026-5388 CRITICAL
9.3 Aug 23

Sanitization bypass in justhtml (a Python HTML/Markdown sanitization library) before 1.15.0 lets attacker-controlled inp

CVE-2026-4671 HIGH
8.7 Aug 23

Uncontrolled resource consumption in justhtml before 1.18.0 enables denial-of-service conditions through CPU and memory

CVE-2026-77088 MEDIUM
5.3 Aug 23

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

CVE-2026-74793 MEDIUM
5.1 Aug 23

Cross-site scripting in justhtml before 3.11.0 allows remote unauthenticated attackers to execute arbitrary JavaScript i

CVE-2026-8630 MEDIUM
5.1 Aug 23

Mutation XSS in justhtml (versions ≤1.11.0) allows injection of arbitrary HTML into serialized output when applications

CVE-2026-5751 MEDIUM
5.1 Aug 23

Mutation XSS (mXSS) in justhtml 1.13.0 and earlier enables markup injection bypass against applications using non-defaul

CVE-2026-5389 MEDIUM
5.1 Aug 23

Cross-site scripting in justhtml versions before 1.13.0 allows attackers who control `<pre>` element content to break ou

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy