CVE-2026-49825
Missing xlink:href in lxml HTML link attributes allows SVG/MathML URL bypass.
- CVSS 8.2
- CWE-79
- Input Validation and Sanitization
- Remote
lxml is a library for processing XML and HTML in the Python language. Prior to 6.1.1, link attributes in “lxml.html.defs.link_attrs“ 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 lxml_html_clean 0.4.5.
- CWE
- CWE-79
- CVSS base score
- 8.2
- Published
- 2026-08-20
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Information Disclosure
- Affected component
- lxml
- Fixed by upgrading
- Yes
Solution
Upgrade lxml to ≥ 6.1.1 (and lxml_html_clean to ≥ 0.4.5).
Vulnerable code sample
from lxml.html.clean import Cleaner
def sanitize_html(raw_html: str) -> str:
# VULNERABLE: missing xlink:href in allowed attributes permits SVG link bypass
cleaner = Cleaner(
safe_attrs=set(['href', 'src', 'style']), # default link_attrs lack xlink:href
safe_svg=True,
safe_math=True,
allow_tags=set(['a', 'img', 'svg', 'math'])
)
return cleaner.clean_html(raw_html)Patched code sample
from lxml.html.clean import Cleaner
def sanitize_html(raw_html: str) -> str:
# FIX: include xlink:href in safe_attrs to block SVG link bypass
cleaner = Cleaner(
safe_attrs=set(['href', 'src', 'style', 'xlink:href']),
safe_svg=True,
safe_math=True,
allow_tags=set(['a', 'img', 'svg', 'math'])
)
return cleaner.clean_html(raw_html)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
Cite this entry
@misc{vaitp:cve202649825,
title = {{Missing xlink:href in lxml HTML link attributes allows SVG/MathML URL bypass.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-49825},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-49825/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
