CVE-2026-28350: Lxml html clean Lxml-html-clean Has <base> Tag Injection Vulnerability
MODERATECVE-2026-28350 is a MODERATE (CVSS 6.1) lxml-html-clean has <base> tag injection vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting Lxml html clean libraries in the PyPI ecosystem. The issue involves lxml-html-clean has <base> tag injection through default cleaner configuration. Remediation is available by upgrading affected packages to version 0.4.4.
CVE-2026-28350 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2026-28350
To remediate this vulnerability, upgrade all affected Lxml html clean dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install lxml-html-clean>=0.4.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show lxml-html-clean
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-28350, inspect your installed packages using pip:
pip show lxml-html-clean
Analyze the terminal output to locate any version of Lxml html clean in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.4.4), your application is affected.
Note: The pip show lxml-html-clean command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. In Lxml html clean, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-28350 Affected Lxml html clean Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
lxml-html-clean
|
PyPI |
< 0.4.4
|
0.4.4
|
References
Frequently Asked Questions
What is CVE-2026-28350?
Which Lxml html clean versions are affected?
What version fixes CVE-2026-28350?
Is lxml-html-clean affected?
What is the CVSS score of CVE-2026-28350?
What CWE is associated with CVE-2026-28350?
How can I check PyPI dependencies for CVE-2026-28350?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xvp8-3mhv-424c",
"modified" : "2026-03-05T22:49:24Z",
"published" : "2026-03-02T19:35:52Z",
"aliases" : [ "CVE-2026-28350" ],
"summary" : "lxml-html-clean has <base> tag injection through default Cleaner configuration",
"details" : "### Summary\nThe `<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.\n\n### Details\nThe `<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.\n\nIf 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.\n\n### PoC\n```python\nfrom lxml_html_clean import clean_html\n\n# The base tag is preserved in the output\nresult = clean_html('<base href=\"http://evil.com/\"><a href=\"/account\">Account</a>')\nprint(result)\n# Output: <div><base href=\"http://evil.com/\">...<a href=\"/account\">Account</a></div>\n```\n\n### Impact\nThe 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:\n\n1. **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.\n2. **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.\n3. **Defacement:** Relative references to images (`<img>`) and stylesheets (`<link>`) will be loaded from the attacker's server, allowing for UI redressing or defacement.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "lxml-html-clean"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.4.4"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.4.3"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/fedora-python/lxml_html_clean/security/advisories/GHSA-xvp8-3mhv-424c"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-28350"
}, {
"type" : "WEB",
"url" : "https://github.com/fedora-python/lxml_html_clean/commit/9c5612ca33b941eec4178abf8a5294b103403f34"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/fedora-python/lxml_html_clean"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-116" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-02T19:35:52Z",
"nvd_published_at" : "2026-03-05T20:16:16Z"
}
}