Skip to main content

justhtml CVE-2026-5751

| EUVDEUVD-2026-64654 MEDIUM
Cross-site Scripting (XSS) (CWE-79)
2026-08-23 VulnCheck GHSA-3227-3f97-9f2q
5.1
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

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

  1. Access
    Craft parser-differential SVG/MathML payload
  2. Delivery
    Submit to app via form or API
  3. Exploit
    justhtml custom policy passes mutated markup as safe
  4. Execution
    Sanitized output stored or reflected in page
  5. Persist
    Victim browser re-parses foreign-namespace subtree
  6. Impact
    XSS 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.

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

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

justhtml 0 <1.14.0

Affected Packages

pypi justhtml fix: 1.14.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 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

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

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 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
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 1 pypi packages depend on justhtml (1 direct, 0 indirect)

Ecosystem-wide dependent count for version 1.13.0.

Threat Intelligence Overview

EPSS Score
0.2%
Top 92% exploitable
Prevalence
Low
niche Python HTML sanitization library, limited known enterprise adoption
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-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

CVE-2026-6827 MEDIUM
5.1 Aug 23

Sanitization bypass in justhtml (Python HTML sanitization library) before version 1.17.0 enables cross-site scripting in

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