CVE-2026-41066: lxml Default Configuration Of Iterparse() And Vulnerability

HIGH
Advisory Identifier: GHSA-vfmq-68hx-4jfw
CVSS 7.5
CWE-611
Published
Advisory Summary

CVE-2026-41066 is a HIGH (CVSS 7.5) default configuration of iterparse() and vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting lxml libraries in the PyPI ecosystem. The issue involves default configuration of iterparse() and etcompatxmlparser() allows xxe to local files. Remediation is available by upgrading affected packages to version 6.1.0.

CVE-2026-41066 at a Glance

CVE Identifier CVE-2026-41066
GHSA Identifier GHSA-vfmq-68hx-4jfw
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-611: Improper Restriction of XML External Entity Reference
Affected Product lxml
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-41066

To remediate this vulnerability, upgrade all affected lxml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

lxml fixed: 6.1.0
pip install lxml>=6.1.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show lxml

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-41066, inspect your installed packages using pip:

pip show lxml

Analyze the terminal output to locate any version of lxml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.1.0), your application is affected.

Note: The pip show lxml command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-611: Improper Restriction of XML External Entity Reference, where the product processes an xml document that can contain xml entities with uris that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. In lxml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.

CVE-2026-41066 Affected lxml Versions

1 component(s)
Fixed Versions:
6.1.0
Product / Package Ecosystem Affected Versions Fixed Version
lxml
PyPI
< 6.1.0
6.1.0

References

Frequently Asked Questions

What is CVE-2026-41066?
CVE-2026-41066 is a security vulnerability in lxml involving Default configuration of iterparse() and ETCompatXMLParser() allows XXE to local files under CWE-611: Improper Restriction of XML External Entity Reference.
Which lxml versions are affected?
Affected versions include releases prior to 6.1.0 across affected packages: lxml.
What version fixes CVE-2026-41066?
Upgrading to 6.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is lxml affected?
Yes, lxml is affected in releases prior to 6.1.0. Upgrade your dependency to 6.1.0 or later.
What is the CVSS score of CVE-2026-41066?
CVE-2026-41066 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-41066?
CVE-2026-41066 is classified under CWE-611: Improper Restriction of XML External Entity Reference (The product processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.).
How can I check PyPI dependencies for CVE-2026-41066?
Run the dependency tree command: 'pip show lxml'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vfmq-68hx-4jfw",
  "modified" : "2026-06-06T00:59:15Z",
  "published" : "2026-04-21T20:38:44Z",
  "aliases" : [ "CVE-2026-41066" ],
  "summary" : "lxml: Default configuration of iterparse() and ETCompatXMLParser() allows XXE to local files",
  "details" : "### Impact\nUsing either of the two parsers in the default configuration (with `resolve_entities=True`) allows untrusted XML input to read local files.\n\n### Patches\nlxml 6.1.0 changes the default to `resolve_entities='internal'`, thus disallowing local file access by default.\n\n### Workarounds\nSetting the `resolve_entities` option explicitly to `resolve_entities='internal'` or `resolve_entities=False` disables the local file access.\n\n### Resources\nOriginal report: https://bugs.launchpad.net/lxml/+bug/2146291\n\nThe 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "lxml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/lxml/lxml/security/advisories/GHSA-vfmq-68hx-4jfw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41066"
  }, {
    "type" : "WEB",
    "url" : "https://bugs.launchpad.net/lxml/+bug/2146291"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/lxml/lxml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lxml/lxml/releases/tag/lxml-6.1.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/lxml/PYSEC-2026-87.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-611" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-21T20:38:44Z",
    "nvd_published_at" : "2026-04-24T17:16:20Z"
  }
}