エンタープライズ:特集 2003/03/11 17:23:00 更新

rootkitによるハッキングとその防御
第3回 rootkit検出ツールによる検査 (6/6)

アンチウイルスソフトは有効か

 セキュリティHow-Toの「ウイルスからLinuxサーバを守る」では、Linux向けのアンチウイルスソフトの導入について解説した。rootkitに含まれるトロイの木馬などの検出に、アンチウイルスソフトは使えるのか気になる方もいらっしゃるだろう。そこで、ここではrootkitをインストールしたシステムをSophos Anti-Virusと同じく、Linuxで使えるアンチウイルスソフト「AntiVir for Linux」(H+BEDV)を使用してウイルススキャンを行ってみることにしよう。

■TuxkitをインストールしたシステムをSophos Anti-Virusでスキャンした結果
# sweep -all /
SWEEP virus detection utility
Version 3.66, February 2003 [Linux/Intel]
Includes detection for 79532 viruses, trojans and worms
Copyright (c) 1989,2003 Sophos Plc, www.sophos.com
System time 16:15:34, System date 14 January 2003
Command line qualifiers are: -all
Quick Sweeping
41662 files swept in 4 minutes and 14 seconds.
No viruses were discovered.
End of Sweep.

■TuxkitをインストールしたシステムをAntiVir for Linuxでスキャンした結果
# antivir --allfiles -s /*
AntiVir / Linux Version 2.0.6-10
Copyright (C) 1994-2002 by H+BEDV Datentechnik GmbH.
All rights reserved.
Loading /usr/lib/AntiVir/antivir.vdf ...                             
AntiVir is running in DEMO mode.                                     
VDF version: 6.18.0.4 created 27 Jan 2003                            
checking drive/path (list): /bin                                     
checking drive/path (list): /boot                                    
checking drive/path (list): /dev                                     
/dev/tux/tools/mirkforce/mirkforce                                   
 Date: 12.11.2001  Time: 21:57:48  Size: 97844                       
 ALERT: [Linux/TR.Mircforce virus] /dev/tux/tools/mirkforce/mirkforce 
<<< Contains signature of the Linux virus Linux/TR.Mircforce
checking drive/path (list): /etc                                     
checking drive/path (list): /home                                    
checking drive/path (list): /initrd                                  
checking drive/path (list): /lib                                     
checking drive/path (list): /lost+found                              
checking drive/path (list): /misc                                    
checking drive/path (list): /mnt                                     
checking drive/path (list): /opt                                     
checking drive/path (list): /proc                                    
checking drive/path (list): /root                                    
checking drive/path (list): /sbin                                    
checking drive/path (list): /tmp                                     
checking drive/path (list): /usr                                     
checking drive/path (list): /var                                     
----- scan results -----                                             
 directories:     2622                                               
       files:    43336                                               
      alerts:        1                                               
    repaired:        0                                               
     deleted:        0                                               
     renamed:        0                                               
   scan time: 00:03:12                                               
------------------------                                             
Thank you for using AntiVir.

 両方の結果を見てわかるように、tuxkitは検出されていない。AntiVir for Linuxの結果で検出されている「mirkforce」は、前述したようにtuxkitの本体ではなくツールである。

 では、定義ファイルのあるrootkitをインストールした場合のウイルススキャンも行ってみよう。今度はVine Linux 2.1.5にt0rnkit v.6.66というrootkitをインストールしてスキャンを行った結果だ。

■定義ファイルのあるrootkitをインストールしたシステムをウイルススキャン
●Sophos Anti-Virusでスキャン
# sweep -all /
SWEEP virus detection utility
Version 3.66, February 2003 [Linux/Intel]
Includes detection for 79532 viruses, trojans and worms
Copyright (c) 1989,2003 Sophos Plc, www.sophos.com
System time 17:04:39, System date 14 February 2003
Command line qualifiers are: -all
Quick Sweeping
Could not open /usr/X11R6/lib/X11/XF86Config
>>> Virus 'Troj/T0rn-Kit' found in file /usr/bin/du
>>> Virus 'Troj/T0rn-Kit' found in file /usr/bin/top
>>> Virus 'Troj/T0rn-Kit' found in file /usr/bin/find
Could not open /usr/lib/groff/tmac/tmac.gmse
Could not open /usr/lib/libtclx.so
Could not open /usr/lib/libtkx.so
Could not open /usr/man/man1/fetchmailconf.1.gz
>>> Virus 'Troj/T0rn-Kit' found in file /usr/sbin/nscd
>>> Virus 'Troj/T0rn-Kit' found in file /usr/sbin/in.fingerd
Could not open /usr/src/linux-2.2.18/pcmcia-cs-3.1.22/include/linux/version.h
>>> Virus 'Troj/T0rn-Kit' found in file /usr/src/.puta/t0rns
>>> Virus 'Troj/T0rn-Kit' found in file /usr/src/.puta/t0rnp
>>> Virus 'Troj/T0rn-Kit' found in file /usr/src/.puta/t0rnsb
Could not open /etc/aliases.db
>>> Virus 'Troj/T0rn-Kit' found in file /bin/ls
>>> Virus 'Troj/T0rn-Kit' found in file /bin/ps
>>> Virus 'Troj/T0rn-Kit' found in file /bin/netstat
>>> Virus 'Troj/T0rn-Kit' found in file /sbin/ifconfig
41914 files swept in 4 minutes and 39 seconds.
7 errors were encountered.
12 viruses were discovered.
12 files out of 41914 were infected.
Please send infected samples to Sophos for analysis.
For advice consult www.sophos.com, email support@sophos.com
or telephone +44 1235 559933
End of Sweep.

●AntiVir for Linuxでスキャン
# antivir --allfiles -s /*
AntiVir / Linux Version 2.0.6-10
Copyright (C) 1994-2002 by H+BEDV Datentechnik GmbH.
All rights reserved.
Loading /usr/lib/AntiVir/antivir.vdf ...                             
AntiVir is running in DEMO mode.                                     
VDF version: 6.18.0.4 created 27 Jan 2003                            
checking drive/path (list): /bin                                     
/bin/ls                                                              
 Date: 16.01.2001  Time: 00:48:41  Size: 39484                       
 ALERT: [Linux/LionWorm.A02 virus] /bin/ls <<< Contains signature of the Linux virus Linux/LionWorm.A02
/bin/ps                                                              
 Date: 16.01.2001  Time: 00:37:25  Size: 31336                       
 ALERT: [Linux/LionWorm.A08 virus] /bin/ps <<< Contains signature of the Linux virus Linux/LionWorm.A08
/bin/login                                                           
 Date: 14.02.2003  Time: 16:55:31  Size: 20452                       
 ALERT: [Linux/LionWorm.A06 virus] /bin/login <<< Contains signature of the Linux virus Linux/LionWorm.A06
/bin/netstat                                                         
 Date: 23.05.2000  Time: 21:14:32  Size: 53364                       
 ALERT: [Linux/LionWorm.A07 virus] /bin/netstat <<< Contains signature of the Linux virus Linux/LionWorm.A07
checking drive/path (list): /boot                                    
checking drive/path (list): /dev                                     
checking drive/path (list): /etc                                     
checking drive/path (list): /home                                    
checking drive/path (list): /lib                                     
checking drive/path (list): /lost+found                              
checking drive/path (list): /misc                                    
checking drive/path (list): /mnt                                     
checking drive/path (list): /opt                                     
checking drive/path (list): /proc                                    
checking drive/path (list): /root                                    
checking drive/path (list): /sbin                                    
/sbin/ifconfig                                                       
 Date: 23.05.2000  Time: 21:14:32  Size: 32728                       
 ALERT: [Linux/LionWorm.A09 virus] /sbin/ifconfig <<< Contains signature of the Linux virus Linux/LionWorm.A09
checking drive/path (list): /tmp                                     
checking drive/path (list): /usr                                     
/usr/bin/du                                                          
 Date: 16.01.2001  Time: 00:48:41  Size: 22460                       
 ALERT: [Linux/LionWorm.A03 virus] /usr/bin/du <<< Contains signature of the Linux virus Linux/LionWorm.A03
/usr/bin/top                                                         
 Date: 16.01.2001  Time: 00:37:27  Size: 266140                      
 ALERT: [Linux/LionWorm.A13 virus] /usr/bin/top <<< Contains signature of the Linux virus Linux/LionWorm.A13
/usr/bin/find                                                        
 Date: 22.11.2000  Time: 08:38:30  Size: 57452                       
 ALERT: [Linux/LionWorm.A01 virus] /usr/bin/find <<< Contains signature of the Linux virus Linux/LionWorm.A01
/usr/sbin/nscd                                                       
 Date: 25.07.2000  Time: 16:09:55  Size: 201552                      
 ALERT: [Linux/LionWorm.A12 virus] /usr/sbin/nscd <<< Contains signature of the Linux virus Linux/LionWorm.A12
/usr/sbin/in.fingerd                                                 
 Date: 23.08.2000  Time: 03:28:03  Size: 6408                        
 ALERT: [Linux/LionWorm.A10 virus] /usr/sbin/in.fingerd <<< Contains signature of the Linux virus Linux/LionWorm.A10
