2 years ago

#118184

test-img

Miroslav Savel

Why cannot rewrite EIP even if disabled memory randomization and no stack protector?

I am following tutorial on youtube about basic buffer overflow "Running a Buffer Overflow Attack - Computerphile" and I cannot overwrite EIP value on Kali linux 2021.2.

#include <stdio.h>
#include <string.h>

int main (int argc, char** argv)
{
    char buffer[500];
    strcpy(buffer, argv[1]);

    return 0;
}

I have compiled vuln.c with flags gcc -m32 -g -fno-stack-protector -o vuln vuln.c

I have also disable OS memory randomization

after running (gdb) run $(python -c 'print "\x41" * 508') I got SIGSEGV, but my registers look different from video -> "ecx 0x41414141 ebx 0x41414141 eip 0x565561e9 ", instruction pointer is not pointing as was mentioned in video at 0x41414141 but at some weird address " 0x565561e9". Can somebody explain me why? Why I cannot directly overwrite EIP and accomplish overflow?

c

overflow

exploit

0 Answers

Your Answer

Accepted video resources