CVE intelligence and bounded remediation

CVE-2021-43818 — lxml is a library for processing XML and HTML in the Python language

High CVSS 8.2

lxml is a library for processing XML and HTML in the Python language. 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. There are no known workarounds available.

Severity
High
CVSS
8.2 (3.1)
Published
2021-12-13
CISA KEV
Not currently listed
Ecosystem
python/pypi
Weaknesses
CWE-74, CWE-79

Affected products

  • lxml / lxml
  • fedoraproject / fedora / 34
  • fedoraproject / fedora / 35
  • debian / debian_linux / 9.0
  • debian / debian_linux / 10.0
  • debian / debian_linux / 11.0

Showing 6 representative product identities from 15 source matches. Confirm exact affected versions with the linked vendor and NVD evidence.

Matched remediation archetype

Cross-site scripting and unsafe browser output

This catalog composition supplies bounded fallback guidance. Explicitly reviewed curated workflows load with the complete record below.

Check exposure

  • Trace reflected, stored, and DOM-derived untrusted values into HTML, attributes, URLs, styles, scripts, and client-side template sinks.
  • Identify affected origins, authenticated user roles, sensitive browser capabilities, and where content is shared across tenants.
  • Review framework escaping, rich-text sanitization, legacy templates, and client-side rendering paths.

Remediate safely

  • Use context-aware framework output encoding and safe DOM APIs; keep untrusted data out of executable contexts.
  • Sanitize intentionally supported markup with a maintained allowlist policy and validate URLs and attributes separately.
  • Update affected rendering components and add tests for every output context using inert sentinel markup.

Authoritative sources

Complete CVE record and remediation plan

The detailed catalog view below loads this exact record, its source evidence, and the full seven-phase agentic change plan.