CVE-2026-28348: lxml-html-clean CSS @import Filter Bypass via Unicode Escapes
Summary
CVE-2026-28348: lxml-html-clean has CSS @import Filter Bypass via Unicode Escapes. Affects lxml-html-clean versions < 0.4.4. Fixed in 0.4.4. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
lxml-html-clean is a Python package designed to sanitize HTML content by cleaning up potentially harmful elements, particularly in user-generated content. It focuses on removing unwanted tags and attributes to prevent security vulnerabilities such as XSS (Cross-Site Scripting). However, it is susceptible to a specific vulnerability that allows CSS @import statements to bypass filters, potentially leading to external CSS loading and XSS attacks in older browsers.
Vulnerability Detail
The vulnerability arises from the _has_sneaky_javascript() method in clean.py, which strips backslashes before checking for dangerous CSS keywords. This allows CSS Unicode escape sequences to bypass the @import and expression() filters. For example, a payload like @\69mport is transformed into @69mport, which does not match the blacklist keyword @import. Modern browsers interpret @\69mport as a valid @import statement, leading to the loading of external CSS. This can result in data exfiltration and UI redressing. In older browsers like Internet Explorer, it can lead to full XSS via expression().
How To Fix
Latest published version: 0.4.5 as of 22 Oct 2026
pip install --upgrade "lxml-html-clean==0.4.5"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
0.4.4
This is the first release that contains the fix.
pip install --upgrade "lxml-html-clean==0.4.4"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, avoid using lxml-html-clean for cleaning HTML content that may contain CSS styles until the package is updated. Additionally, you can manually sanitize any CSS styles to prevent the use of @import and expression() statements.
Conclusion
In summary, CVE-2026-28348 is a significant vulnerability in the lxml-html-clean package that allows for CSS @import filter bypass through Unicode escapes. It is crucial to update to the patched version 0.4.4 to mitigate the risks associated with this vulnerability.
See every vulnerability recorded for lxml-html-clean →
FAQ
CVE-2026-28348 is a vulnerability in the lxml-html-clean package that allows CSS @import statements to bypass security filters due to improper handling of Unicode escape sequences.
If your application uses lxml-html-clean to sanitize HTML, it may inadvertently allow external CSS to be loaded, leading to data exfiltration and potential XSS attacks.
Versions of lxml-html-clean up to and including 0.4.3 are affected. The vulnerability is fixed in version 0.4.4.
You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected without needing to sign up.
The CVSS score of this vulnerability is 6.1, indicating a moderate level of severity.
References
Related vulnerabilities
Recent vulnerabilities recorded for lxml-html-clean.