Skip to content

gh-126037: fix UAF in xml.etree.ElementTree.Element.find* when concurrent mutations happen - #127964

Merged
picnixz merged 7 commits into
python:mainfrom
picnixz:fix/xml/evil-find-126037
Mar 31, 2025
Merged

gh-126037: fix UAF in xml.etree.ElementTree.Element.find* when concurrent mutations happen#127964
picnixz merged 7 commits into
python:mainfrom
picnixz:fix/xml/evil-find-126037

Conversation

@picnixz

@picnixzpicnixz commented Dec 15, 2024

Copy link
Copy Markdown
Member

@picnixzpicnixz added topic-XML needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Dec 15, 2024
@picnixzpicnixz changed the title gh-126037: fix crashes in xml.etree.ElementTree.Element.find* with tag's custom str.__eq__gh-126037: fix crashes in xml.etree.ElementTree.Element.find* when concurrent mutations happenDec 17, 2024
Comment threadLib/test/test_xml_etree.py

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment threadMisc/NEWS.d/next/Library/2024-12-15-15-07-22.gh-issue-126037.OyA7JP.rst Outdated
@picnixz
picnixz merged commit c57623c into python:mainMar 31, 2025
@miss-islington-app

Copy link
Copy Markdown

Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@picnixz
picnixz deleted the fix/xml/evil-find-126037 branch March 31, 2025 10:26
@miss-islington-app

Copy link
Copy Markdown

Sorry, @picnixz, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c57623c221d46daeaedfbf2b32d041fde0c882de 3.13

@miss-islington-app

Copy link
Copy Markdown

Sorry, @picnixz, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c57623c221d46daeaedfbf2b32d041fde0c882de 3.12

picnixz added a commit to picnixz/cpython that referenced this pull request Mar 31, 2025
…n concurrent mutations happen (python#127964)
We fix a use-after-free in the `find`, `findtext` and `findall` methods of `xml.etree.ElementTree.Element`
objects that can be triggered when the tag to find implements an `__eq__` method that mutates the
element being queried.
@bedevere-app

Copy link
Copy Markdown

GH-131931 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.13 bugs and security fixes label Mar 31, 2025
@bedevere-app

Copy link
Copy Markdown

GH-131932 is a backport of this pull request to the 3.12 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.12 only security fixes label Mar 31, 2025
@picnixzpicnixz changed the title gh-126037: fix crashes in xml.etree.ElementTree.Element.find* when concurrent mutations happengh-126037: fix UAF in xml.etree.ElementTree.Element.find* when concurrent mutations happenMar 31, 2025
picnixz added a commit that referenced this pull request Mar 31, 2025
…en concurrent mutations happen (#127964) (#131932)
gh-126037: fix UAF in `xml.etree.ElementTree.Element.find*` when concurrent mutations happen (#127964)
We fix a use-after-free in the `find`, `findtext` and `findall` methods of `xml.etree.ElementTree.Element`
objects that can be triggered when the tag to find implements an `__eq__` method that mutates the
element being queried.
(cherry picked from commit c57623c)
picnixz added a commit that referenced this pull request Mar 31, 2025
…en current mutations happen (#127964) (#131931)
gh-126037: fix UAF in `xml.etree.ElementTree.Element.find*` when concurrent mutations happen (#127964)
We fix a use-after-free in the `find`, `findtext` and `findall` methods of `xml.etree.ElementTree.Element`
objects that can be triggered when the tag to find implements an `__eq__` method that mutates the
element being queried.
(cherry picked from commit c57623c)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@picnixz@vstinner