Linux之在CentOS上一次艰难的木马查杀过程
今天朋友说他一台要准备上线的生产服务器被挂马,特征ps命令找不到进程,top能看到负载最高的一个程序是一个随机的10位字母的东西,kill掉之后自动再次出现一个随机10位字母的进程。
我让他关闭这个机器的外网,内网放开,在局域网中给我一个跳板。等我拿到权限之后进入机器,先按照朋友说的验证了一遍,果然是那样,木马有自我保护自我恢复。
这时候我想到一个问题居然是能自我开机启动,要么/etc/rc.d/{init.d,rc{1,2,3,4,5}.d}/下有启动脚本,要么有cron计划任务。
于是我发现crontab -l是正常,来到/etc/rc.d/init.d下发现了异常有10位字母的启动脚本,脚本内容如下
|
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 |
[root@Xd9BdoAkG ~]# cat /etc/rc.d/init.d/fregonnzkq #!/bin/sh # chkconfig: 12345 90 90 # description: fregonnzkq ### BEGIN INIT INFO # Provides: fregonnzkq # Required-Start: # Required-Stop: # Default-Start: 1 2 3 4 5 # Default-Stop: # Short-Description: fregonnzkq ### END INIT INFO case $1 in start) /usr/bin/fregonnzkq ;; stop) ;; *) /usr/bin/fregonnzkq ;; esac |
看到这我真是佩服这帮人单用户启动模式都不放过啊,尼玛,你这是赶尽杀绝啊。。。。。。。
到了这里我天真的删除了几个这样的启动脚本,然后重启服务器,问题依旧。。。。。。。。。你妹啊。。。不带这样玩的。。。。
到了这时候我多想了下,是不是还有启动脚本?仔细核查发现/etc/rc.d/rc3.d/下还有问题
|
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
[root@Xd9BdoAkG rc3.d]# ls total 0 lrwxrwxrwx 1 root root lrwxrwxrwx 1 root root lrwxrwxrwx 1 root root lrwxrwxrwx. 1 root root 15 lrwxrwxrwx. 1 root root 24 lrwxrwxrwx. 1 root root 19 lrwxrwxrwx. 1 root root 19 lrwxrwxrwx. 1 root root 20 lrwxrwxrwx. 1 root root 14 lrwxrwxrwx. 1 root root 18 lrwxrwxrwx. 1 root root 17 lrwxrwxrwx. 1 root root 17 lrwxrwxrwx. 1 root root 15 lrwxrwxrwx. 1 root root 19 lrwxrwxrwx. 1 root root 17 lrwxrwxrwx. 1 root root 15 lrwxrwxrwx. 1 root root 19 lrwxrwxrwx. 1 root root 22 lrwxrwxrwx. 1 root root 15 lrwxrwxrwx. 1 root root 18 lrwxrwxrwx. 1 root root 19 lrwxrwxrwx. 1 root root 20 lrwxrwxrwx. 1 root root 26 lrwxrwxrwx. 1 root root 16 lrwxrwxrwx. 1 root root 17 lrwxrwxrwx. 1 root root 20 lrwxrwxrwx. 1 root root 11 lrwxrwxrwx. 1 root root 15 lrwxrwxrwx. 1 root root 21 |
看到后我只想把这个木马的作者找到然后说收我做徒弟吧。。。。。。。。
于是我又很傻很天真的删除了这些启动脚本,并且kill了相关进程,希望的太阳没有升起,沉重的打击再次来临,木马再次自我复制自我运行了。。。。启动脚本再次出现了。。
我知道我进入了误区,重新想思路。。。
不知道为什么我瞬间想到了我遗漏了一个地方,cron,对。。。我是crontab -l 来查看的,还有个地方的cron任务不会在这个命令下出现/etc/cron.*
|
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 |
[root@Xd9BdoAkG ~]# cat SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # For details see man 4 # Example of job definition: # .---------------- minute # | .------------- # | | # | | | # | | | # | | | # * * * */3 * * * * |
你妹啊 啊 啊 啊,不带这样玩的
|
1 2 3 4 5 6 |
[root@Xd9BdoAkG ~]# cat #!/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin for i in `cat /proc/net/dev|grep :|awk -F: {'print $1'}`; do ifconfig $i up& done cp /lib/libudev.so /lib/libudev.so.6 |
|
1 2 3 4 5 6 |
[root@Xd9BdoAkG ~]# cat lo em1 em2 em3 em4 |
我擦,看到这,再次shit,你还知道主动启动网络和外面联系啊。。。。
|
1 2 |
[root@Xd9BdoAkG ~]# file /lib/libudev.so: ELF 32-bit |
居然不是脚本什么的,想看文件具体内容暂时是没时间了。。。。。。。
到了这里我们可以确认有几个地方有问题/lib/libudev.so /etc/cron.hourly/gcc.sh /etc/crontab
/etc/rc.d/init.d/ /etc/rc.d/rc3.d/
由于对方发送大量数据包,所以开始采取iptables来封禁,发现这玩意直接把output是 state 为new的drop掉。。。。。。。。不想说了,已经被他玩够了,不在乎多一次。。
通过排查可以肯定/lib/libudev.so是主体。其他是协助运行和自我保护自我复制的实现。既然你是个程序还在系统上,我有root,还搞不定么。为了不再多拖时间,直接查杀了。。
|
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 |
[root@Xd9BdoAkG ~]# chmod #在一步一点要这样运行,不然赶不上木马的自我恢复速度。。。。。我在这里坑了很长时间。 [root@Xd9BdoAkG ~]# ls /lib/ cpp firmware [root@Xd9BdoAkG ~]# ls /lib/ cpp firmware [root@Xd9BdoAkG ~]# ls /lib/ cpp firmware [root@Xd9BdoAkG ~]# ls /lib/ cpp firmware [root@Xd9BdoAkG ~]# ls /lib/ cpp firmware [root@Xd9BdoAkG ~]# ls /lib/ cpp firmware ##貌似主体被控制住了,不能再次自我恢复了。。。 [root@Xd9BdoAkG ~]# ls chmod 0000 /etc/rc.d/rc3.d/ && chmod 0000 #删除启动脚本 awk '$7>=8 && #且控制目录不能写东西了 |
|
1 2 |
[root@Xd9BdoAkG ~]# sed #删除计划任务且控制计划任务不能写东西 |
到了这里基本就差不多了。。。。。现在去重启服务器,
|
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
[root@Xd9BdoAkG ~]# top -b top - Tasks: 178 Cpu(s): 1.4%us, Mem: 32827160k Swap: 16482300k PID 1 2 3 [root@Xd9BdoAkG ~]# top -b top - Tasks: 178 Cpu(s): 1.3%us, Mem: 32827160k Swap: 16482300k PID 1414 1 2 [root@Xd9BdoAkG ~]# top -b top - Tasks: 178 Cpu(s): 0.8%us, Mem: 32827160k Swap: 16482300k PID 1 2 3 |
|
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
[root@Xd9BdoAkG ~]# ls 0anacron [root@Xd9BdoAkG ~]# ls -lt total 0 lrwxrwxrwx. 1 root root 15 lrwxrwxrwx. 1 root root 24 lrwxrwxrwx. 1 root root 19 lrwxrwxrwx. 1 root root 19 lrwxrwxrwx. 1 root root 20 lrwxrwxrwx. 1 root root 14 lrwxrwxrwx. 1 root root 18 lrwxrwxrwx. 1 root root 17 lrwxrwxrwx. 1 root root 17 lrwxrwxrwx. 1 root root 15 lrwxrwxrwx. 1 root root 19 lrwxrwxrwx. 1 root root 17 lrwxrwxrwx. 1 root root 15 lrwxrwxrwx. 1 root root 19 lrwxrwxrwx. 1 root root 22 lrwxrwxrwx. 1 root root 15 lrwxrwxrwx. 1 root root 18 lrwxrwxrwx. 1 root root 19 lrwxrwxrwx. 1 root root 26 lrwxrwxrwx. 1 root root 16 lrwxrwxrwx. 1 root root 17 lrwxrwxrwx. 1 root root 20 lrwxrwxrwx. 1 root root 11 lrwxrwxrwx. 1 root root 15 lrwxrwxrwx. 1 root root 21 |
开机后发现进程没异常了,世界貌似平静了。。。。
然后再次恢复/etc/crontab /etc/rc.d/init.d/ /etc/rc.d/rc3.d/ /lib文件夹的权限。然后再次重启。。。。。世界真的清静。。。。
Linux之在CentOS上一次艰难的木马查杀过程的更多相关文章
- Linux下 XordDos(BillGates)木马查杀记录
最近朋友的一台服务器突然网络异常,cpu占用率暴表,登录上去一查,cpu占用300% 左右,流量异常,经过看查进程,获取信息最终确认为中了dos木马,经过几天的研究,基本上已经清除,以下是清理记录. ...
- 木马入侵查杀 linux
目 录: 一.问题现象: 二.问题排查: 1.netstat 排查: 2.top查看: 3.lsof -c 命令排查: 4.确定中木马了. 三.木马查杀: 木马1,清除: 木马2,清除: 四.后续处 ...
- NoSql1 在Linux(CentOS)上安装memcached及使用
前言: 今天是初五,生活基本要从过年的节奏中回归到正常的生活了,所以想想也该想想与工作有关的事情了.我之前在工作中会经常使用memcached和redis,但是自己一直没有时间系统的好好看 ...
- 在Linux CentOS上编译并安装Clang 3.5.0
编译CoreCLR需要Clang 3.5,而CentOS上安装的是Clang 3.4.2(yum repos中最新版也是这个),只能自己手工编译LLVM的源代码进行安装. (注:CentOS的版本是6 ...
- Linux系统入门学习:在CentOS上安装phpMyAdmin
问题:我正在CentOS上运行一个MySQL/MariaDB服务,并且我想要通过网络接口来用phpMyAdmin来管理数据库.在CentOS上安装phpMyAdmin的最佳方法是什么? phpMyAd ...
- linux CentOS 安装rz和sz命令 lrzsz 实现windows和linux之间的文件上传 下载
https://blog.nbhao.org/1902.html https://bbs.csdn.net/topics/391989523 https://www.cnblogs.com/zhoul ...
- Azure的CentOS上安装LIS (Linux Integration Service)
Azure上虚拟化技术都是采用的Hyper-v,每台Linux虚拟机都安装了LIS(Linux Integration Service).LIS的功能是为VM提供各种虚拟设备的驱动.所以LIS直接影响 ...
- 如何在linux CentOS 上安装chrome 谷歌浏览器?
获得linux命令的root权限:http://blog.csdn.net/mddy2001/article/details/76521101. 更改密码在终端中输入:sudo passwd root ...
- 在Linux CentOS上编译CoreCLR
经过几天的努力,终于解决了在CentOS上编译CoreCLR的问题.最终发现问题是CMAKE_C_FLAGS的设置引起的. 只要在“src/pal/tools/clang-compiler-overr ...
随机推荐
- 2013 ACM/ICPC Asia Regional Changsha Online J Candies
AC了,但是不知道为什么,但是恶心的不得了~最近写代码,思路都非常清晰,但是代码各种bug~T.T~说说思路吧:二分~330ms~ 小队友fribbi的思路是离线250msAC~ 预处理solve函数 ...
- Android应用插件式开发解决方法[转]
一.现实需求描述 一般的,一个Android应用在开发到了一定阶段以后,功能模块将会越来越多,APK安装包也越来越大,用户在使用过程中也没有办法选择性的加载自己需要的功能模块.此时可能就需要考虑如何分 ...
- Nginx + Tomcat + Session
分别下载 tomcat http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.22/bin/apache-tomcat-7.0.22.tar.gz n ...
- [AngularJS] angular-schema-form -- 1
Check out on gitHub, see the example on Demo page, see the document, extension. Mainly, there are th ...
- [Python]linux自己定义Python脚本命令
在window下写好的程序配置到Linux上,要实现随意文件夹下的命令调用. 因为初学Linux,这里从文件传输等最主要的方法入手,记录配置的过程中遇到的各种问题. 连接远端server 这里使用pu ...
- External file changes sync may be slow: Project files cannot be watched (are they under network mount?)
if some files are on a mounted disk: go to Settings | Notifications | File Watcher Messages and tune ...
- php面试常用算法
这些都是真实的IT公司招聘PHP程序员的面试题,这些都是简单的基本算法.包括:冒泡算法.快速排序算法.二分查找算法.顺序算法. 冒泡排序,对象可以是一个数组 01 function bubble_so ...
- USB HID usage table
This usage table lets usbhidctl decode the HID data correctly for the APC RS/XS1000's. This work was ...
- 关于SWT/JFace的API文档
在CSDN上下了几个CHM格式的文档,下载的时候要付的分数还挺高,但是下载下来三个都不能用,左边罗列了所有的类和方法.双击按回车右边都没有内容. 真坑爹. >>>>>&g ...
- 使用GitHub进行协同项目开发和开源项目贡献
本教程致力于摆脱git命令行快速的学习使用GitHub. 此次是GitHub课程的第三次课程,也是最后一次课程.推荐进行按照次序查看本次教程.上篇文章:程序员,一起玩转GitHub版本控制,超简单入门 ...