Skip to content

UAF: xml.etree.ElementTree.Element.__deepcopy__ when concurrent mutations happen #133009

Closed

Description

@picnixz

Crash report

What happened?

Reproducer:

import xml.etree.ElementTree as ET
from copy import deepcopy

class Evil(ET.Element):
    def __deepcopy__(self, memo):
        root.clear()
        return self

root = ET.Element('a')
root.append(Evil('x'))
deepcopy(root)

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Output from running 'python -VV' on the command line:

Python 3.14.0a7+ (heads/main:7f02ded29fb, Apr 26 2025, 14:29:01) [GCC 7.5.0]

Linked PRs

Activity

  1. added
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Apr 26, 2025
  2. self-assigned this
    on Apr 26, 2025
  3. added a commit that references this issue on May 10, 2025
  4. added 2 commits that reference this issue on May 10, 2025
  5. added 2 commits that reference this issue on May 10, 2025
  6. added a commit that references this issue on Jul 12, 2025
  7. added a commit that references this issue on Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

extension-modulesC modules in the Modules dirtopic-XMLtype-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions