PyPI: lxml

CVE-2021-43818

Safety vulnerability ID: SFTY-20211213-05028

Safety legacy ID: pyup.io-43366

Lxml 4.6.5 includes a fix for CVE-2021-43818: Prior to version 4.6.5, the HTML Cleaner in lxml.html lets certain crafted script content pass through, as well as script content in SVG files embedded using data URIs. Users that employ the HTML cleaner in a security relevant context should upgrade to lxml 4.6.5 to receive a patch.

Created at: Jul 5, 2026Updated at: Jul 5, 2026

Overview

lxml's HTML Cleaner allows crafted and SVG embedded scripts to pass through

Advisory

Lxml 4.6.5 includes a fix for CVE-2021-43818: Prior to version 4.6.5, the HTML Cleaner in lxml.html lets certain crafted script content pass through, as well as script content in SVG files embedded using data URIs. Users that employ the HTML cleaner in a security relevant context should upgrade to lxml 4.6.5 to receive a patch.

Affected Package

Affecting lxml package, versions<4.6.5

Also affects

---

How to Fix

Upgradelxmlto4.6.5or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

Verified by Safety

Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.

Learn more