CVE-2026-6879

Quadratic Behavior in xml.etree.ElementPath Index Predicates

Published Jul 28, 2026 CVSS 4.0 · 2 Low EPSS < 1% KEV · Not listed
Description
`Element.findall()` and fully-consumed `Element.iterfind()` exhibit `O(n^2)` time complexity when using XPath index predicates (e.g. `[1]`, `[last()]`, `[last()-N]`) on XML documents with many same-tag siblings. `Element.find()` is only affected when the first match is near the end  of the sibling list, such as with `[last()]` or `[last()-N]`;  `.//item[1]` short-circuits after the first match.

Analysis

AI-generated

Technical impact

Element.findall() and Element.iterfind() in CPython’s xml.etree.ElementPath implementation have a quadratic O(n^2) time complexity when an XPath index predicate (e.g. [1], [last()], or [last()-N]) is used on a node with many same‑tag siblings. Because the parser scans each sibling to evaluate the predicate, processing a large document can consume CPU and memory, potentially causing the application to hang or crash. The vulnerability is a performance flaw (CWE‑407).

Affected Systems

The Python Software Foundation’s CPython implementation is affected. Any CPython release that has not incorporated the commits referenced (02c08e6b02…, 2ffab08378…, 390337b8ba…, cb409342a…) is potentially vulnerable. Systems that parse XML with Element.findall() or Element.iterfind() and use XPath index predicates are at risk.

Risk and Exploitability

The vulnerability aligns with CWE‑407 and CWE‑770. The CVSS score of 2.0 indicates low severity, and the EPSS score of less than 1% shows very low likelihood of exploitation. The vulnerability is not listed in CISA’s KEV catalog, suggesting limited real-world impact. However, an attacker who can supply crafted XML containing many same‑tag siblings and an index predicate can trigger the quadratic traversal, leading to a performance‑based denial of service. The attack vector is likely local or remote where the application processes external XML payloads.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade CPython to a release that includes the fix referenced in the advisory commits.
  • Avoid using XPath index predicates such as [1] or [last()] in XML parsing code; retrieve elements without predicates and apply indexing logic in application code as a temporary measure.
  • Apply input validation or size limits to reject or sandbox oversized XML documents, preventing the quadratic traversal from exhausting resources.
  • Monitor resource usage for unusually high CPU spikes during XML parsing to detect ongoing exploitation attempts.

Generated by OpenCVE AI on August 5, 2026 at 14:08 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
First Time appeared Redhat
Redhat hummingbird
Weaknesses CWE-770
CPEs cpe:/a:redhat:hummingbird:1
Vendors & Products Redhat
Redhat hummingbird
References
Metrics threat_severity

None

cvssV3_1

{'score': 2.2, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:L'}

threat_severity

Low

Type Values Removed Values Added
First Time appeared Python
Python cpython
Vendors & Products Python
Python cpython
Type Values Removed Values Added
Description `Element.findall()` and fully-consumed `Element.iterfind()` exhibit `O(n^2)` time complexity when using XPath index predicates (e.g. `[1]`, `[last()]`, `[last()-N]`) on XML documents with many same-tag siblings. `Element.find()` is only affected when the first match is near the end  of the sibling list, such as with `[last()]` or `[last()-N]`;  `.//item[1]` short-circuits after the first match.
Title Quadratic Behavior in xml.etree.ElementPath Index Predicates
Weaknesses CWE-407
References
Metrics cvssV4_0

{'score': 2, 'vector': 'CVSS:4.0/AV:N/AC:H/AT:P/PR:H/UI:P/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N'}

ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Weaknesses
  • CWE-407

    Inefficient Algorithmic Complexity

  • CWE-770

    Allocation of Resources Without Limits or Throttling

Sources

Status
PUBLISHED
Assigner
PSF
Published
Updated
Aug 13, 2026, 12:27 AM
Reserved
Apr 22, 2026, 6:26 PM
Status
Awaiting Analysis
Published
Jul 28, 2026, 3:17 PM
Modified
Oct 24, 2026, 1:10 PM
Severity
Low
Public date
Jul 28, 2026, 1:46 PM