天天看点

使用chkrootkit工具检查linux服务器是否被攻击

    在检查linux是否被攻击的时候,可以通过如下几个简单方法:

1) ps awuxf 查看进程

2) rpm -V SysinitV检查关键系统包  

但是,如果ps和rpm命令本身都被替换掉了,则无法检查出问题。

这里可以使用chkrootkit的工具检查,这是一个开放源代码的安全检测工具

他的官方网站是www.chkrootkit.org 。

首先下载chkrootkit工具(这里提供的是for redhat as4 linux 的版本)

  wget http://www.swsoft.com.cn/downloads/Prima/Tools/chkrootkit-0.47-2.i386.rpm

安装这个rpm包

rpm -ivh chkrootkit-0.47-2.i386.rpm

运行

chkrootkit

查看输出的结果:

[email protected] ~]# chkrootkit

ROOTDIR is `/'

Checking `amd'... not found

Checking `basename'... not infected

Checking `biff'... not found

Checking `chfn'... not infected  Checking `chsh'... not infected

Checking `cron'... not infected

Checking `crontab'... not infected

Checking `date'... not infected

Checking `du'... not infected

Checking `dirname'... not infected

Checking `echo'... not infected

Checking `egrep'... not infected

Checking `env'... not infected

Checking `find'... not infected

Checking `fingerd'... not found

Checking `gpm'... not infected

Checking `grep'... not infected

其中not infected就表示没有被感染。

注意,在prima for linux的服务器上,可能会出现误报:

Checking `scalper'... Warning: Possible Scalper Worm installed

  这是因为,prima for linux的功能服务器安装了acasd后台服务

  而acasd占用的端口正好是2001,和名为Scalper Worm的蠕虫占用的端口相同

  所以可能会被误报为病毒。

  关于Scalper Worm的信息,可查看Symantec的官方报告:

  http://www.symantec.com/security_response/writeup.jsp?docid=2002-062814-5031-99

  

  Symantec的官方报告中提到:

  * Distribution Level: Low

  * Ports: 2001

  * Target of Infection: unpatched Apache Webservers on the FreeBSD operating system

  就是其中的port 2001引起误报。

  在chkrootkit中的chkrootkit的源代码中,也可以找到如下代码:

  scalper (){

  SCALPER_FILES="${ROOTDIR}tmp/.uua ${ROOTDIR}tmp/.a"

  SCALPER_PORT=2001

  OPT=-an

  STATUS=0

  if ${netstat} "${OPT}" | ${egrep} "0.0:${SCALPER_PORT} "> /dev/null 2>&1; then

  STATUS=1

  fi

  for i in ${SCALPER_FILES}; do

  if [ -f ${i} ]; then

  done

  if [ ${STATUS} -eq 1 ] ;then

  echo "Warning: Possible Scalper Worm installed"

  else

  if [ "${QUIET}" != "t" ]; then echo "not infected"; fi

  return ${NOT_INFECTED}

  }

本文转自 linuxpp 51CTO博客,原文链接:http://blog.51cto.com/1439337369/1743202,如需转载请自行联系原作者

继续阅读