/usr/src/.puta/t0rns                                                 
 Date: 23.08.2000  Time: 10:42:58  Size: 6948                        
 ALERT: [Linux/LionWorm.A05 virus] /usr/src/.puta/t0rns <<< Contains signature of the Linux virus Linux/LionWorm.A05
/usr/src/.puta/t0rnp                                                 
 Date: 22.08.2000  Time: 02:22:18  Size: 7578                        
 ALERT: [Linux/LionWorm.A15 virus] /usr/src/.puta/t0rnp <<< Contains signature of the Linux virus Linux/LionWorm.A15
/usr/src/.puta/t0rnsb                                                
 Date: 10.09.1999  Time: 00:57:11  Size: 1345                        
 ALERT: [Linux/LionWorm.A16 virus] /usr/src/.puta/t0rnsb <<< Contains signature of the Linux virus Linux/LionWorm.A16
checking drive/path (list): /var                                     
----- scan results -----                                             
 directories:     3073                                               
       files:    56276                                               
      alerts:       13                                               
    repaired:        0                                               
     deleted:        0                                               
     renamed:        0                                               
   scan time: 00:04:58                                               
------------------------                                             
Thank you for using AntiVir.

 どちらのアンチウイルスソフトでもt0rnkitが検出されていることがわかるだろう。ちなみにAntiVir for Linuxの方ではt0rnkitではなくLionWornで検出されているが、これは誤検出ではなく、LionWornにはt0rnkitが組み込まれているためだ(後述するlionWornのファイル群を見てほしい)。

 今回はtuxkitおよびt0rnkitをインストールしたシステムでのスキャンを行ってみたが、結果を見てわかるように、アンチウイルスソフトの場合、当たり前の事を言うようだが、定義ファイルがなければ、改ざんが検出されることはない。定義ファイルのある既知のトロイの木馬やワームの検出は可能だが、それ以外は検出されることがないというのは、chkrootkitなどと同じだ。

●LionWormのファイル群
# less lion.tgz
drwxr-xr-x root/root         0 2001-02-26 08:31:51 lib/
drwxr-xr-x root/root         0 2001-02-26 09:46:52 lib/scan/
-rwxr-xr-x root/root       122 2001-02-26 09:46:39 lib/scan/1i0n.sh
-rwxr-xr-x root/root        85 2001-02-21 12:22:10 lib/scan/hack.sh
-rwxrwxr-x root/root     19033 2001-02-26 09:43:52 lib/scan/bind
-rwxr-xr-x root/root     12331 2001-01-12 13:34:33 lib/scan/randb
-rwxr-xr-x root/root        70 2001-02-21 12:22:44 lib/scan/scan.sh
-rwxr-xr-x root/root     15715 2001-02-19 04:35:29 lib/scan/pscan
-rwxr-xr-x root/root       114 2001-02-21 12:22:59 lib/scan/star.sh
-rwxr-xr-x root/root        40 2001-02-21 12:21:50 lib/scan/bindx.sh
-rw-rw-r-- root/root         0 2001-02-26 09:45:08 lib/scan/bindname.l
og
-rwxr-xr-x root/root        53 2001-02-26 06:30:17 lib/1i0n.sh
drwx------ root/root         0 2001-02-26 06:49:27 lib/lib/
-rwxr-xr-x root/root     53364 2000-02-28 02:44:41 lib/lib/netstat
drwxr-xr-x root/root         0 2001-02-21 03:43:41 lib/lib/dev/
-rw-r--r-- xd_zhao/xd_zhao  75 2001-02-26 06:23:51 lib/lib/dev/.1addr
-rw-r--r-- xd_zhao/xd_zhao  34 2001-02-21 10:21:10 lib/lib/dev/.1logz
-rw-r--r-- xd_zhao/xd_zhao 158 2001-02-26 06:26:55 lib/lib/dev/.1proc
-rw-r--r-- xd_zhao/xd_zhao 117 2001-02-26 06:25:08 lib/lib/dev/.1file
-rwxr-xr-x root/root      6948 2000-02-28 02:44:41 lib/lib/t0rns
-rwxr-xr-x root/root     22460 2000-02-28 02:44:41 lib/lib/du
-rwxr-xr-x root/root     39484 2000-02-28 02:44:41 lib/lib/ls
-rwxr-xr-x root/root      1345 2000-02-28 02:44:41 lib/lib/t0rnsb
-rwxr-xr-x root/root     31336 2000-02-28 02:44:41 lib/lib/ps
-rwxr-xr-x root/root      7578 2000-02-28 02:44:41 lib/lib/t0rnp
-rwxr-xr-x root/root     57452 2000-02-28 02:44:41 lib/lib/find
-rwxr-xr-x root/root     32728 2000-02-28 02:44:41 lib/lib/ifconfig
-rwxr-xr-x root/root      4568 2000-02-28 02:44:41 lib/lib/pg
-rw-r--r-- root/root    100424 2000-02-28 02:44:41 lib/lib/ssh.tgz
-rwxr-xr-x root/root    266140 2000-02-28 02:44:41 lib/lib/top
-rwxr-xr-x root/root      1382 2000-02-28 02:44:41 lib/lib/sz
-rwxr-xr-x root/root      3964 2000-02-28 02:44:41 lib/lib/login
-rwxr-xr-x root/root      6408 2000-02-28 02:44:41 lib/lib/in.fingerd
-rwxr-xr-x root/root      8445 2001-02-26 07:12:08 lib/lib/1i0n.sh
-rwxr-xr-x root/root     13184 2000-02-28 02:44:41 lib/lib/pstree
-rwxr-xr-x root/root     35100 2000-02-28 02:44:41 lib/lib/in.telnetd
-rwxr-xr-x root/root     16634 2000-02-28 02:44:41 lib/lib/mjy
-rwsr-xr-x root/root     11934 2000-02-28 02:44:41 lib/lib/sush
-rwxr-xr-x root/root     33820 2000-02-28 02:44:41 lib/lib/tfn
-rwxr-xr-x root/root     19085 2000-02-28 02:44:41 lib/lib/name
-rwxr-xr-x root/root       886 2001-02-26 06:48:32 lib/lib/getip.sh 

