CVE-2026-41066: lxml: Default configuration of iterparse() and ETCompatXMLParser() allows XXE to local files
Impact Using either of the two parsers in the default configuration (with resolveentities=True) allows untrusted XML input to read local files. Patches lxml 6.1.0 changes the default to resolveentities='internal', thus disallowing local file access by default. Workarounds Setting the resolveentities option explicitly to resolveentities='internal' or resolveentities=False disables the local file access.
Published Apr 21, 2026 · Updated Jun 6, 2026
Affected packages
lxml
- Ecosystem
- PyPI
- Affected
- < 6.1.0
- Fixed in
- 6.1.0
- Check
pip show lxml
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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.
Credited to Brubbish.
References
- https://github.com/lxml/lxml/security/advisories/GHSA-vfmq-68hx-4jfw
- https://bugs.launchpad.net/lxml/+bug/2146291
- https://github.com/lxml/lxml/releases/tag/lxml-6.1.0
- https://nvd.nist.gov/vuln/detail/CVE-2026-41066
- https://github.com/pypa/advisory-database/tree/main/vulns/lxml/PYSEC-2026-87.yaml
- https://github.com/advisories/GHSA-vfmq-68hx-4jfw
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
