Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

UAF:xml.etree.ElementTree.Element.remove when concurrent mutations happen #126033

Closed
Assignees
picnixz
Labels
3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirtopic-XMLtype-crashA hard crash of the interpreter, possibly with a core dump
@picnixz

Description

@picnixz

Crash report

What happened?

A UAF inElement.remove was fixed in#68279 but one can mutate the child's list during.remove and cause an OOB crash:

importxml.etree.ElementTreeasETclassEvilElement(ET.Element):def__eq__(self,other):base.clear()returnFalsebase=ET.Element('a')base.append(EvilElement('a'))base.append(EvilElement('a'))base.remove(ET.Element('b'))

Attacked code:

for (i=0;i<self->extra->length;i++) {
if (self->extra->children[i]==subelement)
break;
rc=PyObject_RichCompareBool(self->extra->children[i],subelement,Py_EQ);
if (rc>0)
break;
if (rc<0)
returnNULL;
}

I think we need to introduce some state integer to check that there is no evil mutation (similar to what's being done forOrderedDict).

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

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

No response

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesextension-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


    [8]ページ先頭

    ©2009-2025 Movatter.jp