CVE-2026-28350
JSON

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 packageVersionsReported by
fedora-python lxml_html_clean< 0.4.4CVE List
lxml-html-clean (PyPI)before 0.4.4GitHub Advisory Database, PyPA Advisory Database
fedoralovespython lxml_html_cleanbefore 0.4.4NVD

All scores

GitHub_M6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
GitHub6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
PyPA Advisory Database6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-116

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:

  1. 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.
  2. 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.
  3. 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

SourceRecordLicence
CVE ListCVE-2026-28350 changed 2026-03-06CVE Terms of Use
GitHub Advisory DatabaseGHSA-xvp8-3mhv-424c changed 2026-09-10CC-BY-4.0
NVDCVE-2026-28350 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2026-2202 changed 2026-07-13CC-BY-4.0