CVE-2026-6827 justhtml before 1.17.0 Multiple Cross-Site Scripting Vulnerabilities

Medium 5.1 Published Updated

Attackers can execute arbitrary scripts via XSS in justhtml when using custom policies that preserve foreign namespaces or specific DOM structures.

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-6827?

CVE-2026-6827 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 before 1.17.0 contains multiple security issues in sanitization, serialization, and programmatic DOM handling. When custom policies preserve foreign namespaces (SVG/MathML), dangerous content such as HTML integration points (SVG <foreignObject>, MathML <annotation-xml encoding="text/html">) and mutation-XSS parser-differential payloads could survive sanitization and become active HTML after reparse; SVG filter="url(...)" and preserved <style> could leave resource-loading CSS (@import, background-image:url()). Programmatic script/style/Comment nodes could serialize into active markup. Additional hardening fixes address sanitize-pipeline cache mutation and DOM parent/child cycles that could cause infinite loops. Most issues affect advanced or custom configurations rather than the default JustHTML(..., sanitize=True) safe path.

Weakness: CWE-79

Which versions are affected by CVE-2026-6827?

2 open source packages ship an affected version, including justhtml.

PackageAffectedFixed in
justhtml PyPIAll versions1.17.0
justhtml PyPIAll versions1.17.0

How do I fix CVE-2026-6827?

Upgrade justhtml to 1.17.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-6827 being exploited?

There is no known exploitation of CVE-2026-6827 in the wild and no public exploit code.

Sources

Also known as GHSA-f8m6-5gph-fw7f, GHSA-vrx2-77f2-ww34.

Is CVE-2026-6827 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free