Listen to this Post
The vulnerability stems from the HTML cleaning library `lxml_html_clean` failing to remove the `Cleaner, when initialized with page_structure=True, correctly removes structural tags like <html>, <head>, and `<>` to sanitize page content. However, it lacks specific handling for the `<a href="page.html">, <img src="image.jpg">) within a document. By injecting a `
Platform: lxml_html_clean library
Version: Prior to 0.4.4
Vulnerability : Base tag injection
Severity: Medium (6.1)
Date: March 5, 2026
Prediction: Patch already available
What Undercode Say:
How Exploit:
An attacker can exploit this vulnerability by injecting a malicious `<base href="https://evil.com/">. When a victim views the page, all relative URLs (e.g., <a href="/dashboard">) will resolve to `https://evil.com/dashboard` instead of the legitimate domain. This could redirect users to a fake login page for credential harvesting.
Protection from this CVE
- Immediate Patching: Upgrade the `lxml-html-clean` package to version 0.4.4 or later. This can be done using pip:
pip install --upgrade lxml-html-clean
- Verify Installed Version: Check the current version of the library in your environment with:
pip show lxml-html-clean | grep Version
If the version displayed is 0.4.3 or lower, it is vulnerable.
- Manual Configuration (if patching is delayed): As a temporary workaround, you can manually configure the `Cleaner` to explicitly kill the `base` tag. However, this is not a substitute for upgrading.
from lxml_html_clean import Cleaner Explicitly remove the 'base' tag cleaner = Cleaner( page_structure=True, kill_tags={'base'} Add base to the kill list ) cleaned_html = cleaner.clean_html(untrusted_html)
Impact
URL Hijacking: An attacker can redirect all relative links on a page to a malicious domain, leading users to phishing sites or pages hosting malware .
Integrity Compromise: Relative paths for scripts, stylesheets, and form actions can be hijacked, allowing an attacker to inject malicious code or steal form data .
Confidentiality Impact: Sensitive information submitted via hijacked forms can be sent to an attacker’s server .
🎯Let’s Practice Exploiting & Learn Patching For Free:
Sources:
Reported By: nvd.nist.gov
Extra Source Hub:
Undercode

