CVE-2026-5751: justhtml before 1.14.0 Mutation XSS via custom sanitization policies

Published Aug 23, 2026
·
Updated

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., dropforeignnamespaces=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.

Affected Software

2 affected components
justhtml/justhtml<=1.13.0
justhtml/justhtml<1.14.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade justhtml to a version that resolves this vulnerability.

    Fixed in 1.14.0
  2. Configuration

    Avoid parser-differential/mutation XSS by not preserving foreign namespaces in a custom SanitizationPolicy; for example, set drop_foreign_namespaces=True instead of drop_foreign_namespaces=False (the vulnerable configuration described for justhtml <= 1.13.0).

    justhtml SanitizationPolicy drop_foreign_namespaces = true

Event History

Aug 23, 2026
CVE Published
via MITRE·01:34 PM
Data Sourced
via MITRE·01:34 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·02:16 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are affected?

Affected deployments use justhtml 1.13.0 or earlier with a custom SanitizationPolicy that preserves foreign namespaces, such as drop_foreign_namespaces=False, together with allowlisted SVG/MathML elements or raw-text containers like <style>. The default sanitize=True configuration is not affected.

2

What does an attacker need to exploit this issue?

An attacker needs to supply specially crafted HTML that is processed by an affected custom sanitization policy. Exploitation relies on the sanitized output later being re-parsed by a browser or another HTML parser, where parser differences can turn apparently safe markup into injected markup.

3

What should teams do if they use a custom sanitization policy?

Upgrade to justhtml 1.14.0. Until upgrading, avoid policies that preserve foreign namespaces and avoid allowlisting SVG, MathML, or raw-text containers such as <style> for untrusted input.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203