CVE-2026-5751 justhtml before 1.14.0 Mutation XSS via custom sanitization policies
Attackers can execute arbitrary scripts via mutation XSS when using custom sanitization policies that preserve foreign namespaces.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- None listed
What is CVE-2026-5751?
CVE-2026-5751 is a medium-severity cross-site scripting vulnerability in EmilStenstrom justhtml, published on 23 Aug 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official 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.
Weakness: CWE-79
Which versions are affected by CVE-2026-5751?
2 open source packages ship an affected version, including justhtml.
| Package | Affected | Fixed in |
|---|---|---|
justhtml PyPI | From 1.13.0 | 1.14.0 |
justhtml PyPI | From 1.13.0 | 1.14.0 |
How do I fix CVE-2026-5751?
Upgrade justhtml to 1.14.0 or later.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2026-5751 being exploited?
There is no known exploitation of CVE-2026-5751 in the wild and no public exploit code.
Sources
Also known as GHSA-3227-3f97-9f2q, GHSA-r758-8hxw-4845.