GitHub Advisoryadvisory · PyPI

GHSA-xvp8-3mhv-424c lxml-html-clean has <base> tag injection through default Cleaner configuration

MEDIUM Published 2026-03-02 Modified 2026-03-05 Official page ↗
Aliases
CVE-2026-28350
Ecosystem
PyPI
Packages
lxml-html-clean
Severity
Moderate
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weaknesses
CWE-116
Reviewed
2026-03-02

Affected packages

• PyPI lxml-html-clean: < 0.4.4 → fixed in 0.4.4

Description

Summary The `` tag passes through the default `Cleaner` configuration. While `page_structure=True` removes `html`, `head`, and `title` tags, there is no specific handling for ``, allowing an attacker to inject it and hijack relative links on the page. Details The `` tag is not currently in the `page_structure` kill set. Even though the specification says `` must be inside ``, browsers accept `` tags outside of the head. If an attacker injects a `` tag, it changes the base URL for all relative URLs on the page (links, images, scripts) to a domain controlled by the attacker. PoC ```python from lxml_html_clean import clean_html The base tag is preserved in the output result = clean_html('Account') print(result) Output: ...Account ``` Impact The injection of a `` 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., ``) and form submissions (e.g., ``) 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., ``), 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 (``) and stylesheets (``) will be loaded from the attacker's server, allowing for UI redressing or defacement.

Related

Alias · CVE (1)

  • CVE-2026-28350 lxml_html_clean is a project for HTML cleaning functionalities copied from `lxml.html.clean`. vulnerability

Weakness · CWE (1)

  • CWE-116 Improper Encoding or Escaping of Output weakness

References