justhtml: Mutation XSS with custom foreign-namespace sanitization policies
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.
Software afectado
Haz clic en una tecnología para ver todas sus vulnerabilidades.
| Plataforma | Paquete | Versiones vulnerables | Corregida en |
|---|---|---|---|
| Python (PyPI) | justhtml | >= 1.13.0, < 1.14.0 | 1.14.0 |
Referencias
- Vector CVSS
CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:A/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N- Debilidad (CWE)
CWE-79- Plataforma
- Python (PyPI)
- Paquete
justhtml- Publicada
- 08.04.2026
- Actualizado
- 11.10.2026 15:17
Fuentes y licencias
OSV / GitHub Advisory Database - GHSA-r758-8hxw-4845 - CC BY 4.0
Historial de vulnerabilidades: justhtml
Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.
- Entradas en total
- 10
- Primera → última
- 03.2026 06.2026
- Sin corrección
- 0
- Explotada en ataques
- 0
Distribución por gravedad
- Alta 2
- Media 5
- Baja 3
Divulgaciones por año
- 2026: 10
-
justhtml: Mutation XSS with custom foreign-namespace sanitization policies esta entrada
Identifica las vulnerabilidades de tu aplicación
Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.