Theory:
The RAM layout has different virtual address spaces for every single process. The structure of a virtual address space is illustrated in the figure below.
A stack buffer overflow can be for example a “write” in another variable. This is possible due to the stack structure. If we have the following C code.
int main(void)
{
char Buffer[16];
int pwValid = 0;
return 0;
}
The stack looks like this.
With this information if more than 16 letters will be written to the “Buffer” variable the stack will write into the next address space, where in this case the integer value “pwValid” is located. Due to this fact it is possible to change the value of a variable through a so called buffer overflow.
$ ./hackme3_linux
Copyright by NM-Projects.de
Enter password: 012345678901234567890
Wrong password
Root access granted!
Leave a Reply