Home > Back-end >  what's happened when process is attacked by "stack buffer overflow"?
what's happened when process is attacked by "stack buffer overflow"?

Time:09-26

I'm a student learning computer security. Recently, I learned stack buffer overflow on c.
I understood its concepts and run sample codes written by c.

void main(){
    char buf[] = "\xeb\x0b\x31\xc0\xb0\x0b\x31\xd2\x31\xc9\x5b\xcd\x80\xe8\xf0\xff\xff\xff/bin/sh\x0";
    int* p;
    p = (int*)&p   2;
    *p = (int)buf;
    return;
}

Runtime Environment

  • Architecture: i686
  • OS: ubuntu 16.04 32bit
  • Compiler: gcc
  • Turn off ASLR(sysctl -w kernel.randomize_va_space=0)
  • Options: gcc -z execstack -mpreferred-stack-boundary=2 -fno-stack-protector

But I confuse what stack is saved and which memories are overlapped.
Above binary code, "\xeb\x0b\x31\xc0\xb0\x0b\x31\xd2\x31\xc9\x5b\xcd\x80\xe8\xf0\xff\xff\xff/bin/sh\x0", the same assembly code is

.global main

main:
    jmp strings

start:
    xor            
  • Related