查看: 427|回复: 2

rootkit的检测工具使用(chkrootkit和rootkit hunter)

 关闭 [复制链接]

签到天数: 2090 天

连续签到: 2 天

[LV.Master]伴坛终老IIII

发表于 2009-5-29 13:37 | 显示全部楼层 |阅读模式
rootkit的检测工具使用(chkrootkit和rootkit hunter)
这两天突然发现我们的服务器产生大量DNS解析连线。为了查明问题,就下载网上找工具检查问题所在。用了两个工具,一个chkrootkit,另外一个rootkit huntur。在使用了这两个产品后,觉得rootkit的信息更加详细一些。现在就对两个工具的操作和使用写一个记录,也方便之后自己查看。

1. chkrootkit的使用
project: http://www.chkrootkit.org
download: ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz

1.1 解压安装
#tar -zxvf chkrootkit.tar.gz
#make sense

1.2 运行监测
#./chkrootkit
运行结果在
http://blogimg.chinaunix.net/blog/upfile2/090326111017.pdf
判断有问题的信息如下:
Checking `ifconfig'... INFECTED
Checking `ls'... INFECTED
Checking `netstat'... INFECTED
Checking `ps'... INFECTED
Checking `top'... INFECTED
Searching for Madalin rootkit default files... Possible Madalin rootkit installed
Checking `bindshell'... INFECTED (PORTS:145)
Checking `lkm'... You have77 process hidden for readdir command
You have77 process hidden for ps command
chkproc: Warning: Possible LKM Trojan installed
Checking `sniffer'... eth0: PROMISC

不幸中招,系统只能够重新安装了。在看了这个文档之后,对chkrootkit这个工具又看了一些其他资料。可以做rootkit的自动检查操作
具体可以看 http://www.centospub.com/make/chkrootkit.html

1.3 chkrootkit参数说明
Usage: ./chkrootkit [options] [test ...]
Options:
-h显示帮助信息
-V显示版本信息
-l显示测试内容
-ddebug模式,显示检测过程的相关指令程序
-q安静模式,只显示有问题部分,
-x高级模式,显示所有检测结果
-r dir设定指定的目录为根目录
-p dir1:dir2:dirN 检测指定目录
-n跳过NFS连接的目录



2. rootkit hunter的使用
Project: http://www.rootkit.nl/projects/rootkit_hunter.html
download: http://downloads.sourceforge.net ... gz?use_mirror=jaist

2.1 解压安装
解压
#tar -zxvf rkhunter-1.3.4.tar.gz
安装
#cd rkhunter-1.3.4
#./installer.sh -h
Usage: ./installer.sh <parameters>
Ordered valid parameters:
--help (-h): 显示帮助
--examples : 显示安装实例
--layout <value> : 选择安装模板(安装必选参数).
模板选择:
- default: (FHS compliant),
- /usr,
- /usr/local,
- oldschool: 之前版本安装路径,
- custom: 自定义安装路径,
- RPM: for building RPM&#39;s. Requires $RPM_BUILD_ROOT.
- DEB: for building DEB&#39;s. Requires $DEB_BUILD_ROOT.
--striproot: Strip path from custom layout (for package maintainers).
--install: 根据选择目录安装
--show : 显示安装路径
--remove : 卸载rkhunter
--version: 显示安装版本


我使用的安装指令
#./installer.sh --layout default --install

2.2 rkhunter操作
#/usr/local/bin/rkhunter --propupd
#/usr/local/bin/rkhunter -c --sk -rwo

