服务器中发现XorDDos木马的方法和清除步骤

1、现象

1)cpu使用超高

2)网络流量异常

3)服务器卡顿

2、表现

1)top命令,一个随机文件在运行,且kill后会生成新的随机文件名再次运行。

2)chkconfig --list | grep on

这里还被设置成了开机启动

3、安装clamav扫描并删除感染文件

   <1> yum install -y epel-release

   <2>  yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd -y

    freshclam 更新数据库

   <3> 扫描根目录:clamscan -r / --max-dir-recursion=5 -l /root/clamav.log

   <4> 删除感染的文件:cat clamav.log | grep FOUND(rm删除其文件)

4、重装应用并杀死进程

1)还原文件

yum -y reinstall procps lsof iproute net-tools

2)查看进程树

pstree

systemd─┬─AliYunDun───15*[{AliYunDun}]

        ├─AliYunDunUpdate───3*[{AliYunDunUpdate}]

        ├─2*[agetty]

        ├─aliyun-service───6*[{aliyun-service}]

        ├─atd

        ├─auditd───{auditd}

        ├─consul───6*[{consul}]

        ├─crond───crond───freshclam-sleep───sleep

        ├─dbus-daemon

        ├─dockerd-current─┬─docker-containe───6*[{docker-containe}]

        │                 └─8*[{dockerd-current}]

        ├─lvmetad

        ├─nginx───nginx

        ├─ntpd

        ├─polkitd───5*[{polkitd}]

        ├─rsyslogd───2*[{rsyslogd}]

        ├─sshd───sshd───bash───pstree

        ├─systemd-journal

        ├─systemd-logind

        ├─systemd-udevd

        ├─tuned───4*[{tuned}]

        ├─ucfzblbtus───3*[{ucfzblbtus}]

        └─5*[zmsuzppqmm]

3)查看进程位置

ll /proc/23981

dr-xr-xr-x 2 root root 0 May  7 07:57 attr

-rw-r--r-- 1 root root 0 May  7 07:57 autogroup

-r-------- 1 root root 0 May  7 07:57 auxv

-r--r--r-- 1 root root 0 May  7 07:57 cgroup

--w------- 1 root root 0 May  7 07:57 clear_refs

-r--r--r-- 1 root root 0 May  6 22:06 cmdline

-rw-r--r-- 1 root root 0 May  7 07:57 comm

-rw-r--r-- 1 root root 0 May  7 07:57 coredump_filter

-r--r--r-- 1 root root 0 May  7 07:57 cpuset

lrwxrwxrwx 1 root root 0 May  7 07:57 cwd -> /root

-r-------- 1 root root 0 May  7 07:57 environ

lrwxrwxrwx 1 root root 0 May  6 22:06 exe -> /usr/bin/ucfzblbtus

.......

4)关闭进程

pidof /usr/bin/ucfzblbtus | xargs kill -9

5、清理剩余文件

1)删除异常计划任务

    <1> cat /etc/crontab

# Example of job definition:

# .---------------- minute (0 - 59)

# |  .------------- hour (0 - 23)

# |  |  .---------- day of month (1 - 31)

# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...

# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat

# |  |  |  |  |

# *  *  *  *  * user-name  command to be executed

*/3 * * * * root /etc/cron.hourly/gcc.sh       // 异常任务、删除该行

2)破坏病毒文件

   <1> cat /etc/cron.hourly.sh

#!/bin/sh

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin

for i in `cat /proc/net/dev|grep :|awk -F: {'print $1'}`; do ifconfig $i up& done

cp /lib/libudev.so /lib/libudev.so.6

/lib/libudev.so.6

  <2>破坏并删除

  echo etes,tet> /lib/libudev.so

 rm -f /lib/libudev.so /lib/libudev.so.6

3)删除/etc/cron.houtly 目录下所有文件

   <1> cd /etc/cron.hourly/

   <2> rm -fr *

4)关闭开机启动

   <1> chkconfig --list | grep on

   <2> chkconfig --del jesahrtrma

   <3> chkconfig --del nhwtcncubx