I'm working on a buffer overflow CTF challenge. The binary for this challenge includes a give_shell
function (they cover shellcode in the next challenge)
I can successfully overwrite the saved EIP on the stack to redirect execution to the 'give_shell' function:
080484cb push ebp
080484cc mov ebp, esp
080484ce sub esp, 0x8
080484d1 sub esp, 0xc
080484d4 push 0x80485f0 {var_1c} {"/bin/sh"}
080484d9 call system
080484de add esp, 0x10
080484e1 nop
080484e2 leave {__saved_ebp}
080484e3 retn
However, even though I can confirm in GDB that the program is stepping through the give_shell
function - no shell launches, either in GDB, locally or using Netcat to the actual CTF server.
I'm unsure what I am missing here. Is this a case where I need to bind or reverse the shell in order to be able to use it interactively? I've seen that discussed in shellcode examples, but not sure how to do it in this case.
Thank you!
call system
, does it actually end up in the correct place?stepi
intosystem@plt
- however, once I'm insystem@plt
I can nexti through it, however GDB will not allow me todisass system@plt
- when I try it respondsNo symbol "plt" in current context.
- not sure if that's because there is something special about system@plt or it is because something is wrong. I can attach a screen cap if needed. Thank you!