-
-
Notifications
You must be signed in to change notification settings - Fork 32k
UAF when using a malicious __getattribute__
when calling a class's cancel
function in task_step_handle_result_impl
in _asynciomodule.c
#126138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sidenote: This happens in 2 spots so both need to be fixed First Usage: cpython/Modules/_asynciomodule.c Lines 2964 to 2967 in 9effa0f
Second Usage (the one I linked in my report): cpython/Modules/_asynciomodule.c Lines 3057 to 3060 in 9effa0f
|
As always, thank you! I really like how you incorporate the bits I put in the test for you previous issue. I am not on my dev environment now (and won't be before at least 12 hours) so if you want to patch this one as well, you can create the PR! (I can review it though). |
_asynciomodule.c
when calling a class's cancel
function using a malicious __getattribute__
in task_step_handle_result_impl
__getattribute__
when calling a class's cancel
function in task_step_handle_result_impl
in _asynciomodule.c
…ute__` (#126305) Co-authored-by: Carol Willing <[email protected]>
…attribute__` (pythonGH-126305) (cherry picked from commit f032f6b) Co-authored-by: Nico-Posada <[email protected]> Co-authored-by: Carol Willing <[email protected]>
…attribute__` (pythonGH-126305) (cherry picked from commit f032f6b) Co-authored-by: Nico-Posada <[email protected]> Co-authored-by: Carol Willing <[email protected]>
…tattribute__` (GH-126305) (#126325) gh-126138: Fix use-after-free in `_asyncio.Task` by evil `__getattribute__` (GH-126305) (cherry picked from commit f032f6b) Co-authored-by: Nico-Posada <[email protected]> Co-authored-by: Carol Willing <[email protected]>
…tattribute__` (GH-126305) (#126324) gh-126138: Fix use-after-free in `_asyncio.Task` by evil `__getattribute__` (GH-126305) (cherry picked from commit f032f6b) Co-authored-by: Nico-Posada <[email protected]> Co-authored-by: Carol Willing <[email protected]>
…attribute__` (python#126305) Co-authored-by: Carol Willing <[email protected]>
…attribute__` (python#126305) Co-authored-by: Carol Willing <[email protected]>
Crash report
What happened?
This is the bug I mentioned I was looking into in #126080 (comment), but it's the same as all the ones that came before this.
cpython/Modules/_asynciomodule.c
Lines 3057 to 3060 in 9effa0f
task->task_cancel_msg
is missing an incref before usage so we can use a malicious__getattribute__
function in our class to free it before it gets sent to ourcancel
function.PoC
Output
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.13.0 (tags/v3.13.0:60403a5409f, Oct 10 2024, 09:24:12) [GCC 13.2.0]
Linked PRs
cancel
function #126305_asyncio.Task
by evil__getattribute__
(GH-126305) #126324_asyncio.Task
by evil__getattribute__
(GH-126305) #126325The text was updated successfully, but these errors were encountered: