{"id":"CVE-2026-5751","aliases":["CVE-2026-5751","GHSA-r758-8hxw-4845"],"related":[],"kind":"vulnerability","state":"published","title":"justhtml before 1.14.0 Mutation XSS via custom sanitization policies","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"## 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`.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Las versiones 1.13.0 y anteriores de justhtml contienen una vulnerabilidad de cross-site scripting (mXSS) diferencial de analizador / por mutación al usar una SanitizationPolicy personalizada que preserva espacios de nombres externos (por ejemplo, drop_foreign_namespaces=False con elementos SVG/MathML en lista blanca o contenedores de texto sin formato como <style>). Una entrada especialmente diseñada puede sanearse en un marcado que parece seguro pero que se vuelve inseguro cuando es reanalizado por un navegador o por otro analizador HTML, permitiendo la inyección de marcado. La configuración segura predeterminada (sanitize=True) no se ve afectada. Corregido en 1.14.0.","source":"nvd"}],"published":"2026-04-08T00:06:17.000Z","modified":"2026-10-12T16:10:00.220Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","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","score":5.1,"rating":"MEDIUM"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","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","score":5.1,"rating":"MEDIUM"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","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","rating":"LOW"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"1.14.0","status":"affected"},{"type":"semver","version":"1.14.0","status":"unaffected"}],"vendor":"EmilStenstrom","product":"justhtml","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"1.13.0","status":"affected","fixed":"1.14.0"}],"ecosystem":"PyPI","package":"justhtml","purl":"pkg:pypi/justhtml","source":"ghsa"}],"references":[{"url":"https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-r758-8hxw-4845","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/justhtml-before-mutation-xss-via-custom-sanitization-policies","tags":["third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/EmilStenstrom/justhtml/commit/8adc4dfe31723dc522f44338f9bd98381c92b076","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/EmilStenstrom/justhtml","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/EmilStenstrom/justhtml/releases/tag/v1.14.0","tags":["web"],"sources":["ghsa"]}],"credits":["EmilStenstrom"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-08-24T19:03:25.322Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-5751","url":"https://www.cve.org/CVERecord?id=CVE-2026-5751","licence":"CVE Terms of Use","modified":"2026-08-24T19:03:33.747Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-r758-8hxw-4845","url":"https://github.com/advisories/GHSA-r758-8hxw-4845","licence":"CC-BY-4.0","modified":"2026-08-24T03:55:59.795Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-5751","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-5751","licence":"Public domain","modified":"2026-10-12T16:10:00.220Z"}],"updatedAt":"2026-11-25T22:59:34.967Z","epss":{"score":0.00188,"percentile":0.0883,"date":"2026-12-01T12:00:22.000Z"}}