{"id":"CVE-2026-6827","aliases":["CVE-2026-6827","GHSA-vrx2-77f2-ww34"],"related":[],"kind":"vulnerability","state":"published","title":"justhtml before 1.17.0 Multiple Cross-Site Scripting Vulnerabilities","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"## Summary\n\n`justhtml` `1.17.0` fixes multiple security issues in sanitization, serialization, and programmatic DOM handling.\n\nMost of these issues affected advanced or custom configurations rather than the default safe path.\n\n## Affected versions\n\n- `justhtml` `<= 1.16.0`\n\n## Fixed version\n\n- `justhtml` `1.17.0` released on April 19, 2026\n\n## Impact\n\n### Custom SVG / MathML sanitization policies\nCustom policies that preserved foreign namespaces could allow dangerous content to survive sanitization, including:\n\n- active HTML integration points such as SVG `<foreignObject>`, MathML `<annotation-xml encoding=\"text/html\">`, SVG `<title>` / `<desc>`, and MathML text integration points\n- mutation-XSS parser-differential payloads that looked inert in memory but became active HTML after reparse\n- SVG `filter=\"url(...)\"` attributes that could trigger external fetches\n\nThese issues affected:\n- `JustHTML(..., sanitize=True)` with custom foreign-namespace policies\n- `sanitize()` / `sanitize_dom()`\n- low-level terminal `Sanitize(...)` transform execution\n\n### Preserved `<style>` handling\nConstructor-time sanitization and explicit `Sanitize(...)` transforms did not fully match `sanitize()` / `sanitize_dom()` when custom policies preserved `<style>`.\n\nThat could leave resource-loading CSS such as `@import` or `background-image:url(...)` in sanitized output from HTML string input.\n\n### Programmatic DOM serialization\nProgrammatic `script`, `style`, and `Comment(...)` nodes could still serialize into active markup in some edge cases.\n\nThis could affect applications that build or mutate DOM trees directly before calling `to_html()` or `to_markdown(html_passthrough=True)`.\n\n### Cache mutation and DOM cycle handling\nTwo lower-severity hardening fixes were included:\n\n- compiled sanitize-pipeline caches could be mutated after warming and weaken later sanitization\n- parent/child cycles in programmatic DOM trees could cause infinite loops in operations such as `to_html()` and `sanitize_dom()`\n\n## Default configuration\n\nMost of the issues above did **not** affect ordinary parsed HTML with the default `JustHTML(..., sanitize=True)` configuration.\n\nThe main risk areas were:\n\n- custom policies that preserve SVG or MathML\n- custom policies that preserve `<style>`\n- programmatic DOM construction or mutation\n- low-level direct sanitizer/transform APIs\n\n## Recommended action\n\nUpgrade to `justhtml` `1.17.0`.\n\nIf users cannot upgrade immediately:\n\n- avoid preserving SVG or MathML for untrusted input\n- avoid preserving `<style>` for untrusted input\n- avoid mutating programmatic DOM trees with untrusted `script`, `style`, or comment content\n- avoid mutating warmed policy internals or sanitizer caches\n\n## Credit\n\nDiscovered during an internal security review of `justhtml`.","format":"markdown","source":"ghsa"},{"lang":"es","text":"justhtml anterior a la versión 1.17.0 contiene múltiples problemas de seguridad en la sanitización, serialización y manejo programático del DOM. Cuando las políticas personalizadas preservan espacios de nombres externos (SVG/MathML), contenido peligroso como puntos de integración HTML (SVG <foreignObject>, MathML <annotation-xml encoding=“text/html”>) y cargas útiles de XSS por mutación con diferencias de analizador podrían sobrevivir a la sanitización y convertirse en HTML activo después de un nuevo análisis; SVG filter=“url(...)” y <style> preservado podrían dejar CSS de carga de recursos (@import, background-image:url()). Los nodos programáticos de script/style/Comment podrían serializarse en marcado activo. Correcciones de endurecimiento adicionales abordan la mutación de la caché de la tubería de sanitización y los ciclos padre/hijo del DOM que podrían causar bucles infinitos. La mayoría de los problemas afectan a configuraciones avanzadas o personalizadas en lugar de la ruta segura predeterminada de JustHTML(..., sanitize=True).","source":"nvd"}],"published":"2026-04-22T21:25:46.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:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:L/SA:N","rating":"MEDIUM"}],"cwes":["CWE-79","CWE-436","CWE-471","CWE-835"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"1.17.0","status":"affected"},{"type":"semver","version":"1.17.0","status":"unaffected"}],"vendor":"EmilStenstrom","product":"justhtml","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.17.0"}],"ecosystem":"PyPI","package":"justhtml","purl":"pkg:pypi/justhtml","source":"ghsa"}],"references":[{"url":"https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-vrx2-77f2-ww34","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/justhtml-before-multiple-cross-site-scripting-vulnerabilities","tags":["third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/EmilStenstrom/justhtml","tags":["package"],"sources":["ghsa"]}],"credits":["EmilStenstrom"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-08-26T18:05:56.854Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-6827","url":"https://www.cve.org/CVERecord?id=CVE-2026-6827","licence":"CVE Terms of Use","modified":"2026-08-29T11:47:34.707Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-vrx2-77f2-ww34","url":"https://github.com/advisories/GHSA-vrx2-77f2-ww34","licence":"CC-BY-4.0","modified":"2026-08-24T03:56:00.073Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-6827","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-6827","licence":"Public domain","modified":"2026-10-12T16:10:00.220Z"}],"updatedAt":"2026-11-25T22:59:34.968Z","epss":{"score":0.00187,"percentile":0.08695,"date":"2026-12-01T12:00:22.000Z"}}