CVE-2026-141555: lxml-html-clean: Cleaner(comments=False) keeps a comment that closes <noscript> in the browser, which allows XSS

Published Dec 2, 2026
·
Updated

lxml-html-clean is an HTML cleaning library for Python. Prior to 0.4.7, Cleaner in lxmlhtmlclean/clean.py configured with comments=False uses killconditionalcomments to remove conditional comments but retains other comments inside noscript. libxml2 parses the noscript content as markup and retains the comment as a node, while a browser with scripting enabled treats the content as raw text. A closing noscript tag inside a retained comment can terminate the element in the browser, causing following attacker-controlled markup to execute when cleaned HTML is rendered, without a click. The default Cleaner removes all comments, and the same comment outside noscript remains inert. An earlier check for a noscript closing tag applies to style text rather than retained comments. This issue is fixed in 0.4.7.

Affected Software

1 affected component
pypi/lxml-html-clean<0.4.7

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade lxml-html-clean to a version that resolves this vulnerability.

    Fixed in 0.4.7

Event History

Dec 2, 2026
CVE Published
via MITRE·08:09 PM
Data Sourced
via MITRE·08:09 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:18 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are exposed to this issue?

Deployments using lxml-html-clean before 0.4.7 are exposed only when they configure Cleaner with comments=False and render the cleaned output in a browser with scripting enabled. The default Cleaner configuration removes all comments and is not affected by this specific issue.

2

What must an attacker supply for exploitation?

An attacker must be able to place crafted HTML into content processed by the cleaner. The payload relies on a retained comment inside a noscript element containing a closing noscript tag, followed by attacker-controlled markup that the browser interprets after the element is terminated.

3

Does exploitation require user interaction?

No. The affected cleaned HTML can execute attacker-controlled markup when rendered in a browser, without a click.

4

What can be done before upgrading?

Avoid using Cleaner with comments=False for untrusted HTML. Configure the cleaner to remove all comments, particularly when sanitized output may be rendered in browsers.

5

How can I determine whether my application is affected?

Check whether it uses lxml-html-clean earlier than 0.4.7 and creates a Cleaner with comments=False. Also verify whether untrusted cleaned HTML can contain noscript elements and is later rendered in a scripting-enabled browser.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203