rootkitのチェックは多重にかけるのがベスト

 今回はrootkitの検出手段として、chkrootkit、RootkID、アンチウイルスソフトの3種類による検出を見てきた。すべてにおいて言えることは、既知のrootkitは検出できるが、新しいタイプのrootkitがインストールされた場合には検出することが困難であるということだ。しかし無差別に侵入を行うようなクラッカーは、既知のrootkitやそれを改変したものを利用することが多く、今回紹介したツールを利用して検出できる可能性もある。どのツールも導入自体は難しい部分もないので、定期的に検査を行っておくといいだろう。また、rootkit検出ツールとアンチウイルスソフト、「Tripwireによるファイル改ざんの検知」で紹介したTripwireなどのファイルチェッカーを併用するなど、多重のチェックをかけておくのがベストだろう。

 また、これまで取り上げてきたrootkt(tuxkitとt0rnkit)は、単純に既知のコマンドファイルを改ざんする「Application Rootkit」と呼ばれるもので、rootkitにはこれ以外に「Kernel Rootkit」と呼ばれるタイプのものもある。これについては「Tripwireを運用するときの注意点」でも簡単に解説しているが、次回からはrootkitの概要としてこのKernel Rootkitについても取り上げていく予定だ。


バックナンバー

第5回 kernel rootkitの概要
[2003.6.10 UP] 今回から解説する「kernel rootkit」は、ps、ls、netstatなどのコマンド類は改変せずに、Application rootkitと同じように、クラッカー側にとって必要な機能(バックドア、ファイル・プロセスの隠蔽など)を提供するものだ。このためApplication rootkitに比べて管理者からの発見を逃れられる可能性が高い。その概要について解説しよう。

第4回 rootkitを利用した侵入
[2003.3.28 UP]  kernel rootkitの解説に移る前に、今回はクラッカーがシステムに侵入し、rootkitをインストールするまでの流れを見ながら、一般的なクラッカーがどのようにしてシステムに侵入し、なぜrootkitを用いるのかについて考えてみよう。

第3回 rootkit検出ツールによる検査
[2003.3.11 UP] これまではrootkitの概要について実例を出して説明してきたが、今回はrootkitの検出ツールを利用して、rootkitのインストールされたシステムから、rootkitを洗い出す作業を行ってみよう。

第2回 ログファイルの改ざん
[2003.2.12 UP] 第1回では、Linuxのrootkitの中からtuxkitを取り上げ、その概要として改ざんされたシステムコマンド一部を紹介した。今回はその続きとして改ざんされたsyslogdと、ログファイルの改ざんなどについて見ていこう。

第1回 rootkitの概要と検知
[2003.1.15 UP] システムをクラックする手段として「rootkit」というツールが存在する。ほとんどのrootkitはインストーラー形式になっており、簡単かつ短時間で改ざん作業を完了できるようになっている。攻撃者が利用するrootkitについて、その概要を知るとともに、防御方法について考えていこう。

前のページ | 1 2 3 4 5 6 |      

[TTS,ITmedia]