记一次centos 服务器中毒事件 /bin/bash

云平台反应路由器流量异常,已经被强制关闭。

这导致系统出现了很大了故障,路由器下面几十个集群,几百台机器,不知道哪台机器出了问题,不能定位,真心纠结。

一台台在控制台上看流量图,最终定位到一台elasticsearch服务器异常。

登录上去,查看。

tmp目录下有好多不知名文件。。。

[root@index_8 ~]# ll -rt /tmp
total 2420
-rw-------. 1 root root 0 Jan 23 2014 yum.log
drwxr-xr-x 2 root root 4096 Apr 4 21:58 jna-3506402
drwxr-xr-x 2 root root 4096 Apr 4 21:58 hsperfdata_root
-rwxrwxrwx 1 root root 1223123 Apr 20 20:43 yijasjd.64
-rwxr-xr-x 1 root root 1223123 Apr 20 20:43 hfhqhdo.32
-rw-r--r-- 1 root root 4672 Apr 22 22:01 chomd.1
-rwxr-xr-x 1 root root 4 Apr 22 23:20 moni.lod
-rwxr-xr-x 1 root root 4 Apr 22 23:47 gates.lod
-rw-r--r-- 1 root root 73 Apr 27 00:11 conf.n

有正在执行的不知名程序。

'''
ps axu |grep tmp
root 1902 0.1 0.0 105924 768 ? Ssl Apr22 8:27 /tmp/hfhqhdo.32
'''

立马上搜索,找了个开源软件查杀一下。

wget -c http://pkgs.repoforge.org/clamav/clamav-db-0.98-2.el6.rf.x86_64.rpm
wget -c http://pkgs.repoforge.org/clamav/clamav-0.98-2.el6.rf.x86_64.rpm
wget -c http://pkgs.repoforge.org/clamav/clamd-0.98-2.el6.rf.x86_64.rpm
rpm -ivh clamav-db-0.98-2.el6.rf.x86_64.rpm
yum install -y libtool-ltdl
rpm -ivh clamav-0.98-2.el6.rf.x86_64.rpm
rpm -ivh clamd-0.98-2.el6.rf.x86_64.rpm
service clamd start
service clamd status
freshclam
clamscan /home

写进定时任务。

vi clamsc.sh

date_time=date +%Y%m%d
data_path=/mnt
PATH=/usr/bin:/bin
clamscan -r –remove ({data_path} >/var/log/clamdscan_){date_time}.log
[root@localhost ~]#crontab -l

  • 12 * * * /clamsc.sh

1:"记一次被劫持挂马经历:Elasticsearch的远程执行漏洞"
2:"服务器被黑之后的处理经历"
3:"CentOS安裝配置clamav的若干問題"
4:"CentOS6.5下安装ClamAV-0.98 "
[5:"网址"](http://www.xianren.org/system/centos-clamav-0-98.html