I am trying my luck with buffer overflows, however, I am stuck at one point. I overwrite the return address, so that EIP
will point into the address of the nop
sled of my shellcode. However, when ret
is run, I get the error: Cannot access memory at address 0x90909094
. Can anybody see what is wrong?
A dump from memory:
(gdb) x/8wx $esp
0xbffff18c: 0xbffff470 0xbffff400 0x00000000 0x08048559
0xbffff19c: 0xb7fc6ff4 0x08048550 0x00000000 0x00000000
(gdb) x/8wx 0xbffff470
0xbffff470: 0x90909090 0x90909090 0x90909090 0x90909090
0xbffff480: 0x90909090 0x90909090 0x90909090 0x90909090
(gdb) nexti
Cannot access memory at address 0x90909094
(gdb) i r eip
eip 0xbffff470 0xbffff470
As you can see, the return address is 0xbffff470 and on that location, my nop
sled is placed. However, as soon as I run the next instruction (which is ret
), I get an error. What is wrong here?
Edit: I am using x86-32
Edit: I found the answer in another post: GDB ret "cannot access memory at address" Basically, the problem is right before the address esp is set to equals ebp, when in my case will be 0x90909090.. Thus, a quick solve is to not use 'A's as padding, but rather just the address in every word.