Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

7 Commits

Repository files navigation

how2python

Repository to keep track of python memory corruption bugs that can be used to potentially bypass audit hooks

Bugs

All exploits were tested on 64 bit versions of python on Windows and Linux and on versions >=3.13.0. Exploits might not work or need to be implemented differently on different versions of python.

All files with an exploit implemented will create a bytearray object that can write anywhere in memory which is enough to consider the process "pwned". As a simple PoC, once the object is created it will print its type, length, and overwrite the value of 250 to be 100 and print it out to show that everything has worked.

LinkIntroduced InPatched InExploit Implemented
__classdict__ bug3.12.0N/AYes
bytearray bug3.13.6Yes
calliter bugN/AYes
cell bug3.13.1Yes
decimal.Context BugN/AYes
divmod bugN/AYes
functools.partial bug3.12.3N/AYes
GenericAlias repr bug3.12.0N/AYes
GenericAlias subscript bug3.11.03.13.8Yes
iter bugN/AYes
io.BytesIO bug3.12.0N/AYes
itertools.accumulate bugN/AYes
itertools.count bugN/AYes
itertools.groupby bugN/AYes
longrange bugN/AYes
mappingproxy bugN/AYes
memoryview richcompare bugN/AYes
memoryview subscript bugN/AYes
mro bug3.10.03.14.0Yes
namespace bugN/AYes
OrderedDict copy bug3.5.0N/ALinux only
OSError bugN/AYes
try/except* bug3.11.03.13.2Yes

Notes on 3.14

Most of the bugs in this repository were found during the time when 3.13.0 and 3.13.1 were the most recent python versions, so most exploits are built to work on those versions.

With 3.14, most unpatched bugs should work fine, but a couple of the type confusion bugs will be broken because of the tuple struct change.

A new field was added to the tuple struct which means the complex object is no longer the ideal type for creating fake tuples. Very tragic, but life goes on. Maybe you as the reader can find a way to implement these bugs in 3.14 as a learning exercise!

3.13.0 PyTupleObject3.14.0 PyTupleObject

About

Repository to keep track of python memory corruption bugs that can be used to potentially bypass audit hooks

Resources

Stars

70 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages