PYSEC-2026-87: lxml: Default configuration of iterparse() and ETCompatXMLParser() allows XXE to local files
lxml is a library for processing XML and HTML in the Python language. Prior to 6.1.0, using either of the two parsers in the default configuration (with resolveentities=True) allows untrusted XML input to read local files. Setting the resolveentities option explicitly to resolveentities='internal' or resolveentities=False disables the local file access. This vulnerability is fixed in 6.1.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
lxmlto a version that resolves this vulnerability.Fixed in 6.1.0 - Configuration
Set resolve_entities explicitly to 'internal' or False to disable local file access.
lxml resolve_entities = 'internal' or False
Event History
Frequently Asked Questions
Which deployments are exposed?
Deployments using lxml versions before 6.1.0 are exposed when they parse untrusted XML with iterparse() or ETCompatXMLParser() in their default configuration, where resolve_entities=True.
What does an attacker need to exploit this issue?
An attacker needs to supply XML content that is processed by one of the affected parsers. No authentication or user interaction is required according to the supplied severity vector.
What is the impact of successful exploitation?
The issue allows untrusted XML to read local files through external entity expansion. The provided severity vector indicates high confidentiality impact, with no integrity or availability impact.
What can be done if upgrading is not immediately possible?
Explicitly configure the parser with resolve_entities='internal' or resolve_entities=False. Either setting disables local file access.