Warning: File &#39;/bin/awk&#39; has the immutable-bit set.
Warning: File &#39;/bin/basename&#39; has the immutable-bit set.
Warning: File &#39;/bin/bash&#39; has the immutable-bit set.
Warning: File &#39;/bin/cat&#39; has the immutable-bit set.
Warning: File &#39;/bin/chmod&#39; has the immutable-bit set.
Warning: File &#39;/bin/chown&#39; has the immutable-bit set.
Warning: File &#39;/bin/cp&#39; has the immutable-bit set.
Warning: File &#39;/bin/csh&#39; has the immutable-bit set.
Warning: File &#39;/bin/cut&#39; has the immutable-bit set.
Warning: File &#39;/bin/date&#39; has the immutable-bit set.
Warning: File &#39;/bin/df&#39; has the immutable-bit set.
Warning: File &#39;/bin/dmesg&#39; has the immutable-bit set.
Warning: File &#39;/bin/echo&#39; has the immutable-bit set.
Warning: File &#39;/bin/ed&#39; has the immutable-bit set.
Warning: File &#39;/bin/egrep&#39; has the immutable-bit set.
Warning: File &#39;/bin/env&#39; has the immutable-bit set.
Warning: File &#39;/bin/fgrep&#39; has the immutable-bit set.
Warning: File &#39;/bin/grep&#39; has the immutable-bit set.
Warning: File &#39;/bin/kill&#39; has the immutable-bit set.
Warning: File &#39;/bin/login&#39; has the immutable-bit set.
Warning: File &#39;/bin/ls&#39; has the immutable-bit set.
Warning: File &#39;/bin/mail&#39; has the immutable-bit set.
Warning: File &#39;/bin/mktemp&#39; has the immutable-bit set.
Warning: File &#39;/bin/more&#39; has the immutable-bit set.
Warning: File &#39;/bin/mount&#39; has the immutable-bit set.
Warning: File &#39;/bin/mv&#39; has the immutable-bit set.
Warning: File &#39;/bin/netstat&#39; has the immutable-bit set.
Warning: File &#39;/bin/ps&#39; has the immutable-bit set.
Warning: File &#39;/bin/pwd&#39; has the immutable-bit set.
Warning: File &#39;/bin/rpm&#39; has the immutable-bit set.
Warning: File &#39;/bin/sed&#39; has the immutable-bit set.
Warning: File &#39;/bin/sh&#39; has the immutable-bit set.
Warning: File &#39;/bin/sort&#39; has the immutable-bit set.
Warning: File &#39;/bin/su&#39; has the immutable-bit set.
Warning: File &#39;/bin/touch&#39; has the immutable-bit set.
Warning: File &#39;/bin/uname&#39; has the immutable-bit set.
Warning: File &#39;/bin/gawk&#39; has the immutable-bit set.
Warning: File &#39;/bin/tcsh&#39; has the immutable-bit set.
Warning: File &#39;/usr/bin/awk&#39; has the immutable-bit set.
Warning: File &#39;/usr/bin/cut&#39; has the immutable-bit set.
Warning: File &#39;/usr/bin/env&#39; has the immutable-bit set.
Warning: The command &#39;/usr/bin/GET&#39; has been replaced by a script: /usr/bin/GET: perl script text executable
Warning: The command &#39;/usr/bin/groups&#39; has been replaced by a script: /usr/bin/groups: Bourne shell script text executable
Warning: File &#39;/usr/bin/kill&#39; has the immutable-bit set.
Warning: The command &#39;/usr/bin/ldd&#39; has been replaced by a script: /usr/bin/ldd: Bourne shell script text executable
Warning: File &#39;/usr/bin/top&#39; has the immutable-bit set.
Warning: The command &#39;/usr/bin/whatis&#39; has been replaced by a script: /usr/bin/whatis: Bourne shell script text executable
Warning: File &#39;/usr/bin/gawk&#39; has the immutable-bit set.
Warning: File &#39;/sbin/chkconfig&#39; has the immutable-bit set.
Warning: File &#39;/sbin/depmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/fuser&#39; has the immutable-bit set.
Warning: File &#39;/sbin/ifconfig&#39; has the immutable-bit set.
Warning: File &#39;/sbin/ifdown&#39; has the immutable-bit set.
Warning: The command &#39;/sbin/ifdown&#39; has been replaced by a script: /sbin/ifdown: Bourne-Again shell script text executable
Warning: File &#39;/sbin/ifup&#39; has the immutable-bit set.
Warning: The command &#39;/sbin/ifup&#39; has been replaced by a script: /sbin/ifup: Bourne-Again shell script text executable
Warning: File &#39;/sbin/init&#39; has the immutable-bit set.
Warning: File &#39;/sbin/insmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/ip&#39; has the immutable-bit set.
Warning: File &#39;/sbin/lsmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/modinfo&#39; has the immutable-bit set.
Warning: File &#39;/sbin/modprobe&#39; has the immutable-bit set.
Warning: File &#39;/sbin/nologin&#39; has the immutable-bit set.
Warning: File &#39;/sbin/rmmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/runlevel&#39; has the immutable-bit set.
Warning: File &#39;/sbin/sulogin&#39; has the immutable-bit set.
Warning: File &#39;/sbin/sysctl&#39; has the immutable-bit set.
Warning: File &#39;/sbin/syslogd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/adduser&#39; has the immutable-bit set.
Warning: No hash value found for file &#39;/usr/sbin/amd&#39; in the rkhunter.dat file.
Warning: File &#39;/usr/sbin/amd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/chroot&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/groupadd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/groupdel&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/groupmod&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/grpck&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/kudzu&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/lsof&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/prelink&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/pwck&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/sestatus&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/tcpd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/useradd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/userdel&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/usermod&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/vipw&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/xinetd&#39; has the immutable-bit set.
Warning: Dreams Rootkit [ Warning ]
File &#39;/usr/bin/sense&#39; found
File &#39;/usr/bin/sl2&#39; found
File &#39;/usr/bin/(swapd)&#39; found
Warning: Checking for possible rootkit strings[ Warning ]
Found string &#39;/dev/ttyoa&#39; in file &#39;/bin/netstat&#39;. Possible rootkit: Sin Rootkit
Warning: Found possible sniffer log file: /usr/lib/libice.log
Warning: Found enabled xinetd service: /etc/xinetd.d/auth
Warning: Found enabled xinetd service: /etc/xinetd.d/cups-lpd
Warning: Found enabled xinetd service: /etc/xinetd.d/swat
Warning: Found enabled xinetd service: /etc/xinetd.d/vmware-authd
Warning: Possible promiscuous interfaces:
&#39;ifconfig&#39; command output:
&#39;ip&#39; command output: eth0
Warning: Account &#39;test&#39; is root equivalent (UID = 0)
Warning: Account &#39;james&#39; is root equivalent (UID = 0)
Warning: Account &#39;master&#39; is root equivalent (UID = 0)
Warning: Account &#39;admin&#39; is root equivalent (UID = 0)
Warning: The SSH configuration option &#39;PermitRootLogin&#39; has not been set.
The default value may be &#39;yes&#39;, to allow root access.
Warning: The SSH configuration option &#39;Protocol&#39; has not been set.
The default value may be &#39;2,1&#39;, to allow the use of protocol version 1.
Warning: Hidden file found: /usr/share/man/man1/..1.gz: gzip compressed data, from Unix, max compression
Warning: Application &#39;exim&#39;, version &#39;4.43&#39;, is out of date, and possibly a security risk.
Warning: Application &#39;gpg&#39;, version &#39;1.2.6&#39;, is out of date, and possibly a security risk.
Warning: Application &#39;openssl&#39;, version &#39;0.9.7a&#39;, is out of date, and possibly a security risk.
Warning: Application &#39;php&#39;, version &#39;4.3.9&#39;, is out of date, and possibly a security risk.
One or more warnings have been found while checking the system.
Please check the log file (/var/log/rkhunter.log)

