{"id":"CVE-2026-7808","aliases":["CVE-2026-7808","GHSA-4p64-v8f5-r2gx"],"related":[],"kind":"vulnerability","state":"published","title":"justhtml before 1.16.0 Multiple Security Issues via Sanitization","summary":"justhtml before 1.16.0 contains multiple HTML sanitization bypass issues that can allow active/dangerous content (e.g., script or style) to survive sanitization, potentially leading to cross-site scripting. The issues primarily affect advanced usage rather than the default JustHTML(..., sanitize=True) path for ordinary parsed HTML: mutating or reusing sanitization policy objects (including exported defaults) could weaken later sanitization; programmatic DOM input to sanitize()/sanitize_dom() could miss mixed-case tag names (e.g., ScRiPt, StYlE); crafted programmatic doctype names could serialize into active markup; and custom policies preserving SVG or MathML could allow animation elements, presentation attributes with external url(...) references, or DOM trees mislabeled as namespace=\"html\" to bypass foreign-content checks. Fixed in 1.16.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"justhtml before 1.16.0 contains multiple HTML sanitization bypass issues that can allow active/dangerous content (e.g., script or style) to survive sanitization, potentially leading to cross-site scripting. The issues primarily affect advanced usage rather than the default JustHTML(..., sanitize=True) path for ordinary parsed HTML: mutating or reusing sanitization policy objects (including exported defaults) could weaken later sanitization; programmatic DOM input to sanitize()/sanitize_dom() could miss mixed-case tag names (e.g., ScRiPt, StYlE); crafted programmatic doctype names could serialize into active markup; and custom policies preserving SVG or MathML could allow animation elements, presentation attributes with external url(...) references, or DOM trees mislabeled as namespace=\"html\" to bypass foreign-content checks. Fixed in 1.16.0.","source":"cvelist"},{"lang":"en","text":"## Summary\n\n`justhtml` `1.16.0` fixes multiple security issues in sanitization, serialization, and programmatic DOM handling.\n\nMost of these issues affected one of these advanced paths rather than ordinary parsed HTML with the default safe settings:\n\n- programmatic DOM input to `sanitize()` or `sanitize_dom()`\n- reused or mutated sanitization policy objects\n- custom policies that preserve foreign namespaces such as SVG or MathML\n\n## Affected versions\n\n- `justhtml` `<= 1.15.0`\n\n## Fixed version\n\n- `justhtml` `1.16.0` released on April 12, 2026\n\n## Impact\n\n### Policy reuse and mutation\nNested mutation of sanitization policy internals could weaken later sanitization by leaving stale compiled sanitizers active, or by mutating exported default policy internals process-wide.\n\n### In-memory sanitization gaps\nProgrammatic DOM sanitization could miss dangerous mixed-case tag names such as `ScRiPt` or `StYlE`, and custom `drop_content_tags` values such as `{\"SCRIPT\"}` could silently fail to drop dangerous subtrees.\n\n### Serialization injection\nCrafted programmatic doctype names could serialize into active markup before the document body.\n\n### Foreign-namespace policy bypasses\nCustom policies that preserve SVG or MathML could allow active SVG features to survive sanitization, including:\n\n- animation elements such as `<set>` and `<animate>` that mutate already-sanitized attributes after sanitization\n- presentation attributes such as `fill`, `clip-path`, `mask`, `marker-start`, and `cursor` containing external `url(...)` references\n- programmatic DOM trees that claim `namespace=\"html\"` but serialize as `<svg>` or `<math>`, bypassing foreign-content checks\n\n### Rawtext hardening gap\nMixed-case programmatic `style` or `script` nodes could bypass rawtext hardening and preserve active stylesheet content such as remote `@import` rules.\n\n## Default configuration\n\nMost of these issues did **not** affect the normal `JustHTML(..., sanitize=True)` path for ordinary parsed HTML.\n\nThe main exceptions were policy-mutation issues, which could weaken later sanitization if code mutated nested state on reused policy objects or exported defaults.\n\n## Recommended action\n\nUpgrade to `justhtml` `1.16.0`.\n\nIf you cannot upgrade immediately:\n\n- do not mutate `DEFAULT_POLICY`, `DEFAULT_DOCUMENT_POLICY`, or nested policy internals\n- avoid reusing policy objects after mutating nested state\n- avoid preserving SVG or MathML for untrusted input\n- avoid preserving `style` or `script` in custom policies for untrusted input\n- avoid serializing untrusted programmatic doctypes or DOM trees\n\n## Credit\n\nDiscovered during an internal security review of `justhtml`.","format":"markdown","source":"ghsa"},{"lang":"es","text":"justhtml antes de la versión 1.16.0 contiene múltiples problemas de omisión de la sanitización de HTML que pueden permitir que contenido activo/peligroso (p. ej., script o style) sobreviva a la sanitización, lo que podría conducir a cross-site scripting. Los problemas afectan principalmente al uso avanzado en lugar de la ruta predeterminada JustHTML(..., sanitize=True) para HTML analizado ordinario: mutar o reutilizar objetos de política de sanitización (incluidos los valores predeterminados exportados) podría debilitar la sanitización posterior; la entrada DOM programática a sanitize()/sanitize_dom() podría pasar por alto nombres de etiquetas con mayúsculas y minúsculas (p. ej., ScRiPt, StYlE); nombres de doctype programáticos manipulados podrían serializarse en marcado activo; y las políticas personalizadas que preservan SVG o MathML podrían permitir elementos de animación, atributos de presentación con referencias url(...) externas, o árboles DOM mal etiquetados como namespace=“html” para omitir las comprobaciones de contenido externo. Corregido en la versión 1.16.0.","source":"nvd"}],"published":"2026-04-14T20:05:10.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:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":9.3,"rating":"CRITICAL"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":9.3,"rating":"CRITICAL"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:U","rating":"LOW"}],"cwes":["CWE-20","CWE-79","CWE-178","CWE-436","CWE-471"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"1.16.0","status":"affected"},{"type":"semver","version":"1.16.0","status":"unaffected"}],"vendor":"EmilStenstrom","product":"justhtml","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.16.0"}],"ecosystem":"PyPI","package":"justhtml","purl":"pkg:pypi/justhtml","source":"ghsa"}],"references":[{"url":"https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-4p64-v8f5-r2gx","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/justhtml-before-multiple-security-issues-via-sanitization","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":"yes","technicalImpact":"total","date":"2026-08-24T18:14:13.443Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-7808","url":"https://www.cve.org/CVERecord?id=CVE-2026-7808","licence":"CVE Terms of Use","modified":"2026-08-24T18:14:27.467Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-4p64-v8f5-r2gx","url":"https://github.com/advisories/GHSA-4p64-v8f5-r2gx","licence":"CC-BY-4.0","modified":"2026-08-24T03:55:59.858Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-7808","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-7808","licence":"Public domain","modified":"2026-10-12T16:10:00.220Z"}],"updatedAt":"2026-11-25T22:59:34.969Z","epss":{"score":0.00352,"percentile":0.30871,"date":"2026-12-01T12:00:22.000Z"}}