{"id":"CVE-2026-5751","aliases":["GHSA-r758-8hxw-4845"],"title":"justhtml: Mutation XSS with custom foreign-namespace sanitization policies","summary":"justhtml: Mutation XSS with custom foreign-namespace sanitization policies","severity":"low","vendor":"justhtml","product":"justhtml","ecosystem":"pip","affected":["justhtml >= 1.13.0, < 1.14.0"],"patched":["justhtml 1.14.0"],"published":"2026-04-08","updated":"2026-08-24","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-r758-8hxw-4845","references":[{"url":"https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-r758-8hxw-4845"},{"url":"https://github.com/EmilStenstrom/justhtml/commit/8adc4dfe31723dc522f44338f9bd98381c92b076"},{"url":"https://github.com/EmilStenstrom/justhtml"},{"url":"https://github.com/EmilStenstrom/justhtml/releases/tag/v1.14.0"}],"tags":["osv","pip"],"epss":0.00188,"epssPercentile":0.08682,"ingestedAt":"2026-08-24T19:25:44.289Z","slug":"CVE-2026-5751","body":"## Overview\n\n## Summary\n\nA parser-differential / mutation XSS issue was found in `justhtml` when using a **custom sanitization policy** that preserves foreign namespaces such as SVG or MathML.\n\nUnder 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.\n\n## Impact\n\nThis issue does **not** affect the default safe configuration.\n\nYou may be affected if you use a custom `SanitizationPolicy` with settings like:\n\n- `drop_foreign_namespaces=False`\n- allowlisted foreign elements such as MathML or SVG\n- allowlisted raw-text containers such as `<style>`\n\nIn that case, an attacker could inject markup that survives sanitization and turns into active HTML after re-parsing.\n\n## Affected versions\n\n- `justhtml` `<= 1.13.0`\n\n## Fixed version\n\n- Fixed in `1.14.0`\n\n## Workarounds\n\nUntil you upgrade:\n\n- keep `drop_foreign_namespaces=True`\n- avoid allowlisting foreign namespaces for untrusted input\n- avoid allowlisting raw-text containers such as `<style>` in custom policies\n\n## Notes\n\nThe default `JustHTML(..., sanitize=True)` behavior was not found to be vulnerable in this issue.\n\n## Credit\n\nDiscovered by JustHTML author during a LLM-based security review of `justhtml`.\n\n## Affected packages\n\n- `justhtml >= 1.13.0, < 1.14.0`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `justhtml 1.14.0`","depth":"sunlit","depthScore":14,"depthScoreParts":{"impact":13.8,"likelihood":0,"exploitation":0,"ransomware":0},"changes":[]}