CVE-2026-41066: lxml Default Configuration Allows XXE to Local Files
Summary
CVE-2026-41066: lxml: Default configuration of iterparse() and ETCompatXMLParser() allows XXE to local files. Affects lxml versions < 6.1.0. Fixed in 6.1.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
lxml is a powerful and feature-rich library in Python for processing XML and HTML documents. It provides a simple and efficient API for parsing and creating XML and HTML, making it a popular choice among developers. However, certain configurations of lxml can expose applications to security vulnerabilities, particularly when handling untrusted XML input.
Vulnerability Detail
The vulnerability arises from the default configuration of the iterparse() and ETCompatXMLParser() functions in lxml, which allows the option resolve_entities to be set to True. This configuration can lead to XML External Entity (XXE) attacks, enabling attackers to read local files on the server. If untrusted XML input is processed, it can potentially expose sensitive information stored in local files, leading to severe security implications.
How To Fix
Latest published version: 6.1.3 as of 22 Oct 2026
pip install --upgrade "lxml==6.1.3"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
6.1.0
This is the first release that contains the fix.
pip install --upgrade "lxml==6.1.0"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If you cannot update to the patched version, you can disable local file access by explicitly setting the resolve_entities option in your code as follows:
import lxml.etree as ET
parser = ET.XMLParser(resolve_entities='internal')
Alternatively, you can set it to False:
parser = ET.XMLParser(resolve_entities=False)
Conclusion
The vulnerability CVE-2026-41066 in the lxml package poses a significant risk due to its default configuration allowing XXE attacks. It is crucial to update to the latest version or implement workarounds to secure your applications against potential file access vulnerabilities.
See every vulnerability recorded for lxml →
FAQ
XXE stands for XML External Entity, a type of attack that exploits the ability of XML parsers to include external entities, potentially leading to unauthorized file access.
You can use Vulert to monitor and alert in real-time for open-source vulnerabilities in your software. Check your application against the vulnerability using the Vulert playground without any signup.
The CVSS score for this vulnerability is 7.5, indicating a high severity level.
If you cannot update to the patched version, make sure to set the resolve_entities option to 'internal' or False in your XML parsing code to mitigate the risk.
You can find more information in the original report on Launchpad or by checking the advisory database on GitHub.
Related vulnerabilities
Recent vulnerabilities recorded for lxml.