# CVE-2026-8630: justhtml mutation XSS in raw-text element serialization

Source: https://junglewise.ai/threats/cve-2026-8630-justhtml-mutation-xss-in-raw-text-element-serialization  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-23. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2026-8630 · Severity: medium · CVSS 6.1 · Published 2026-08-23

justhtml is a library used to sanitize and process HTML content programmatically. The library contains a vulnerability in how it serializes HTML when custom sanitization policies allow raw-text elements like style and script tags. An attacker can craft malicious text content within these elements that breaks out of the raw-text context and injects arbitrary HTML, potentially leading to script execution in applications that use non-default sanitization policies.

Technologies: [justhtml (PyPI)](https://junglewise.ai/threats/technologies/justhtml). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-8630 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-8630 being exploited in the wild.

**How severe is CVE-2026-8630?** Medium severity, with a CVSS score of 6.1, published 23 August 2026.

**Which products and versions are affected?** justhtml (PyPI) ECOSYSTEM:introduced=0,fixed=1.12.0.

**Is there a fix for CVE-2026-8630?** Yes. justhtml (PyPI): upgrade to 1.12.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-8630 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-8630?** Check whether you run justhtml (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- justhtml (PyPI): upgrade to 1.12.0 or later

  ```sh
  pip install "justhtml>=1.12.0"
  ```


## Technical details

This is a mutation XSS (mXSS) vulnerability in the serialize.py module's handling of raw-text elements. The root cause is that text nodes within style and script elements are serialized verbatim without HTML escaping via the _serialize_text_for_parent() function. When a DOM tree is processed through sanitize_dom() with a custom policy that preserves these elements, an attacker can inject text containing a matching closing tag sequence (e.g., "&lt;/style&gt;" within a style element) to break out of the raw-text context and inject arbitrary HTML. The attack requires either programmatic DOM construction with attacker input or a custom sanitization policy that retains script/style elements; the default policy is not affected. Patched in version 1.12.0.

## Affected products

- justhtml justhtml <= 1.11.0

## Identifiers

- CVE-2026-8630
- GHSA-qvc2-mg72-jjhx

## Timeline

- 2026-03-18: disclosed
- 2026-03-18: patched: Version 1.12.0 released

## References

- [https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-qvc2-mg72-jjhx](https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-qvc2-mg72-jjhx)
- [https://www.vulncheck.com/advisories/justhtml-before-mutation-xss-via-raw-text-elements](https://www.vulncheck.com/advisories/justhtml-before-mutation-xss-via-raw-text-elements)

## Related threats

- [justhtml uncontrolled recursion DoS via deeply nested HTML](https://junglewise.ai/threats/justhtml-uncontrolled-recursion-dos-via-deeply-nested-html-26591bb6)
- [JustHTML uncontrolled recursion DoS via deeply nested HTML](https://junglewise.ai/threats/cve-2026-9769-justhtml-uncontrolled-recursion-dos-via-deeply-nested-html)
- [justhtml HTML escaping bypass in Markdown conversion](https://junglewise.ai/threats/cve-2026-8445-justhtml-html-escaping-bypass-in-markdown-conversion)
- [justhtml HTML sanitization bypass leading to XSS](https://junglewise.ai/threats/cve-2026-7808-justhtml-html-sanitization-bypass-leading-to-xss)
- [justhtml to_markdown() cross-site scripting in code span](https://junglewise.ai/threats/cve-2026-77088-justhtml-to-markdown-cross-site-scripting-in-code-span)
