All vulnerabilities

PyPI

CVE-2026-141556

lxml_html_clean: Cleaner(safe_attrs_only=False) keeps javascript: in iframe srcdoc and SVG animation values

Severity
Medium 4.7
Published
3 Dec 2026
Last changed
3 Dec 2026
Added to UpHeron
3 Dec 2026
Fixed in
0.4.7
Weakness
Incomplete deny list (CWE-184)Cross-site scripting (CWE-79)
Attack
Over the network · Only under certain conditions · No login needed · Needs someone to click or open something
Attacker can
Read some data · Change some data
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N
Also known as
GHSA-5gvf-7wqf-r4cv
Sources
OSV.dev and GitHub

Description

When safe_attrs_only=False, the Cleaner still tries to remove JavaScript (javascript=True is the default): it deletes on* attributes (lxml_html_clean/clean.py:381-389 in 0.4.6) and blanks javascript: URLs through doc.rewrite_links(self._remove_javascript_link) (clean.py:390). rewrite_links only visits the attributes listed in lxml.html.defs.link_attrs, and two kinds of attributes that can carry script are not on that list:

  • srcdoc on . Its value is a complete HTML document that the browser renders inside the frame. With host_whitelist set, the itself is kept, and srcdoc takes priority over src, so the whitelisted src no longer matters.
  • to, values (and from, by) on the SVG animation elements and . With attributeName="href" they set the href of the enclosing SVG at runtime, so javascript: ends up on the link even though the Cleaner removed it from href itself. This one also needs remove_unknown_tags=False, otherwise / are dropped.
From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Affected software

SoftwareAffected versions
lxml-html-cleanPyPI · osv:PyPI:lxml-html-clean
  • Every version before 0.4.7

About lxml-html-clean

Weekly downloads (PyPI)
4,712,144PyPI Stats, 3 Dec 2026

Vulnerabilities in lxml-html-clean

In our list
2
Published in the last 12 months
2
Critical, last 12 months
0
High, last 12 months
0
Known exploited
0
Search the list for lxml-html-clean

References