{"id":"CVE-2026-5751","aliases":["EUVD-2026-64654","GHSA-3227-3f97-9f2q","GHSA-r758-8hxw-4845"],"status":"published","title":"justhtml before 1.14.0 Mutation XSS via custom sanitization policies","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 \u003cstyle\u003e). 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.","severity":{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"medium","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-11","score":0.00263,"percentile":0.18248,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-79"],"published":"2026-04-08T00:06:17Z","modified":"2026-10-28T02:30:21Z","fixes":[{"ecosystem":"PyPI","package":"justhtml","fixed_in":["1.14.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"PyPI","package":"justhtml","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"1.13.0"},{"fixed":"1.14.0"}]}]},{"source":"osv","ecosystem":"PyPI","package":"justhtml","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"1.13.0"},{"fixed":"1.14.0"}]}],"versions":["1.13.0"]}],"products":[{"vendor":"emilstenstrom","product":"justhtml"}],"references":[{"url":"https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-r758-8hxw-4845","tags":["vendor-advisory","advisory","web"]},{"url":"https://www.vulncheck.com/advisories/justhtml-before-mutation-xss-via-custom-sanitization-policies","tags":["third-party-advisory","advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-5751","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-3227-3f97-9f2q"},{"url":"https://github.com/EmilStenstrom/justhtml/commit/8adc4dfe31723dc522f44338f9bd98381c92b076","tags":["web"]},{"url":"https://github.com/EmilStenstrom/justhtml/releases/tag/v1.14.0","tags":["web"]},{"url":"https://github.com/advisories/GHSA-r758-8hxw-4845"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/5xxx/CVE-2026-5751.json","tags":["advisory"]},{"url":"https://github.com/EmilStenstrom/justhtml","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-5751","title":"justhtml before 1.14.0 Mutation XSS via custom sanitization policies","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 \u003cstyle\u003e). 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.","status":"published","published":"2026-08-23T13:34:10.547Z","modified":"2026-08-24T19:03:33.747Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"medium","assessor":"cna"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"cna"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T13:39:27.849196Z"}],"euvd":[{"id":"EUVD-2026-64654","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 \u003cstyle\u003e). 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.","status":"published","published":"2026-08-23T13:34:10Z","modified":"2026-08-24T19:03:33Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"medium"}],"updated_at":"2026-11-02T18:01:34.230875Z"}],"ghsa":[{"id":"GHSA-3227-3f97-9f2q","title":"justhtml versions 1.13.0 and earlier contain a parser-differential / mutation cross-site...","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 \u003cstyle\u003e). 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.","status":"published","published":"2026-08-23T15:33:04Z","modified":"2026-08-23T15:33:12Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"medium"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:10:52.226529Z"},{"id":"GHSA-r758-8hxw-4845","title":"justhtml: Mutation XSS with custom foreign-namespace sanitization policies","description":"## 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 `\u003cstyle\u003e`\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` `\u003c= 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 `\u003cstyle\u003e` 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`.","status":"published","published":"2026-04-08T00:06:17Z","modified":"2026-04-09T05:53:32Z","cvss":[{"version":"4.0","score":2.1,"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","level":"low"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:39:51.193071Z"}],"nvd":[{"id":"CVE-2026-5751","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 \u003cstyle\u003e). 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.","status":"published","published":"2026-08-23T14:16:53.807Z","modified":"2026-10-12T16:10:00.22Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"medium","assessor":"secondary"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"secondary"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:12:41.018848Z"}],"osv":[{"id":"CVE-2026-5751","title":"justhtml before 1.14.0 Mutation XSS via custom sanitization policies","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 \u003cstyle\u003e). 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.","status":"published","published":"2026-08-23T13:34:10.547Z","modified":"2026-10-28T02:30:21.39569731Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:45:12.016252Z"},{"id":"GHSA-r758-8hxw-4845","title":"justhtml: Mutation XSS with custom foreign-namespace sanitization policies","description":"## 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 `\u003cstyle\u003e`\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` `\u003c= 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 `\u003cstyle\u003e` 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`.","status":"published","published":"2026-04-08T00:06:17Z","modified":"2026-08-24T03:55:59.795016825Z","cvss":[{"version":"4.0","score":2.1,"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","level":"low"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:46:55.480549Z"}]}}