结果就是“中招”,基本上就是重新安装系统的命了。不过从检查的结果来看,可以判断所中的rootkit的类型和被替换的系统文件。同时对一些程序版本进行检测,提供的信息比较多。

2.3 指令参数说明
#/usr/local/bin/rkhunter
Usage: rkhunter {--check | --update | --versioncheck |
--propupd [{filename | directory | package name},...] |
--list [{tests | {lang | languages} | rootkits},...] |
--version | --help} [options]

Current options are:
--append-log在日志文件后追加日志,而不覆盖原有日志
--bindir <directory>... Use the specified command directories
-c, --check 检测当前系统
--cs2, --color-set2Use the second color set for output
--configfile <file> 使用特定的配置文件
--cronjob 作为cron定期运行
(包含参数 -c, --sk , --nocolors )
--dbdir <directory> Use the specified database directory
--debug Debug模式(不要使用除非要求使用)
--disable <test>[,<test>...]跳过指定检查对象(默认为无)
--display-logfile 在最后显示日志文件内容
--enable<test>[,<test>...]对指定检测对象进行检查
(默认检测所有对象)
--hash {MD5 | SHA1 | NONE | 使用指定的文件哈希函数
<command>}(Default is SHA1)
-h, --help显示帮助菜单
--lang, --language <language> 指定使用的语言
(Default is English)
--list [tests | languages | 罗列测试对象明朝,使用语言,可检测的木马程序
rootkits]
-l, --logfile [file]写到指定的日志文件名
(Default is /var/log/rkhunter.log)
--noappend-log不追加日志,直接覆盖日志文件
--nocolors输出只显示黑白两色
--nolog 不写入日志文件
--nomow, --no-mail-on-warning如果有警告信息,不发送邮件
--ns, --nosummary 不显示检查结果的统计数据
--novl, --no-verbose-logging不显示详细记录
--pkgmgr {RPM | DPKG | BSD |使用特定的包管理用于文件的哈希值验证
NONE} (Default is NONE)
--propupd [file | directory | 更新整个文件属性数据库或仅仅更新指定条目
package]...
-q, --quiet 安静模式(no output at all)
--rwo, --report-warnings-only只显示警告信息
-r, --rootdir <directory> 使用指定的root目录
--sk, --skip-keypress 自动完成所有检测,跳过键盘输入
--summary 显示检测结果的统计信息
(This is the default)
--syslog [facility.priority]记录检测启动和结束时间到系统日志中
(Default level is authpriv.notice)
--tmpdir <directory>使用指定的临时目录
--update检测更新内容
--vl, --verbose-logging 使用详细日志记录 (on by default)
-V, --version 显示版本信息
--versioncheck检测最新版本
-x, --autox 当X在使用时,自动启动检测
-X, --no-autox当X在使用时,不自启检测
PCOS系统下载站:http://zhuangji.wang

签到天数: 2090 天

连续签到: 2 天

[LV.Master]伴坛终老IIII

 楼主| 发表于 2009-5-29 13:37 | 显示全部楼层

rootkit的检测工具使用(chkrootkit和rootkit hunter)

rootkit的检测工具使用(chkrootkit和rootkit hunter)
这两天突然发现我们的服务器产生大量DNS解析连线。为了查明问题,就下载网上找工具检查问题所在。用了两个工具,一个chkrootkit,另外一个rootkit huntur。在使用了这两个产品后,觉得rootkit的信息更加详细一些。现在就对两个工具的操作和使用写一个记录,也方便之后自己查看。

1. chkrootkit的使用
project: http://www.chkrootkit.org
download: ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz

1.1 解压安装
#tar -zxvf chkrootkit.tar.gz
#make sense

1.2 运行监测
#./chkrootkit
运行结果在
http://blogimg.chinaunix.net/blog/upfile2/090326111017.pdf
判断有问题的信息如下:
Checking `ifconfig&#39;... INFECTED
Checking `ls&#39;... INFECTED
Checking `netstat&#39;... INFECTED
Checking `ps&#39;... INFECTED
Checking `top&#39;... INFECTED
Searching for Madalin rootkit default files... Possible Madalin rootkit installed
Checking `bindshell&#39;... INFECTED (PORTS:145)
Checking `lkm&#39;... You have77 process hidden for readdir command
You have77 process hidden for ps command
chkproc: Warning: Possible LKM Trojan installed
Checking `sniffer&#39;... eth0: PROMISC

不幸中招,系统只能够重新安装了。在看了这个文档之后,对chkrootkit这个工具又看了一些其他资料。可以做rootkit的自动检查操作
具体可以看 http://www.centospub.com/make/chkrootkit.html

