天天看點

使用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,如需轉載請自行聯系原作者

繼續閱讀