GHSA-qvc2-mg72-jjhx: Justhtml Cross-Site Scripting Vulnerability
MODERATEGHSA-qvc2-mg72-jjhx is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Justhtml libraries in the PyPI ecosystem. The issue involves justhtml affected by mutation xss via literal text serialization in raw text elements (style/script). Remediation is available by upgrading affected packages to version 1.12.0.
GHSA-qvc2-mg72-jjhx at a Glance
How to Fix GHSA-qvc2-mg72-jjhx
To remediate this vulnerability, upgrade all affected Justhtml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install justhtml>=1.12.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show justhtml
How to Check if You Are Affected
To determine whether your Python environment is affected by GHSA-qvc2-mg72-jjhx, inspect your installed packages using pip:
pip show justhtml
Analyze the terminal output to locate any version of Justhtml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.12.0), your application is affected.
Note: The pip show justhtml command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Justhtml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-qvc2-mg72-jjhx Affected Justhtml Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
justhtml
|
PyPI |
< 1.12.0
|
1.12.0
|
References
Frequently Asked Questions
What is GHSA-qvc2-mg72-jjhx?
Which Justhtml versions are affected?
What version fixes GHSA-qvc2-mg72-jjhx?
Is justhtml affected?
What CWE is associated with GHSA-qvc2-mg72-jjhx?
How can I check PyPI dependencies for GHSA-qvc2-mg72-jjhx?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qvc2-mg72-jjhx",
"modified" : "2026-03-18T20:19:47Z",
"published" : "2026-03-18T20:19:47Z",
"aliases" : [ ],
"summary" : "JustHTML Affected by Mutation XSS via Literal Text Serialization in Raw Text Elements (style/script)",
"details" : "## 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)",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "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"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "justhtml"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.12.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.11.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/EmilStenstrom/justhtml/security/advisories/GHSA-qvc2-mg72-jjhx"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/EmilStenstrom/justhtml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-18T20:19:47Z",
"nvd_published_at" : null
}
}