{"id":"CVE-2026-8630","aliases":["CVE-2026-8630","GHSA-qvc2-mg72-jjhx"],"related":[],"kind":"vulnerability","state":"published","title":"justhtml before 1.12.0 Mutation XSS via Raw Text Elements","summary":"justhtml before 1.12.0 (versions <= 1.11.0) contains a mutation cross-site scripting (mXSS) vulnerability in the serialization of raw-text elements such as <style> and <script>. When a DOM tree is processed by sanitize_dom() using a custom policy that keeps these elements, text nodes inside them are serialized literally without escaping, allowing attacker-controlled text containing the matching closing tag sequence to break out of the raw-text context and inject arbitrary HTML into the serialized output. The default sanitization policy is not affected because it drops the contents of style and script.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"justhtml before 1.12.0 (versions <= 1.11.0) contains a mutation cross-site scripting (mXSS) vulnerability in the serialization of raw-text elements such as <style> and <script>. When a DOM tree is processed by sanitize_dom() using a custom policy that keeps these elements, text nodes inside them are serialized literally without escaping, allowing attacker-controlled text containing the matching closing tag sequence to break out of the raw-text context and inject arbitrary HTML into the serialized output. The default sanitization policy is not affected because it drops the contents of style and script.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nSanitized DOM trees can be unsafe to serialize when a custom policy allows raw-text elements such as `<style>` or `<script>`.\n\nThe issue affects DOM trees that are constructed or modified programmatically and then passed through `sanitize_dom()` with a policy that keeps these elements. Text nodes inside `<style>` and `<script>` are serialized literally, so attacker-controlled text containing the matching closing tag sequence can break out of the raw-text context and inject HTML into the serialized output.\n\nThe default sanitization policy is not affected because it drops the contents of `style` and `script`.\n\n## Details\n\nThe root cause is in HTML serialization of raw-text elements. In serialize.py, text children of `script` and `style` are emitted verbatim:\n\n```python\n_LITERAL_TEXT_SERIALIZATION_ELEMENTS = frozenset({\"script\", \"style\"})\n\ndef _serialize_text_for_parent(text: str | None, parent_name: str | None) -> str:\n    if not text:\n        return \"\"\n    if parent_name in _LITERAL_TEXT_SERIALIZATION_ELEMENTS:\n        return text\n    return _escape_text(text)","format":"markdown","source":"ghsa"},{"lang":"es","text":"justhtml anterior a la versión 1.12.0 (versiones anteriores o iguales a la 1.11.0) contiene una vulnerabilidad de Cross-site Scripting por mutación (mXSS) en la serialización de elementos de texto sin formato como [style] y [script_tag]. Cuando un árbol DOM es procesado por sanitize_dom() utilizando una política personalizada que mantiene estos elementos, los nodos de texto dentro de ellos se serializan literalmente sin escape, permitiendo que el texto controlado por el atacante que contiene la secuencia de etiqueta de cierre coincidente escape del contexto de texto sin formato e inyecte HTML arbitrario en la salida serializada. La política de saneamiento predeterminada no se ve afectada porque descarta el contenido de style y script.","source":"nvd"}],"published":"2026-03-18T20:19:47.000Z","modified":"2026-10-26T11:10:00.157Z","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:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"1.12.0","status":"affected"},{"type":"semver","version":"1.12.0","status":"unaffected"}],"vendor":"EmilStenstrom","product":"justhtml","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.12.0"}],"ecosystem":"PyPI","package":"justhtml","purl":"pkg:pypi/justhtml","source":"ghsa"}],"references":[{"url":"https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-qvc2-mg72-jjhx","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/justhtml-before-mutation-xss-via-raw-text-elements","tags":["third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/EmilStenstrom/justhtml","tags":["package"],"sources":["ghsa"]}],"credits":["offset"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-08-26T18:06:49.331Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-8630","url":"https://www.cve.org/CVERecord?id=CVE-2026-8630","licence":"CVE Terms of Use","modified":"2026-08-26T18:07:00.039Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-qvc2-mg72-jjhx","url":"https://github.com/advisories/GHSA-qvc2-mg72-jjhx","licence":"CC-BY-4.0","modified":"2026-08-24T03:56:00.403Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-8630","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-8630","licence":"Public domain","modified":"2026-10-26T11:10:00.157Z"}],"updatedAt":"2026-11-25T22:59:34.970Z","epss":{"score":0.00188,"percentile":0.08813,"date":"2026-12-02T12:00:21.000Z"}}