CVE-2026-5751

justhtml before 1.14.0 Mutation XSS via custom sanitization policies

Published Aug 23, 2026 CVSS 4.0 · 5.1 Medium EPSS < 1% KEV · Not listed
Description
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.

Analysis

AI-generated

Technical impact

justhtml versions prior to 1.14.0 expose a mutation XSS when a custom SanitizationPolicy preserves foreign namespaces. An attacker can craft input that sanitizes to apparently safe markup, but when the browser or another parser re‑processes the output the payload is executed as script, enabling client‑side code execution. This flaw is a classic Injection/HTML Injection weakness, classified as CWE‑79.

Affected Systems

The vulnerability affects the justhtml library developed by EmilStenstrom. Versions 1.13.0 and all earlier releases are impacted. The default safe configuration is immune; the flaw appears only when custom policies allow SVG, MathML, or raw‑text containers while preserving foreign namespaces.

Risk and Exploitability

The CVSS score of 5.1 indicates moderate severity. EPSS is not available, so the current exploitation probability is unknown, and the vulnerability is not listed in the CISA KEV catalog. Exploitation requires the attacker to supply crafted content to the sanitizer, which is feasible in applications that expose justhtml user input without upgrading. When custom policies are employed, the flaw can be leveraged; otherwise it remains mitigated by the default safe settings.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade justhtml to version 1.14.0 or newer, which removes the mutation XSS flaw.
  • If an upgrade cannot be performed immediately, configure the sanitization policy to drop foreign namespaces (set drop_foreign_namespaces=True) and avoid permitting raw‑text containers such as <style> or allowing SVG/MathML elements while preserving them.
  • As a temporary defensive measure, use the default safe configuration (sanitize=True) which is unaffected by this vulnerability.

Generated by OpenCVE AI on August 23, 2026 at 15:07 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Emilstenstrom
Emilstenstrom justhtml
Vendors & Products Emilstenstrom
Emilstenstrom justhtml
Type Values Removed Values Added
Description 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.
Title justhtml before 1.14.0 Mutation XSS via custom sanitization policies
Weaknesses CWE-79
References
Metrics cvssV3_1

{'score': 6.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N'}

cvssV4_0

{'score': 5.1, 'vector': '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'}

Weaknesses
  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Sources

Status
PUBLISHED
Assigner
VulnCheck
Published
Updated
Aug 24, 2026, 7:03 PM
Reserved
Apr 7, 2026, 3:54 PM
Status
Deferred
Published
Aug 23, 2026, 2:16 PM
Modified
Oct 12, 2026, 4:10 PM