lxml: Default configuration of iterparse() and ETCompatXMLParser() allows XXE to local files
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.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| Python (PyPI) | lxml | < 6.1.0 | 6.1.0 |
References
- https://github.com/lxml/lxml/security/advisories/GHSA-vfmq-68hx-4jfw
- https://bugs.launchpad.net/lxml/+bug/2146291
- https://nvd.nist.gov/vuln/detail/CVE-2026-41066
- https://github.com/lxml/lxml
- https://github.com/lxml/lxml/releases/tag/lxml-6.1.0
- https://github.com/pypa/advisory-database/tree/main/vulns/lxml/PYSEC-2026-87.yaml
- 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
- 2017: 0
- 2018: 1
- 2019: 0
- 2020: 1
- 2021: 2
- 2022: 1
- 2023: 0
- 2024: 0
- 2025: 0
- 2026: 1
earlier: 1
-
lxml: Default configuration of iterparse() and ETCompatXMLParser() allows XXE to local files this entry
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.