CVE-2026-28350: lxml-html-clean Package Vulnerability - <base> Tag Injection Risk
Summary
CVE-2026-28350: lxml-html-clean has tag injection through default Cleaner configuration. Affects lxml-html-clean versions < 0.4.4. Fixed in 0.4.4. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
lxml-html-clean is a Python package designed for cleaning and sanitizing HTML content. It provides a Cleaner class that allows developers to specify which HTML tags and attributes should be removed or preserved. However, a significant vulnerability exists in the default configuration of the Cleaner, which fails to handle the <base> tag appropriately, potentially allowing attackers to manipulate relative URLs on a webpage.
Vulnerability Detail
The vulnerability arises from the default Cleaner configuration in lxml-html-clean, which does not include the <base> tag in its page_structure kill set. This oversight allows an attacker to inject a <base> tag into the HTML output, thereby altering the base URL for all relative links on the page. As a result, attackers can redirect user navigation, execute phishing attacks, and exploit Cross-Site Scripting (XSS) vulnerabilities by loading malicious scripts from their own domain. The impact of this vulnerability is significant, as it can lead to credential theft, data exposure, and UI defacement.
How To Fix
Latest published version: 0.4.5 as of 22 Oct 2026
pip install --upgrade "lxml-html-clean==0.4.5"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
0.4.4
This is the first release that contains the fix.
pip install --upgrade "lxml-html-clean==0.4.4"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, developers can manually sanitize input to ensure that <base> tags are not included in the HTML content before passing it to the Cleaner. Here is an example of how to do this:
import re
from lxml_html_clean import clean_html
# Function to remove <base> tags
def remove_base_tags(html_content):
return re.sub(r'<base[^>]*>', '', html_content)
# Clean HTML after removing <base> tags
html_content = '<base href="http://evil.com/"><a href="/account">Account</a>'
cleaned_html = clean_html(remove_base_tags(html_content))
print(cleaned_html)
Conclusion
The lxml-html-clean package has a vulnerability that allows for <base> tag injection, posing risks such as phishing, XSS, and UI manipulation. It is crucial to update to the patched version or implement workarounds to mitigate these risks.
See every vulnerability recorded for lxml-html-clean →
FAQ
The CVSS score of this vulnerability is 6.1, indicating a moderate severity level.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.
The potential attack vectors include phishing and redirection, Cross-Site Scripting (XSS), and UI defacement.
Yes, the vulnerability has been patched in version 0.4.4 of the lxml-html-clean package.
If immediate updates are not possible, implement a workaround by sanitizing the HTML input to remove any <base> tags before processing.
References
Related vulnerabilities
Recent vulnerabilities recorded for lxml-html-clean.