1.3 chkrootkit参数说明
Usage: ./chkrootkit [options] [test ...]
Options:
-h显示帮助信息
-V显示版本信息
-l显示测试内容
-ddebug模式,显示检测过程的相关指令程序
-q安静模式,只显示有问题部分,
-x高级模式,显示所有检测结果
-r dir设定指定的目录为根目录
-p dir1:dir2:dirN 检测指定目录
-n跳过NFS连接的目录



2. rootkit hunter的使用
Project: http://www.rootkit.nl/projects/rootkit_hunter.html
download: http://downloads.sourceforge.net ... gz?use_mirror=jaist

2.1 解压安装
解压
#tar -zxvf rkhunter-1.3.4.tar.gz
安装
#cd rkhunter-1.3.4
#./installer.sh -h
Usage: ./installer.sh <parameters>
Ordered valid parameters:
--help (-h): 显示帮助
--examples : 显示安装实例
--layout <value> : 选择安装模板(安装必选参数).
模板选择:
- default: (FHS compliant),
- /usr,
- /usr/local,
- oldschool: 之前版本安装路径,
- custom: 自定义安装路径,
- RPM: for building RPM&#39;s. Requires $RPM_BUILD_ROOT.
- DEB: for building DEB&#39;s. Requires $DEB_BUILD_ROOT.
--striproot: Strip path from custom layout (for package maintainers).
--install: 根据选择目录安装
--show : 显示安装路径
--remove : 卸载rkhunter
--version: 显示安装版本


我使用的安装指令
#./installer.sh --layout default --install

2.2 rkhunter操作
#/usr/local/bin/rkhunter --propupd
#/usr/local/bin/rkhunter -c --sk -rwo

