异常现象1、服务器CPU总占用率50%,部分进程占用800%左右(共16核)。置顶1.数据传输netstat-lntupa2.定时任务[root@bogon.new]#cat/etc/passwd|cut-f1-d:|xargs-I{}crontab-l-u{}*****/tmp/.ICE-unix/.new/-bash>/dev/null2>&1;nocrontabforbinnocrontabfordaemonnocrontabforadmnocrontabforsyncnocrontabformailnocrontabforftpnocrontabfornobodynocrontabforavahi-autoipdnocrontabforpolkitdnocrontabfortssnocrontabforpostfixnocrontabforntpnocrontabforsshdnocrontabformysqltcpdumpnocrontabfordockerrootnocrontabforsystemd-networknocrontabforxdjanocrontabforansible3.找到恶意木马文件[root@bogontmp]#pwd/tmp[root@bogontmp]#ls-latotal8drwxrwxrwt。8根根40961月22日10:31。18根根4096Sep1615:37..drwxrwxrwt。2rootroot6Aug262016.font-unixdrwxr-xr-x2rootroot30Jan1216:44hsperfdata_rootdrwxrwxrwt。3根根11月17日1308:17.ICE-unix-rw-r--r--1rootroot0Jan1716:01.locksrwxrwxrwx1mysqlmysql0Oct2013:59mysql.sockdrwxrwxrwt。2根根2016年8月26日6.Test-unixdrwxrwxrwt。2根根2019年7月25日6.X11-unixdrwxrwxrwt。2rootroot62016年8月26日3rootroot17Nov1308:17.drwxrwxrwt。8rootroot4096Jan2210:31..drwxr-xr-x2rootroot31Jan2212:29.new[root@bogon.ICE-unix]#cd.new/[root@bogon.new]#ls-latotal1840drwxr-xr-x2rootroot31Jan2212:29.drwxrwxrwt。3rootroot17Nov1308:17..-rwxr-xr-x1rootroot119Nov1308:18-bash-rwxr-xr-x1rootroot1878432Sep1701:52x86_64处理方法1.kill掉-bash进程,发现很快就自动启动kill-9283322.删除定时任务[root@bogon.new]#crontab-l*****/tmp/.ICE-unix/.new/-bash>/dev/null2>&1;[root@bogon.new]#crontab-r[root@bogon.new]#[root@bogon.new]#[root@bogon.new]#[root@bogon.new]#[root@bogon.new]#crontab-lnocrontabforroot3。删除木马程序,或者下载并保存木马程序以供后续分析研究[root@bogontmp]#ls-latotal8drwxrwxrwt.8rootroot4096Jan2210:31.dr-xr-xr-x。18根根4096Sep1615:37..drwxrwxrwt。2rootroot6Aug262016.font-unixdrwxr-xr-x2rootroot30Jan1216:44hsperfdata_rootdrwxrwxrwt。3rootroot17Nov1308:17.ICE-unix-rw-r--r--1rootroot0Jan1716:01.locksrwxrwxrwx1mysqlmysql0Oct2013:59mysql.sockdrwxrwxrwt。2根根2016年8月26日6.Test-unixdrwxrwxrwt。2根根2019年7月25日6.X11-unixdrwxrwxrwt。@bogontmp]#rm-rf.font-unix.ICE-unix.Test-unix.X11-unix.XIM-unix[root@bogontmp]#ls-latotal4drwxrwxrwt。3rootroot57Jan2212:55.博士-xr-xr-x。18rootroot4096Sep1615:37..drwxr-xr-x2rootroot30Jan1216:44hsperfdata_root-rw-r--r--1root根0Jan1716:01.locksrwxrwxrwx1mysqlmysql0Oct2013:59mysql.sock[root@bogontmp]#4.杀掉木马进程。杀死它后,它可能会自动重新启动。再次kill它,观察它不会再次自动启动。后续可以尝试重启,继续观察kill-9225905,观察发现木马又重启了,PID为30382ls-l/proc/303826。查看计划任务日志,每1小时cron7.tail-2000f/var/log/有异常信息。查看定时任务信息,大致每隔1小时将/bin/sysdrr复制到/usr/bin/-bash,启动脚本后删除-bash[root@localhosttmp]#cat/etc/cron.daily/logrotateman-db.cronmlocatesync[root@localhosttmp]#cat/etc/cron.daily/sync#!/bin/bash##启动/停止pwnrig时钟守护进程##chkconfig23459060#描述:同步时钟(GNU系统)cp-f-r--/bin/sysdrr/usr/bin/-bash2>/dev/nullcd/usr/bin/2>/dev/null./-bash-c>/dev/nullrm-rf---bash2>/dev/null[root@localhosttmp]#cat/etc/cron.hourly/sync#!/bin/bash##启动/停止pwnrig时钟守护进程##chkconfig23459060#description:sync时钟(GNU系统)cp-f-r--/bin/sysdrr/usr/bin/-bash2>/dev/nullcd/usr/bin/2>/dev/null./-bash-c>/dev/nullrm-rf---bash2>/dev/null8。再次清理定时任务[root@localhostetc]#cd/etc/cron.weekly/[root@localhostcron.weekly]#lltotal4-rwxr-xr-x1rootroot246May52015sync[root@localhostcron.weekly]#rm-rfsyncrm:cannotremove'sync':Operationnotpermitted[root@localhostcron.weekly]#laattrsync-bash:laattr:commandnotfound[root@localhostcron.weekly]#lsattrsync----i------------sync[root@localhostcron.weekly]#rm-rfsyncrm:无法删除'sync':不允许操作[root@localhostcron.weekly]#chattr-R-isync[root@localhostcron.weekly]#lsattrsync----------------sync[root@localhostcron.weekly]#rm-rfsync[root@localhostcron.weekly]#[root@localhostcron.weekly]#[root@localhostcron.weekly]#[root@localhostcron.weekly]#lltotal0[root@localhostcron.weekly]#执行以下命令清除同步其他目录中的文件或其他可疑文件:chattr-R-isynclsattrsyncrm-rfsync9。删除木马程序,或者下载保存木马程序以备后用分析研究[root@localhostetc]#cd/bin/[root@localhostbin]#ls-lasysdrr-rwxr-xr-x1rootroot18784322015年5月5日sysdrr[root@localhostbin]#[root@localhostbin]#[root@localhostbin]#[root@localhostbin]#[root@localhostbin]#chattr-R-isysdrr[root@localhostbin]#lsattrsysdrr----------------sysdrr[root@localhostbin]#rm-rfsysdrr10.cleansshrm-rf/根/.ssh11。尽量检查所有服务器,清关步骤同上。建议使用密钥而不是密码登录。使用安全的密码策略并使用强密码。不要使用弱密码。最好不要开启redis,防止黑客暴力破解redis端口或开启TLS和密码认证或添加ip白名单等外网远程连接22使用白名单或关闭外网直连22升级存在漏洞的组件版本,如openssh防火墙禁止木马程序通信IP参考文档https://cloud.tencent.com/dev...https://blog.csdn.net/whatday...https://blog.csdn.net/weixin_。..
