3
votes

I try an basic buffer overflow, i overwrite the saved EIP on the stack an jump on to the adress. This adress point to à shell variable who containt my shellcode.

But on gdb, program sigserv on the first nop on the nopslide.

I lauch th program like this command:

gdb-peda$ r $(python -c 'print "A"*22 + "\x5f\xb8\xff\xff"')

I have this trace:

[----------------------------------registers-----------------------------------]
EAX: 0x1a 
EBX: 0xf7fc3ff4 --> 0x15dd7c 
ECX: 0xffffaf38 --> 0xf7fc44e0 --> 0xfbad2a84 
EDX: 0xf7fc5360 --> 0x0 
ESI: 0x0 
EDI: 0x0 
EBP: 0x41414141 ('AAAA')
ESP: 0xffffaf80 --> 0xffffb100 --> 0xc ('\x0c')
EIP: 0xffffb85f --> 0x90909090
EFLAGS: 0x10296 (carry PARITY ADJUST zero SIGN trap INTERRUPT direction overflow)
[-------------------------------------code-------------------------------------]
   0xffffb85c:  nop
   0xffffb85d:  nop
   0xffffb85e:  nop
=> 0xffffb85f:  nop
   0xffffb860:  nop
   0xffffb861:  nop
   0xffffb862:  nop
   0xffffb863:  nop
[------------------------------------stack-------------------------------------]
0000| 0xffffaf80 --> 0xffffb100 --> 0xc ('\x0c')
0004| 0xffffaf84 --> 0xf7fef060 (push   ebp)
0008| 0xffffaf88 --> 0x80484bb (<__libc_csu_init+11>:   add    ebx,0x1219)
0012| 0xffffaf8c --> 0xf7fc3ff4 --> 0x15dd7c 
0016| 0xffffaf90 --> 0x80484b0 (<__libc_csu_init>:  push   ebp)
0020| 0xffffaf94 --> 0x0 
0024| 0xffffaf98 --> 0xffffb018 --> 0x0 
0028| 0xffffaf9c --> 0xf7e7ce46 (<__libc_start_main+230>:   mov    DWORD PTR [esp],eax)
[------------------------------------------------------------------------------]
Legend: code, data, rodata, value
Stopped reason: SIGSEGV
0xffffb85f in ?? ()
gdb-peda$ x/i $eip
=> 0xffffb85f:  nop

I run on debian wheezy, gcc version is gcc (Debian 4.7.2-4) 4.7.2, gdb version 7.4.1-debian.

Is an new protection on this gcc version? Or other think?

Thanks you. (Sorry for my english :))

1
Did my answer help? If so, then can you select it as "accepted answer", by clicking next to it, so the question will be moved from unanswered. Thanks. - emil

1 Answers

1
votes

You can remove stack protection by following any of these steps:

Illustration of buffer overflows for students (linux, C)