PyPI: html-sanitizer

CVE-2024-34078

Safety vulnerability ID: SFTY-20240506-25046

Safety legacy ID: pyup.io-71890

An issue has been identified in the sanitizer when handling unicode normalization, which can lead to arbitrary HTML being present after sanitization. Specifically, if keep_typographic_whitespace=False (the default setting), the sanitizer normalizes unicode to the NFKC form at the end of the process. Some unicode characters normalize to chevrons (< and >), allowing specially crafted HTML to escape the sanitization process.

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

Overview

Arbitrary HTML present after sanitization because of unicode normalization

Advisory

An issue has been identified in the sanitizer when handling unicode normalization, which can lead to arbitrary HTML being present after sanitization. Specifically, if keep_typographic_whitespace=False (the default setting), the sanitizer normalizes unicode to the NFKC form at the end of the process. Some unicode characters normalize to chevrons (< and >), allowing specially crafted HTML to escape the sanitization process.

Affected Package

Affecting html-sanitizer package, versions<2.4.2

Also affects

---

How to Fix

Upgradehtml-sanitizerto2.4.2or 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