清除随机进程名称的木马 libudev.so

简介:

前天遇到求助,说某服务器大量对外发包,怀疑是中病毒了,已经把网络断开,但是相关的服务也就不可用了。

于是进机房,登录到该服务器上,CentOS 系统,root 弱密码,呵呵呵~理想的“肉鸡”。

先执行 top 看看有什么进程,果然看到有好几个进程,随机名称,而且还过几秒就变一次。好玩~

首先查看定时任务 crontab -l,有 2 条定时从某 IP 上下载 shell 脚本的任务,干掉。

再到 /etc/init.d 下查看,好几个随机名称的启动项。干不掉,删了又生成新的。一时没了主意。

回到工位,打开 bing,搜索 "process random name virus",找到这个回答,描述的现象很相似。是一个用于发起 DDoS 攻击的木马。
Unknown linux process with random command

I have some experiences about this random 10bit string trojan, It will send lots of packets for SYN flood.

    Cut down your network

The trojan has raw file coming from /lib/libudev.so, it will copy and fork again. It will also add cron.hourly job named gcc.sh, then it will add initial script in your /etc/rc*.d (Debian, CentOS may be /etc/rc.d/{init,rc{1,2,3,4,5}}.d)

    Use root to run the script below to change the folder privileges: chmod 0000 /lib/libudev.so && rm -rf /lib/libudev.so && chattr +i /lib/

    Delete all /etc/rc{0,1,2,3,4,5,6,S}.d files which were created today, The name looks like S01????????.

    Edit your crontab, delete the gcc.sh script in your /etc/cron.hourly, delete the gcc.sh file (/etc/cron.hourly/gcc.sh) then add privileges for your crontab: sed '/gcc.sh/d' /etc/crontab && chmod 0000 /etc/crontab && chattr +i /etc/crontab

    Use this command to check the latest file changes: ls -lrt

If you find any suspicious files named S01xxxxxxxx (or K8xxxxxxxx), delete it.

    Then you should reboot without network.

Then the trojan should be cleaned and you can modify the folder privileges to the original values(chattr -i /lib /etc/crontab).

于是按照所说的方法,确认服务器的确存在相关的文件,逐步删除,重启服务器,清除完毕。

  1. chmod 0000 /lib/libudev.so && rm -rf /lib/libudev.so && chattr +i /lib/,把 /lib/libudev.so 的访问权限去掉,把 /lib/ 目录设为不可修改。
  2. /etc/init.d 目录下,名字是随机的软链或文件都删掉。原文是说 /etc/rc{0,1,2,3,4,5,6,S}.d 这些目录,但其实里面都是软链,都指向 /etc/init.d 目录里的真实文件。软链可以之后有空慢慢清理。
  3. 删掉 /etc/crontab/gcc.sh
  4. sed '/gcc.sh/d' /etc/crontab && chmod 0000 /etc/crontab && chattr +i /etc/crontab 清掉相关定时任务,并把 /etc/crontab 访问权限全部去掉,设为不可修改。
  5. 重启服务器,确认没有可疑进程,以及再出现可疑的启动脚本。就可以恢复 2 个目录的可修改属性,chattr -i /lib /etc/crontab
目录
相关文章
|
8月前
|
iOS开发
iOS 逆向编程(十三)PS命令获取进程PID与名称(Process Status)
iOS 逆向编程(十三)PS命令获取进程PID与名称(Process Status)
129 0
|
1月前
|
监控 安全 Linux
Python怎么修改进程名称
Python怎么修改进程名称
29 0
|
Linux Shell Perl
Linux下如何根据进程 名称/pid 结束对应进程(含 xargs kill -9报错问题)
Linux下如何根据进程 名称/pid 结束对应进程(含 xargs kill -9报错问题)
382 0
Linux下如何根据进程 名称/pid 结束对应进程(含 xargs kill -9报错问题)
|
安全 C#
[病毒分析]远程木马创建傀儡进程分析(下)
[病毒分析]远程木马创建傀儡进程分析
172 0
 [病毒分析]远程木马创建傀儡进程分析(下)
|
PHP
php设置进程标题,php设置进程名称
php设置进程标题,php设置进程名称
65 0
|
Java 调度
进程和线程、实现多线程的两种方式、设置获取线程名称、线程优先级及线程控制
进程和线程、实现多线程的两种方式、设置获取线程名称、线程优先级及线程控制的简单示例
104 1
进程和线程、实现多线程的两种方式、设置获取线程名称、线程优先级及线程控制
|
API Windows 机器学习/深度学习
windows api学习笔记-遍历系统进程,获取进程名称和ID(进程快照)
#include //系统会自动连接到指定的库文件lib #include //声明快照函数的头文件 #include //std io 标准输入输出接口 #include using namespace std; int main() { PROCESSENTRY32 pe32; pe32.
1166 0
|
安全 API
[病毒分析]远程木马创建傀儡进程分析(中)
[病毒分析]远程木马创建傀儡进程分析
235 0
[病毒分析]远程木马创建傀儡进程分析(中)
|
安全 API
[病毒分析]远程木马创建傀儡进程分析(上)
[病毒分析]远程木马创建傀儡进程分析
331 0
[病毒分析]远程木马创建傀儡进程分析(上)
|
Windows Python
Python 技术篇-通过进程名称、PID杀死windows进程的两种方法,获取当前运行程序的pid
Python 技术篇-通过进程名称、PID杀死windows进程的两种方法,获取当前运行程序的pid
1067 0
Python 技术篇-通过进程名称、PID杀死windows进程的两种方法,获取当前运行程序的pid

相关实验场景

更多