High

lxml: Default configuration of iterparse() and ETCompatXMLParser() allows XXE to local files

  • Disclosed: 21.04.2026
  • Updated: 11.10.2026 15:17

Impact

Using either of the two parsers in the default configuration (with resolve_entities=True) allows untrusted XML input to read local files.

Patches

lxml 6.1.0 changes the default to resolve_entities='internal', thus disallowing local file access by default.

Workarounds

Setting the resolve_entities option explicitly to resolve_entities='internal' or resolve_entities=False disables the local file access.

Resources

Original report: https://bugs.launchpad.net/lxml/+bug/2146291

The default option was changed to resolve_entities='internal' for the normal XML and HTML parsers in lxml 5.0. The default was not changed for iterparse() and ETCompatXMLParser() at the time. lxml 6.1 makes the safe option the default for all parsers.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) lxml < 6.1.0 6.1.0

References

CVSS score 7.5/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness (CWE)
CWE-611
Platform
Python (PyPI)
Package
lxml
Disclosed
21.04.2026
Updated
11.10.2026 15:17

Sources and licenses

OSV / GitHub Advisory Database - PYSEC-2026-87 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-vfmq-68hx-4jfw - CC BY 4.0

Vulnerability history: lxml

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
7
First → latest
05.2014 04.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • High 1
  • Medium 6

Disclosures per year

  1. 2017: 0
  2. 2018: 1
  3. 2019: 0
  4. 2020: 1
  5. 2021: 2
  6. 2022: 1
  7. 2023: 0
  8. 2024: 0
  9. 2025: 0
  10. 2026: 1

earlier: 1

  1. lxml: Default configuration of iterparse() and ETCompatXMLParser() allows XXE to local files this entry
    High · 7.5 CVE-2026-41066 < 6.1.0 6.1.0
  2. Medium · 6.1 CVE-2021-28957 < 4.6.3 4.6.3
  3. Medium · 6.1 CVE-2020-27783 < 4.6.2 4.6.2
  4. Medium · 6.1 CVE-2018-19787 < 4.2.5 4.2.5

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.