Junglewise Threat Intelligence

CVE-2026-6827: justhtml multiple sanitization and DOM handling vulnerabilities

CVE-2026-6827 · Severity: medium · CVSS 6.1 · Published 2026-08-23

Technologies: Emil Stenstrom Justhtml.

Executive brief

justhtml is a Python HTML sanitization library used to remove malicious content from user-supplied HTML. Multiple security flaws in versions before 1.17.0 allow dangerous content to bypass sanitization and become active HTML, particularly when using custom policies for SVG or MathML namespaces, preserved styles, or programmatic DOM construction. Attackers can execute JavaScript (XSS), trigger resource fetches, or cause denial of service through infinite loops in affected configurations.

Technical details

The vulnerability encompasses multiple weaknesses: (1) improper namespace handling allows SVG <foreignObject> and MathML <annotation-xml encoding="text/html"> integration points to survive sanitization when custom policies preserve foreign namespaces; (2) mutation-XSS and parser-differential payloads bypass filtering through reparse operations; (3) SVG filter="url(...)" and preserved <style> elements can include resource-loading CSS like @import or background-image:url() that trigger external requests; (4) programmatic script, style, and Comment nodes serialize into active markup; (5) cache mutation and DOM parent/child cycles cause infinite loops. Most issues require custom namespace policies or programmatic DOM construction; the default JustHTML(..., sanitize=True) configuration is not affected by most vectors.

Affected products

  • Emil Stenstrom justhtml before 1.17.0

Timeline

  • 2026-04-19: disclosed
  • 2026-04-19: patched: justhtml 1.17.0 released

References