justhtml: Mutation XSS with custom foreign-namespace sanitization policies
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- Cross-site scripting
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from GitHub. Impact type from CWE-79.
Summary
## Summary A parser-differential / mutation XSS issue was found in `justhtml` when using a **custom sanitization policy** that preserves foreign namespaces such as SVG or MathML. Under 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. ## Impact This issue does **not** affect the default safe configuration. You may be affected if you use a custom `SanitizationPolicy` with settings like: - `drop_foreign_namespaces=False` - allowlisted foreign elements such as MathML or SVG - allowlisted raw-text containers such as `<style>` In that case, an attacker could inject markup that survives sanitization and turns into active HTML after re-parsing. ## Affected versions - `justhtml` `<= 1.13.0` ## Fixed version - Fixed in `1.14.0` ## Workarounds Until you upgrade: - keep `drop_foreign_namespaces=True` - avoid allowlisting foreign namespaces for untrusted input - avoid allowlisting raw-text containers such as `<style>` in custom policies ## Notes The default `JustHTML(..., sanitize=True)` behavior was not found to be vulnerable in this issue. ## Credit Discovered by JustHTML author during a LLM-based security review of `justhtml`.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | justhtml (PyPI) | 1.13.0 to before 1.14.0 | 1.14.0 | Patch available | GHSA-r758-8hxw-4845 |
- justhtml (PyPI) Vendor— Affected 1.13.0 to before 1.14.0 Fixed in 1.14.0 Patch available GHSA-r758-8hxw-4845
Remediation
- Fix · GHSA-r758-8hxw-4845 justhtml (PyPI) Fixed in 1.14.0 Advisory →
Timeline
- 2026-10-03 Threatist record created from GHSA-r758-8hxw-4845
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences