GHSA-xvp8-3mhv-424c

Suggest an improvement
Source
https://github.com/advisories/GHSA-xvp8-3mhv-424c
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-xvp8-3mhv-424c/GHSA-xvp8-3mhv-424c.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-xvp8-3mhv-424c
Aliases
Related
Published
2026-03-02T19:35:52Z
Modified
2026-03-10T18:44:00.312921Z
Severity
  • 6.1 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N CVSS Calculator
Summary
lxml-html-clean has <base> tag injection through default Cleaner configuration
Details

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

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.
Database specific
{
    "github_reviewed": true,
    "github_reviewed_at": "2026-03-02T19:35:52Z",
    "severity": "MODERATE",
    "nvd_published_at": "2026-03-05T20:16:16Z",
    "cwe_ids": [
        "CWE-116"
    ]
}
References

Affected packages

PyPI / lxml-html-clean

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.4.4

Affected versions

0.*
0.1.0
0.1.1
0.2.0
0.2.1
0.2.2
0.3.0
0.3.1
0.4.0
0.4.1
0.4.2
0.4.3

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-xvp8-3mhv-424c/GHSA-xvp8-3mhv-424c.json"
last_known_affected_version_range
"<= 0.4.3"