CVEfocus › CVE database › CVE-2024-52595

CVE-2024-52595HTML Cleaner allows crafted scripts in special contexts like svg or math to pass through

CVSS 7.7 HighEPSS 1.0% (higher than 60% of CVEs)Published 2024-11-19Updated 2024-11-20Assigner: GitHub_M

lxml_html_clean is a project for HTML cleaning functionalities copied from `lxml.html.clean`. Prior to version 0.4.0, the HTML Parser in lxml does not properly handle context-switching for special HTML tags such as `<svg>`, `<math>` and `<noscript>`. This behavior deviates from how web browsers parse and interpret such tags. Specifically, content in CSS comments is ignored by lxml_html_clean but may be interpreted differently by web browsers, enabling malicious scripts to bypass the cleaning process. This vulnerability could lead to Cross-Site Scripting (XSS) attacks, compromising the security of users relying on lxml_html_clean in default configuration for sanitizing untrusted HTML content. Users employing the HTML cleaner in a security-sensitive context should upgrade to lxml 0.4.0, which addresses this issue. As a temporary mitigation, users can configure lxml_html_clean with the following settings to prevent the exploitation of this vulnerability. Via `remove_tags`, one may specify tags to remove - their content is moved to their parents' tags. Via `kill_tags`, one may specify tags to be removed completely. Via `allow_tags`, one may restrict the set of permissible tags, excluding context-switching tags like `<svg>`, `<math>` and `<noscript>`.

CWE-184CWE-79CWE-83

What to do

Fixed builds are available from Debian, PyPI: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

3Fixed
1Fix pending
2Under investigation
1Will not fix

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.10lxml-html-cleanFix pendingUBUNTU-CVE-2024-52595
Ubuntu 26.04lxml-html-cleanUnder investigationUBUNTU-CVE-2024-52595
Ubuntu 25.10lxml-html-cleanWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2024-52595
Ubuntu 24.04lxml-html-cleanUnder investigationUBUNTU-CVE-2024-52595
Debian 14lxml-html-cleanFixed0.4.1-1DEBIAN-CVE-2024-52595
Debian 13lxml-html-cleanFixed0.4.1-1DEBIAN-CVE-2024-52595
PyPI librarylxml-html-cleanFixed0.4.0PYSEC-2024-160

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.