Warning: File &#39;/bin/awk&#39; has the immutable-bit set.
Warning: File &#39;/bin/basename&#39; has the immutable-bit set.
Warning: File &#39;/bin/bash&#39; has the immutable-bit set.
Warning: File &#39;/bin/cat&#39; has the immutable-bit set.
Warning: File &#39;/bin/chmod&#39; has the immutable-bit set.
Warning: File &#39;/bin/chown&#39; has the immutable-bit set.
Warning: File &#39;/bin/cp&#39; has the immutable-bit set.
Warning: File &#39;/bin/csh&#39; has the immutable-bit set.
Warning: File &#39;/bin/cut&#39; has the immutable-bit set.
Warning: File &#39;/bin/date&#39; has the immutable-bit set.
Warning: File &#39;/bin/df&#39; has the immutable-bit set.
Warning: File &#39;/bin/dmesg&#39; has the immutable-bit set.
Warning: File &#39;/bin/echo&#39; has the immutable-bit set.
Warning: File &#39;/bin/ed&#39; has the immutable-bit set.
Warning: File &#39;/bin/egrep&#39; has the immutable-bit set.
Warning: File &#39;/bin/env&#39; has the immutable-bit set.
Warning: File &#39;/bin/fgrep&#39; has the immutable-bit set.
Warning: File &#39;/bin/grep&#39; has the immutable-bit set.
Warning: File &#39;/bin/kill&#39; has the immutable-bit set.
Warning: File &#39;/bin/login&#39; has the immutable-bit set.
Warning: File &#39;/bin/ls&#39; has the immutable-bit set.
Warning: File &#39;/bin/mail&#39; has the immutable-bit set.
Warning: File &#39;/bin/mktemp&#39; has the immutable-bit set.
Warning: File &#39;/bin/more&#39; has the immutable-bit set.
Warning: File &#39;/bin/mount&#39; has the immutable-bit set.
Warning: File &#39;/bin/mv&#39; has the immutable-bit set.
Warning: File &#39;/bin/netstat&#39; has the immutable-bit set.
Warning: File &#39;/bin/ps&#39; has the immutable-bit set.
Warning: File &#39;/bin/pwd&#39; has the immutable-bit set.
Warning: File &#39;/bin/rpm&#39; has the immutable-bit set.
Warning: File &#39;/bin/sed&#39; has the immutable-bit set.
Warning: File &#39;/bin/sh&#39; has the immutable-bit set.
Warning: File &#39;/bin/sort&#39; has the immutable-bit set.
Warning: File &#39;/bin/su&#39; has the immutable-bit set.
Warning: File &#39;/bin/touch&#39; has the immutable-bit set.
Warning: File &#39;/bin/uname&#39; has the immutable-bit set.
Warning: File &#39;/bin/gawk&#39; has the immutable-bit set.
Warning: File &#39;/bin/tcsh&#39; has the immutable-bit set.
Warning: File &#39;/usr/bin/awk&#39; has the immutable-bit set.
Warning: File &#39;/usr/bin/cut&#39; has the immutable-bit set.
Warning: File &#39;/usr/bin/env&#39; has the immutable-bit set.
Warning: The command &#39;/usr/bin/GET&#39; has been replaced by a script: /usr/bin/GET: perl script text executable
Warning: The command &#39;/usr/bin/groups&#39; has been replaced by a script: /usr/bin/groups: Bourne shell script text executable
Warning: File &#39;/usr/bin/kill&#39; has the immutable-bit set.
Warning: The command &#39;/usr/bin/ldd&#39; has been replaced by a script: /usr/bin/ldd: Bourne shell script text executable
Warning: File &#39;/usr/bin/top&#39; has the immutable-bit set.
Warning: The command &#39;/usr/bin/whatis&#39; has been replaced by a script: /usr/bin/whatis: Bourne shell script text executable
Warning: File &#39;/usr/bin/gawk&#39; has the immutable-bit set.
Warning: File &#39;/sbin/chkconfig&#39; has the immutable-bit set.
Warning: File &#39;/sbin/depmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/fuser&#39; has the immutable-bit set.
Warning: File &#39;/sbin/ifconfig&#39; has the immutable-bit set.
Warning: File &#39;/sbin/ifdown&#39; has the immutable-bit set.
Warning: The command &#39;/sbin/ifdown&#39; has been replaced by a script: /sbin/ifdown: Bourne-Again shell script text executable
Warning: File &#39;/sbin/ifup&#39; has the immutable-bit set.
Warning: The command &#39;/sbin/ifup&#39; has been replaced by a script: /sbin/ifup: Bourne-Again shell script text executable
Warning: File &#39;/sbin/init&#39; has the immutable-bit set.
Warning: File &#39;/sbin/insmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/ip&#39; has the immutable-bit set.
Warning: File &#39;/sbin/lsmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/modinfo&#39; has the immutable-bit set.
Warning: File &#39;/sbin/modprobe&#39; has the immutable-bit set.
Warning: File &#39;/sbin/nologin&#39; has the immutable-bit set.
Warning: File &#39;/sbin/rmmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/runlevel&#39; has the immutable-bit set.
Warning: File &#39;/sbin/sulogin&#39; has the immutable-bit set.
Warning: File &#39;/sbin/sysctl&#39; has the immutable-bit set.
Warning: File &#39;/sbin/syslogd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/adduser&#39; has the immutable-bit set.
Warning: No hash value found for file &#39;/usr/sbin/amd&#39; in the rkhunter.dat file.
Warning: File &#39;/usr/sbin/amd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/chroot&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/groupadd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/groupdel&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/groupmod&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/grpck&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/kudzu&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/lsof&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/prelink&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/pwck&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/sestatus&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/tcpd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/useradd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/userdel&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/usermod&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/vipw&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/xinetd&#39; has the immutable-bit set.
Warning: Dreams Rootkit [ Warning ]
File &#39;/usr/bin/sense&#39; found
File &#39;/usr/bin/sl2&#39; found
File &#39;/usr/bin/(swapd)&#39; found
Warning: Checking for possible rootkit strings[ Warning ]
Found string &#39;/dev/ttyoa&#39; in file &#39;/bin/netstat&#39;. Possible rootkit: Sin Rootkit
Warning: Found possible sniffer log file: /usr/lib/libice.log
Warning: Found enabled xinetd service: /etc/xinetd.d/auth
Warning: Found enabled xinetd service: /etc/xinetd.d/cups-lpd
Warning: Found enabled xinetd service: /etc/xinetd.d/swat
Warning: Found enabled xinetd service: /etc/xinetd.d/vmware-authd
Warning: Possible promiscuous interfaces:
&#39;ifconfig&#39; command output:
&#39;ip&#39; command output: eth0
Warning: Account &#39;test&#39; is root equivalent (UID = 0)
Warning: Account &#39;james&#39; is root equivalent (UID = 0)
Warning: Account &#39;master&#39; is root equivalent (UID = 0)
Warning: Account &#39;admin&#39; is root equivalent (UID = 0)
Warning: The SSH configuration option &#39;PermitRootLogin&#39; has not been set.
The default value may be &#39;yes&#39;, to allow root access.
Warning: The SSH configuration option &#39;Protocol&#39; has not been set.
The default value may be &#39;2,1&#39;, to allow the use of protocol version 1.
Warning: Hidden file found: /usr/share/man/man1/..1.gz: gzip compressed data, from Unix, max compression
Warning: Application &#39;exim&#39;, version &#39;4.43&#39;, is out of date, and possibly a security risk.
Warning: Application &#39;gpg&#39;, version &#39;1.2.6&#39;, is out of date, and possibly a security risk.
Warning: Application &#39;openssl&#39;, version &#39;0.9.7a&#39;, is out of date, and possibly a security risk.
Warning: Application &#39;php&#39;, version &#39;4.3.9&#39;, is out of date, and possibly a security risk.
One or more warnings have been found while checking the system.
Please check the log file (/var/log/rkhunter.log)

结果就是“中招”,基本上就是重新安装系统的命了。不过从检查的结果来看,可以判断所中的rootkit的类型和被替换的系统文件。同时对一些程序版本进行检测,提供的信息比较多。

2.3 指令参数说明
#/usr/local/bin/rkhunter
Usage: rkhunter {--check | --update | --versioncheck |
--propupd [{filename | directory | package name},...] |
--list [{tests | {lang | languages} | rootkits},...] |
--version | --help} [options]

Current options are:
--append-log在日志文件后追加日志,而不覆盖原有日志
--bindir <directory>... Use the specified command directories
-c, --check 检测当前系统
--cs2, --color-set2Use the second color set for output
--configfile <file> 使用特定的配置文件
--cronjob 作为cron定期运行
(包含参数 -c, --sk , --nocolors )
--dbdir <directory> Use the specified database directory
--debug Debug模式(不要使用除非要求使用)
--disable <test>[,<test>...]跳过指定检查对象(默认为无)
--display-logfile 在最后显示日志文件内容
--enable<test>[,<test>...]对指定检测对象进行检查
(默认检测所有对象)
--hash {MD5 | SHA1 | NONE | 使用指定的文件哈希函数
<command>}(Default is SHA1)
-h, --help显示帮助菜单
--lang, --language <language> 指定使用的语言
(Default is English)
--list [tests | languages | 罗列测试对象明朝,使用语言,可检测的木马程序
rootkits]
-l, --logfile [file]写到指定的日志文件名
(Default is /var/log/rkhunter.log)
--noappend-log不追加日志,直接覆盖日志文件
--nocolors输出只显示黑白两色
--nolog 不写入日志文件
--nomow, --no-mail-on-warning如果有警告信息,不发送邮件
--ns, --nosummary 不显示检查结果的统计数据
--novl, --no-verbose-logging不显示详细记录
--pkgmgr {RPM | DPKG | BSD |使用特定的包管理用于文件的哈希值验证
NONE} (Default is NONE)
--propupd [file | directory | 更新整个文件属性数据库或仅仅更新指定条目
package]...
-q, --quiet 安静模式(no output at all)
--rwo, --report-warnings-only只显示警告信息
-r, --rootdir <directory> 使用指定的root目录
--sk, --skip-keypress 自动完成所有检测,跳过键盘输入
--summary 显示检测结果的统计信息
(This is the default)
--syslog [facility.priority]记录检测启动和结束时间到系统日志中
(Default level is authpriv.notice)
--tmpdir <directory>使用指定的临时目录
--update检测更新内容
--vl, --verbose-logging 使用详细日志记录 (on by default)
-V, --version 显示版本信息
--versioncheck检测最新版本
-x, --autox 当X在使用时,自动启动检测
-X, --no-autox当X在使用时,不自启检测
PCOS系统下载站:http://zhuangji.wang

签到天数: 2090 天

连续签到: 2 天

[LV.Master]伴坛终老IIII

 楼主| 发表于 2009-5-29 13:37 | 显示全部楼层

rootkit的检测工具使用(chkrootkit和rootkit hunter)

rootkit的检测工具使用(chkrootkit和rootkit hunter)
这两天突然发现我们的服务器产生大量DNS解析连线。为了查明问题,就下载网上找工具检查问题所在。用了两个工具,一个chkrootkit,另外一个rootkit huntur。在使用了这两个产品后,觉得rootkit的信息更加详细一些。现在就对两个工具的操作和使用写一个记录,也方便之后自己查看。

1. chkrootkit的使用
project: http://www.chkrootkit.org
download: ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz

1.1 解压安装
#tar -zxvf chkrootkit.tar.gz
#make sense

1.2 运行监测
#./chkrootkit
运行结果在
http://blogimg.chinaunix.net/blog/upfile2/090326111017.pdf
判断有问题的信息如下:
Checking `ifconfig&#39;... INFECTED
Checking `ls&#39;... INFECTED
Checking `netstat&#39;... INFECTED
Checking `ps&#39;... INFECTED
Checking `top&#39;... INFECTED
Searching for Madalin rootkit default files... Possible Madalin rootkit installed
Checking `bindshell&#39;... INFECTED (PORTS:145)
Checking `lkm&#39;... You have77 process hidden for readdir command
You have77 process hidden for ps command
chkproc: Warning: Possible LKM Trojan installed
Checking `sniffer&#39;... eth0: PROMISC

不幸中招,系统只能够重新安装了。在看了这个文档之后,对chkrootkit这个工具又看了一些其他资料。可以做rootkit的自动检查操作
具体可以看 http://www.centospub.com/make/chkrootkit.html

1.3 chkrootkit参数说明
Usage: ./chkrootkit [options] [test ...]
Options:
-h显示帮助信息
-V显示版本信息
-l显示测试内容
-ddebug模式,显示检测过程的相关指令程序
-q安静模式,只显示有问题部分,
-x高级模式,显示所有检测结果
-r dir设定指定的目录为根目录
-p dir1:dir2:dirN 检测指定目录
-n跳过NFS连接的目录



2. rootkit hunter的使用
Project: http://www.rootkit.nl/projects/rootkit_hunter.html
download: http://downloads.sourceforge.net ... gz?use_mirror=jaist

2.1 解压安装
解压
#tar -zxvf rkhunter-1.3.4.tar.gz
安装
#cd rkhunter-1.3.4
#./installer.sh -h
Usage: ./installer.sh <parameters>
Ordered valid parameters:
--help (-h): 显示帮助
--examples : 显示安装实例
--layout <value> : 选择安装模板(安装必选参数).
模板选择:
- default: (FHS compliant),
- /usr,
- /usr/local,
- oldschool: 之前版本安装路径,
- custom: 自定义安装路径,
- RPM: for building RPM&#39;s. Requires $RPM_BUILD_ROOT.
- DEB: for building DEB&#39;s. Requires $DEB_BUILD_ROOT.
--striproot: Strip path from custom layout (for package maintainers).
--install: 根据选择目录安装
--show : 显示安装路径
--remove : 卸载rkhunter
--version: 显示安装版本


我使用的安装指令
#./installer.sh --layout default --install

2.2 rkhunter操作
#/usr/local/bin/rkhunter --propupd
#/usr/local/bin/rkhunter -c --sk -rwo

