Low

justhtml: Mutation XSS with custom foreign-namespace sanitization policies

  • Disclosed: 08.04.2026
  • Updated: 11.10.2026 15:17

Summary

A parser-differential / mutation XSS issue was found in justhtml when using a custom sanitization policy that preserves foreign namespaces such as SVG or MathML.

Under these custom settings, specially crafted input could sanitize into HTML that looked safe at first, but became unsafe when parsed again by a browser or another HTML parser.

Impact

This issue does not affect the default safe configuration.

You may be affected if you use a custom SanitizationPolicy with settings like:

  • drop_foreign_namespaces=False
  • allowlisted foreign elements such as MathML or SVG
  • allowlisted raw-text containers such as <style>

In that case, an attacker could inject markup that survives sanitization and turns into active HTML after re-parsing.

Affected versions

  • justhtml <= 1.13.0

Fixed version

  • Fixed in 1.14.0

Workarounds

Until you upgrade:

  • keep drop_foreign_namespaces=True
  • avoid allowlisting foreign namespaces for untrusted input
  • avoid allowlisting raw-text containers such as <style> in custom policies

Notes

The default JustHTML(..., sanitize=True) behavior was not found to be vulnerable in this issue.

Credit

Discovered by JustHTML author during a LLM-based security review of justhtml.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) justhtml >= 1.13.0, < 1.14.0 1.14.0

References

CVSS score -
CVSS vector
CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:A/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
Weakness (CWE)
CWE-79
Platform
Python (PyPI)
Package
justhtml
Disclosed
08.04.2026
Updated
11.10.2026 15:17

Sources and licenses

OSV / GitHub Advisory Database - GHSA-r758-8hxw-4845 - CC BY 4.0

Vulnerability history: justhtml

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (10) in the archive
Total entries
10
First → latest
03.2026 06.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • High 2
  • Medium 5
  • Low 3

Disclosures per year

  1. 2026: 10
Severity:
  1. justhtml: Mutation XSS with custom foreign-namespace sanitization policies this entry
    Low CVE-2026-5751 >= 1.13.0, < 1.14.0 1.14.0

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.