Skip to content
2.0 Low

CVE-2026-6879 `Element.findall()` and fully-consumed `Element.iterfind()` exhibit `O(n^2)` time complexity when using XPath index…

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.

Affected products and versions

Product Affected versions Fixed in
CPython 3.15 3.15.0a1 → < 3.15.0rc1 3.15.0rc1
CPython 3.14 3.14.0 → < 3.14.7 3.14.7
CPython 3.13 3.13.0 → < 3.13.15 3.13.15
CPython 3.12 3.12.0 → < 3.12.14 3.12.14
CPython 3.11 3.11.0 → < 3.11.16 3.11.16
CPython 3.10 earliest → < 3.10.21 3.10.21

References

Timeline

  1. Published
  2. Last modified
The 79 CVEs of CPython →
Track this CVE