Warning: File &#39;/bin/awk&#39; has the immutable-bit set.
Warning: File &#39;/bin/basename&#39; has the immutable-bit set.
Warning: File &#39;/bin/bash&#39; has the immutable-bit set.
Warning: File &#39;/bin/cat&#39; has the immutable-bit set.
Warning: File &#39;/bin/chmod&#39; has the immutable-bit set.
Warning: File &#39;/bin/chown&#39; has the immutable-bit set.
Warning: File &#39;/bin/cp&#39; has the immutable-bit set.
Warning: File &#39;/bin/csh&#39; has the immutable-bit set.
Warning: File &#39;/bin/cut&#39; has the immutable-bit set.
Warning: File &#39;/bin/date&#39; has the immutable-bit set.
Warning: File &#39;/bin/df&#39; has the immutable-bit set.
Warning: File &#39;/bin/dmesg&#39; has the immutable-bit set.
Warning: File &#39;/bin/echo&#39; has the immutable-bit set.
Warning: File &#39;/bin/ed&#39; has the immutable-bit set.
Warning: File &#39;/bin/egrep&#39; has the immutable-bit set.
Warning: File &#39;/bin/env&#39; has the immutable-bit set.
Warning: File &#39;/bin/fgrep&#39; has the immutable-bit set.
Warning: File &#39;/bin/grep&#39; has the immutable-bit set.
Warning: File &#39;/bin/kill&#39; has the immutable-bit set.
Warning: File &#39;/bin/login&#39; has the immutable-bit set.
Warning: File &#39;/bin/ls&#39; has the immutable-bit set.
Warning: File &#39;/bin/mail&#39; has the immutable-bit set.
Warning: File &#39;/bin/mktemp&#39; has the immutable-bit set.
Warning: File &#39;/bin/more&#39; has the immutable-bit set.
Warning: File &#39;/bin/mount&#39; has the immutable-bit set.
Warning: File &#39;/bin/mv&#39; has the immutable-bit set.
Warning: File &#39;/bin/netstat&#39; has the immutable-bit set.
Warning: File &#39;/bin/ps&#39; has the immutable-bit set.
Warning: File &#39;/bin/pwd&#39; has the immutable-bit set.
Warning: File &#39;/bin/rpm&#39; has the immutable-bit set.
Warning: File &#39;/bin/sed&#39; has the immutable-bit set.
Warning: File &#39;/bin/sh&#39; has the immutable-bit set.
Warning: File &#39;/bin/sort&#39; has the immutable-bit set.
Warning: File &#39;/bin/su&#39; has the immutable-bit set.
Warning: File &#39;/bin/touch&#39; has the immutable-bit set.
Warning: File &#39;/bin/uname&#39; has the immutable-bit set.
Warning: File &#39;/bin/gawk&#39; has the immutable-bit set.
Warning: File &#39;/bin/tcsh&#39; has the immutable-bit set.
Warning: File &#39;/usr/bin/awk&#39; has the immutable-bit set.
Warning: File &#39;/usr/bin/cut&#39; has the immutable-bit set.
Warning: File &#39;/usr/bin/env&#39; has the immutable-bit set.
Warning: The command &#39;/usr/bin/GET&#39; has been replaced by a script: /usr/bin/GET: perl script text executable
Warning: The command &#39;/usr/bin/groups&#39; has been replaced by a script: /usr/bin/groups: Bourne shell script text executable
Warning: File &#39;/usr/bin/kill&#39; has the immutable-bit set.
Warning: The command &#39;/usr/bin/ldd&#39; has been replaced by a script: /usr/bin/ldd: Bourne shell script text executable
Warning: File &#39;/usr/bin/top&#39; has the immutable-bit set.
Warning: The command &#39;/usr/bin/whatis&#39; has been replaced by a script: /usr/bin/whatis: Bourne shell script text executable
Warning: File &#39;/usr/bin/gawk&#39; has the immutable-bit set.
Warning: File &#39;/sbin/chkconfig&#39; has the immutable-bit set.
Warning: File &#39;/sbin/depmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/fuser&#39; has the immutable-bit set.
Warning: File &#39;/sbin/ifconfig&#39; has the immutable-bit set.
Warning: File &#39;/sbin/ifdown&#39; has the immutable-bit set.
Warning: The command &#39;/sbin/ifdown&#39; has been replaced by a script: /sbin/ifdown: Bourne-Again shell script text executable
Warning: File &#39;/sbin/ifup&#39; has the immutable-bit set.
Warning: The command &#39;/sbin/ifup&#39; has been replaced by a script: /sbin/ifup: Bourne-Again shell script text executable
Warning: File &#39;/sbin/init&#39; has the immutable-bit set.
Warning: File &#39;/sbin/insmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/ip&#39; has the immutable-bit set.
Warning: File &#39;/sbin/lsmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/modinfo&#39; has the immutable-bit set.
Warning: File &#39;/sbin/modprobe&#39; has the immutable-bit set.
Warning: File &#39;/sbin/nologin&#39; has the immutable-bit set.
Warning: File &#39;/sbin/rmmod&#39; has the immutable-bit set.
Warning: File &#39;/sbin/runlevel&#39; has the immutable-bit set.
Warning: File &#39;/sbin/sulogin&#39; has the immutable-bit set.
Warning: File &#39;/sbin/sysctl&#39; has the immutable-bit set.
Warning: File &#39;/sbin/syslogd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/adduser&#39; has the immutable-bit set.
Warning: No hash value found for file &#39;/usr/sbin/amd&#39; in the rkhunter.dat file.
Warning: File &#39;/usr/sbin/amd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/chroot&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/groupadd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/groupdel&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/groupmod&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/grpck&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/kudzu&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/lsof&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/prelink&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/pwck&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/sestatus&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/tcpd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/useradd&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/userdel&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/usermod&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/vipw&#39; has the immutable-bit set.
Warning: File &#39;/usr/sbin/xinetd&#39; has the immutable-bit set.
Warning: Dreams Rootkit [ Warning ]
File &#39;/usr/bin/sense&#39; found
File &#39;/usr/bin/sl2&#39; found
File &#39;/usr/bin/(swapd)&#39; found
Warning: Checking for possible rootkit strings[ Warning ]
Found string &#39;/dev/ttyoa&#39; in file &#39;/bin/netstat&#39;. Possible rootkit: Sin Rootkit
Warning: Found possible sniffer log file: /usr/lib/libice.log
Warning: Found enabled xinetd service: /etc/xinetd.d/auth
Warning: Found enabled xinetd service: /etc/xinetd.d/cups-lpd
Warning: Found enabled xinetd service: /etc/xinetd.d/swat
Warning: Found enabled xinetd service: /etc/xinetd.d/vmware-authd
Warning: Possible promiscuous interfaces:
&#39;ifconfig&#39; command output:
&#39;ip&#39; command output: eth0
Warning: Account &#39;test&#39; is root equivalent (UID = 0)
Warning: Account &#39;james&#39; is root equivalent (UID = 0)
Warning: Account &#39;master&#39; is root equivalent (UID = 0)
Warning: Account &#39;admin&#39; is root equivalent (UID = 0)
Warning: The SSH configuration option &#39;PermitRootLogin&#39; has not been set.
The default value may be &#39;yes&#39;, to allow root access.
Warning: The SSH configuration option &#39;Protocol&#39; has not been set.
The default value may be &#39;2,1&#39;, to allow the use of protocol version 1.
Warning: Hidden file found: /usr/share/man/man1/..1.gz: gzip compressed data, from Unix, max compression
Warning: Application &#39;exim&#39;, version &#39;4.43&#39;, is out of date, and possibly a security risk.
Warning: Application &#39;gpg&#39;, version &#39;1.2.6&#39;, is out of date, and possibly a security risk.
Warning: Application &#39;openssl&#39;, version &#39;0.9.7a&#39;, is out of date, and possibly a security risk.
Warning: Application &#39;php&#39;, version &#39;4.3.9&#39;, is out of date, and possibly a security risk.
One or more warnings have been found while checking the system.
Please check the log file (/var/log/rkhunter.log)

