CVE-2026-28350: Lxml html clean Lxml-html-clean Has <base> Tag Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-xvp8-3mhv-424c
CVSS 6.1
CWE-116
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2026-28350
GHSA Identifier GHSA-xvp8-3mhv-424c
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-116: Improper Encoding or Escaping of Output
Affected Product Lxml html clean
Package Ecosystem PyPI
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (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.

lxml-html-clean fixed: 0.4.4
pip install lxml-html-clean>=0.4.4
Verify Direct and Transitive Dependencies

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

### 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 ```python 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.

CVE-2026-28350 Affected Lxml html clean Versions

1 component(s)
Fixed Versions:
0.4.4
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?
CVE-2026-28350 is a security vulnerability in Lxml html clean involving lxml-html-clean has <base> tag injection through default Cleaner configuration under CWE-116: Improper Encoding or Escaping of Output.
Which Lxml html clean versions are affected?
Affected versions include releases prior to 0.4.4 across affected packages: lxml-html-clean.
What version fixes CVE-2026-28350?
Upgrading to 0.4.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is lxml-html-clean affected?
Yes, lxml-html-clean is affected in releases prior to 0.4.4. Upgrade your dependency to 0.4.4 or later.
What is the CVSS score of CVE-2026-28350?
CVE-2026-28350 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2026-28350?
CVE-2026-28350 is classified under CWE-116: Improper Encoding or Escaping of Output (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.).
How can I check PyPI dependencies for CVE-2026-28350?
Run the dependency tree command: 'pip show lxml-html-clean'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}