PYSEC-2026-2614: lxml: javascript: URL bypass in Cleaner via xlink:href
lxml is a library for processing XML and HTML in the Python language. Prior to 6.1.1, link attributes in lxml.html.defs.linkattrs were missing xlink:href, which can be used for URL bypass attacks in embedded SVG/MathML/etc. content. This vulnerability was fixed in lxml 6.1.1 and lxmlhtmlclean 0.4.5.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
lxmlto a version that resolves this vulnerability.Fixed in 6.1.1 - Upgrade
Upgrade
lxml_html_cleanto a version that resolves this vulnerability.Fixed in 0.4.5
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Deployments using lxml or lxml_html_clean to clean HTML containing embedded SVG, MathML, or similar content may be exposed if untrusted content can retain an xlink:href attribute. The affected cleaner link-attribute list omitted xlink:href.
What does exploitation require?
An attacker needs to induce processing of crafted content containing an xlink:href URL, and successful exploitation requires user interaction. The issue can enable a javascript: URL bypass and is categorized as XSS.
Which versions contain fixes?
The issue is fixed in lxml 6.1.1 and lxml_html_clean 0.4.5. Versions prior to those releases are affected according to the advisory.