阿里云服务器挖矿wipefs处理

查看指定日志修改过的文件: 

[root@iZbp12v0moqn078lm0t0l5Z 2018-04-26]# find /data/www/manage -ctime 0 -exec ls -lg {} \; |grep 'Apr 26'

查看一天内修改过的文件:
find / -ctime 0
查找/home路径內最近1天被修改过的块普通文件:
find /home -mtime 0 -type f 
查找当前目录下,最近24-48小时修改过的普通文件,并显示详细信息
find . -mtime 0 -type f -ls 

 


挖矿程序清理:
1,top查看当前进程:
pkill wipefs
2,删除crontab下得计划任务
vim /var/spool/cron文件中得任务
vim .viminfo 查看操作记录
查找当前修改文件记录:find /home -ctime 0
wipefs是linux自带的程序,用来擦除文件系统数据,也就是下面那个人回答的。正常的wipefs,路径在/usr/bin/wipefs,如果你没有做设置,不会自启动,也不会大量占用cpu。你可以看一下是否是 /bin/wipefs 进程,如果是,应该是你的机器被黑了,这是别人在你机器上放了挖矿程序。
此程序会:
1.进行挖矿计算,大量占用cpu。
2.复制自己到/bin/wipefs,创建服务/etc/init.d/wipefs,在 /etc/rc.d 和 /etc/rc.d/rc.d 中创建链接以实现开机启动。
3.释放子程序到 /bin/ddus-uidgen,创建服务/etc/init.d/acpidtd,并在 /etc/rc.d 和 /etc/rc.d/rc.d 中创建链接以实现开机启动。
4.修改/etc/resolv.conf, 可能是为其连接矿机服务的域名做服务。
5.修改/etc/crontab, 为自己创建定时任务,每天12点与0点开始执行。(所以你会发现第二天又启动了)
你需要做的:
1.删除 /etc/crontab 中的定时任务。
2.删除以下文件:
/bin/wipefs
/etc/init.d/wipefs
/bin/ddus-uidgen
/etc/init.d/acpidtd
/etc/rc0.d/S01wipefs
/etc/rc1.d/S01wipefs
/etc/rc2.d/S01wipefs
/etc/rc3.d/S01wipefs
/etc/rc4.d/S01wipefs
/etc/rc5.d/S01wipefs
/etc/rc6.d/S01wipefs
/etc/rc.d/rc0.d/S01wipefs
/etc/rc.d/rc1.d/S01wipefs
/etc/rc.d/rc2.d/S01wipefs
/etc/rc.d/rc3.d/S01wipefs
/etc/rc.d/rc4.d/S01wipefs
/etc/rc.d/rc5.d/S01wipefs
/etc/rc.d/rc6.d/S01wipefs
/etc/rc0.d/acpidtd
/etc/rc1.d/acpidtd
/etc/rc2.d/acpidtd
/etc/rc3.d/acpidtd
/etc/rc4.d/acpidtd
/etc/rc5.d/acpidtd
/etc/rc6.d/acpidtd
/etc/rc.d/rc0.d/acpidtd
/etc/rc.d/rc1.d/acpidtd
/etc/rc.d/rc2.d/acpidtd
/etc/rc.d/rc3.d/acpidtd
/etc/rc.d/rc4.d/acpidtd
/etc/rc.d/rc5.d/acpidtd
/etc/rc.d/rc6.d/acpidtd

检查机器漏洞,ssh权限,防火墙等,避免机器再次被攻击。

以上是网友提供的方法,以下是个人处理过程:

 

1,使用find指令

#查找系统中被设置了setuid的文件:
find / -type f \( -perm -04000 -o -perm -02000 \) -exec ls -lg {} \;`
#查看拥有指定权限文件:
find / -type f -perm 700 |xargs ls -al

#查看包含特殊内容的文件: 

find /    -mount -type f -exec sh -c 'grep -q "\.minexmr\.\|wipefs" "{}"' \; -print ; find /tmp -mount -type f -exec sh -c 'grep -q "\.minexmr\.\|wipefs" "{}"' \; -print ;

find /opt -mount -type f -exec sh -c 'grep -q "\.xyz\.\|wipefs" "{}"' \; -print;

 

对文件包含wipefs字段的文件酌情删除。

 

2,通过查看tomcat的相关日志,发现tomcat存在远程执行代码漏洞,通过升级tomcat此次问题已经解决。

 

参考资料:

https://blog.csdn.net/Xing6Kai/article/details/78790403
https://blog.csdn.net/b376924098/article/details/78233108

 

posted @ 2018-04-12 09:22  quicksand.F  阅读(1585)  评论(0编辑  收藏  举报