{"cve":"CVE-2024-52595","nvd":{"published":"2024-11-19T22:15:21.120","modified":"2026-06-17T08:07:31.003","status":"Analyzed","description":"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>`.","cvss_v4":null,"cvss_v3":{"version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1},"cwes":["CWE-79","CWE-83","CWE-184"],"references":["https://github.com/fedora-python/lxml_html_clean/commit/c5d816f86eb3707d72a8ecf5f3823e0daa1b3808","https://github.com/fedora-python/lxml_html_clean/pull/19","https://github.com/fedora-python/lxml_html_clean/security/advisories/GHSA-5jfw-gq64-q45f"],"products":["fedoralovespython:lxml_html_clean"],"source":"nvd","synced_at":"2026-10-19T21:57:34.731061660+00:00"},"epss":{"cve":"CVE-2024-52595","score":0.00508,"percentile":0.43396,"date":"2026-10-31"},"kev":null,"osv":[{"id":"GHSA-5jfw-gq64-q45f","url":"https://osv.dev/vulnerability/GHSA-5jfw-gq64-q45f","summary":"HTML Cleaner allows crafted scripts in special contexts like svg or math to pass through","modified":"2025-01-14T16:52:36.284104Z","packages":[{"ecosystem":"PyPI","name":"lxml-html-clean","purl":"pkg:pypi/lxml-html-clean","ranges":["<0.4.0"],"fixed":["0.4.0"]}]},{"id":"PYSEC-2024-160","url":"https://osv.dev/vulnerability/PYSEC-2024-160","summary":"","modified":"2025-01-14T05:57:14.493050Z","packages":[{"ecosystem":"PyPI","name":"lxml-html-clean","purl":"pkg:pypi/lxml-html-clean","ranges":["<0.4.0"],"fixed":["0.4.0"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}