{"id":"CVE-2026-28350","aliases":["GHSA-xvp8-3mhv-424c","PYSEC-2026-2202"],"title":"lxml-html-clean has <base> tag injection through default Cleaner configuration","summary":"lxml-html-clean has <base> tag injection through default Cleaner configuration","severity":"medium","cvss":6.1,"cvssVector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","vendor":"lxml-html-clean","product":"lxml-html-clean","ecosystem":"pip","affected":["lxml-html-clean < 0.4.4"],"patched":["lxml-html-clean 0.4.4"],"published":"2026-03-02","updated":"2026-09-10","sourceUpdated":"2026-09-10T03:50:41.927155700Z","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-xvp8-3mhv-424c","references":[{"url":"https://github.com/fedora-python/lxml_html_clean/security/advisories/GHSA-xvp8-3mhv-424c"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-28350"},{"url":"https://github.com/fedora-python/lxml_html_clean/commit/9c5612ca33b941eec4178abf8a5294b103403f34"},{"url":"https://github.com/fedora-python/lxml_html_clean"}],"tags":["osv","pip"],"epss":0.00271,"epssPercentile":0.17426,"ingestedAt":"2026-07-13T18:58:05.376Z","slug":"CVE-2026-28350","body":"## Overview\n\n### 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.\n\n## Affected packages\n\n- `lxml-html-clean < 0.4.4`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `lxml-html-clean 0.4.4`","depth":"sunlit","depthScore":34,"depthScoreParts":{"impact":33.6,"likelihood":0.1,"exploitation":0,"ransomware":0},"changes":[]}