结果就是“中招”,基本上就是重新安装系统的命了。不过从检查的结果来看,可以判断所中的rootkit的类型和被替换的系统文件。同时对一些程序版本进行检测,提供的信息比较多。

2.3 指令参数说明
#/usr/local/bin/rkhunter
Usage: rkhunter {--check | --update | --versioncheck |
--propupd [{filename | directory | package name},...] |
--list [{tests | {lang | languages} | rootkits},...] |
--version | --help} [options]

Current options are:
--append-log在日志文件后追加日志,而不覆盖原有日志
--bindir <directory>... Use the specified command directories
-c, --check 检测当前系统
--cs2, --color-set2Use the second color set for output
--configfile <file> 使用特定的配置文件
--cronjob 作为cron定期运行
(包含参数 -c, --sk , --nocolors )
--dbdir <directory> Use the specified database directory
--debug Debug模式(不要使用除非要求使用)
--disable <test>[,<test>...]跳过指定检查对象(默认为无)
--display-logfile 在最后显示日志文件内容
--enable<test>[,<test>...]对指定检测对象进行检查
(默认检测所有对象)
--hash {MD5 | SHA1 | NONE | 使用指定的文件哈希函数
<command>}(Default is SHA1)
-h, --help显示帮助菜单
--lang, --language <language> 指定使用的语言
(Default is English)
--list [tests | languages | 罗列测试对象明朝,使用语言,可检测的木马程序
rootkits]
-l, --logfile [file]写到指定的日志文件名
(Default is /var/log/rkhunter.log)
--noappend-log不追加日志,直接覆盖日志文件
--nocolors输出只显示黑白两色
--nolog 不写入日志文件
--nomow, --no-mail-on-warning如果有警告信息,不发送邮件
--ns, --nosummary 不显示检查结果的统计数据
--novl, --no-verbose-logging不显示详细记录
--pkgmgr {RPM | DPKG | BSD |使用特定的包管理用于文件的哈希值验证
NONE} (Default is NONE)
--propupd [file | directory | 更新整个文件属性数据库或仅仅更新指定条目
package]...
-q, --quiet 安静模式(no output at all)
--rwo, --report-warnings-only只显示警告信息
-r, --rootdir <directory> 使用指定的root目录
--sk, --skip-keypress 自动完成所有检测,跳过键盘输入
--summary 显示检测结果的统计信息
(This is the default)
--syslog [facility.priority]记录检测启动和结束时间到系统日志中
(Default level is authpriv.notice)
--tmpdir <directory>使用指定的临时目录
--update检测更新内容
--vl, --verbose-logging 使用详细日志记录 (on by default)
-V, --version 显示版本信息
--versioncheck检测最新版本
-x, --autox 当X在使用时,自动启动检测
-X, --no-autox当X在使用时,不自启检测
PCOS系统下载站:http://zhuangji.wang

本版积分规则