6.1medium
lxml_html_clean: <base> tag injection through default Cleaner configuration
- Severity
- 6.1medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.30% (higher than 24% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-xvp8-3mhv-424cPYSEC-2026-2202
Description
lxml_html_clean is a project for HTML cleaning functionalities copied from `lxml.html.clean`. Prior to version 0.4.4, the <base> tag passes through the default Cleaner configuration. While page_structure=True removes html, head, and title tags, there is no specific handling for <base>, allowing an attacker to inject it and hijack relative links on the page. This issue has been patched in version 0.4.4.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| fedora-python lxml_html_clean | < 0.4.4 | CVE List |
| lxml-html-clean (PyPI) | before 0.4.4 | GitHub Advisory Database, PyPA Advisory Database |
| fedoralovespython lxml_html_clean | before 0.4.4 | NVD |
All scores
| GitHub_M | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| GitHub | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| PyPA Advisory Database | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
lxml_html_clean is a project for HTML cleaning functionalities copied from `lxml.html.clean`. Prior to version 0.4.4, the <base> tag passes through the default Cleaner configuration. While page_structure=True removes html, head, and title tags, there is no specific handling for <base>, allowing an attacker to inject it and hijack relative links on the page. This issue has been patched in version 0.4.4.
GitHub Advisory Database
Summary
The <base> tag passes through the default Cleaner configuration. While page_structure=True removes html, head, and title tags, there is no specific handling for <base>, allowing an attacker to inject it and hijack relative links on the page.
Details
The <base> tag is not currently in the page_structure kill set. Even though the specification says <base> must be inside <head>, browsers accept <base> tags outside of the head.
If an attacker injects a <base> tag, it changes the base URL for all relative URLs on the page (links, images, scripts) to a domain controlled by the attacker.
PoC
from lxml_html_clean import clean_html
# The base tag is preserved in the output
result = clean_html('<base href="http://evil.com/"><a href="/account">Account</a>')
print(result)
# Output: <div><base href="http://evil.com/">...<a href="/account">Account</a></div>
Impact
The injection of a <base> tag allows an attacker to hijack the resolution of all relative URLs on the page. This results in three critical attack vectors:
- Phishing & Redirection: Attackers can redirect user navigation (e.g.,
<a href="/login">) and form submissions (e.g.,<form action="/auth">) to an attacker-controlled domain, effectively stealing credentials or sensitive data without the user realizing they have left the legitimate site. - Cross-Site Scripting (XSS): If the victim application loads JavaScript files using relative paths (e.g.,
<script src="assets/app.js">), the browser will attempt to fetch the script from the attacker's domain. This upgrades the vulnerability from HTML injection to full Stored XSS. - Defacement: Relative references to images (
<img>) and stylesheets (<link>) will be loaded from the attacker's server, allowing for UI redressing or defacement.
NVD (es)
lxml_html_clean es un proyecto para funcionalidades de limpieza de HTML copiadas de 'lxml.html.clean'. Antes de la versión 0.4.4, la etiqueta pasa a través de la configuración predeterminada de Cleaner. Aunque page_structure=True elimina las etiquetas html, head y title, no hay un manejo específico para , permitiendo a un atacante inyectarla y secuestrar enlaces relativos en la página. Este problema ha sido parcheado en la versión 0.4.4.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-28350 changed 2026-03-06 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-xvp8-3mhv-424c changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-28350 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2026-2202 changed 2026-07-13 | CC-BY-4.0 |