您的位置:首页 > 运维架构 > Linux

Linux.BackDoor.Gates/Chikdos Attack And Defense Analysis

2015-11-24 20:14 621 查看
catalog

1. 恶意程序概述
2. BillGates模块分解
3. 通信协议
4. 木马清理


[b]1. 恶意程序概述[/b]

A malicious program targeting 32-bit versions of Linux. It combines the features of a backdoor and a DDoS bot. The malware consists of two modules:

1. the main module is the backdoor that can execute received commands
2. the second module serves the purpose of launching DDoS attacks.


Interaction between these modules is carried out via an opened port on the infected computer. The port number is incorporated in the Trojan’s body.

0x1: 从被感染主机偷取敏感信息

Linux.BackDoor.Gates.5 gathers the following system-related information and sends it to cybercriminals:

1. Number of CPU cores (from /proc/cpuinfo)
2. CPU frequency (from /proc/cpuinfo)
3. CPU usage (from /proc/stat)
4. Gate IP (from /proc/net/route)
5. Gate MAC address (from /proc/net/arp)
6. Information on network interfaces (from /proc/net/dev)
7. Network adapter MAC address
8. Amount of RAM (MemTotal from /proc/meminfo is used)
9. Volume of data sent and received (from /proc/net/dev)
10. OS name and version (the uname command is used)


0x2: 木马启动初始化

1. 启动后,Linux.BackDoor.Gates.5会检查其启动文件夹的路径,根据检查得到的结果实现四种行为模式
2. 如果后门程序的可执行文件的路径与netstat、lsof、ps工具的路径不一致,木马会伪装成守护程序在系统中启动,然后进行初始化
3. 在初始化过程中解压配置文件。配置文件包含木马运行所必须的各种数据,如管理服务器IP地址和端口、后门程序安装参数等
4. 根据配置文件中的g_iGatsIsFx参数值,木马或主动连接管理服务器,或等待连接
5. 成功安装后,后门程序会检测与其连接的站点的IP地址,之后将站点作为命令服务器


0x3: 木马Rootkit、自我隐藏行为

1. 木马在安装过程中检查文件/tmp/moni.lock,如果该文件不为空,则读取其中的数据(PID进程)并"干掉"该ID进程,这么做的目的是防止系统中同时存在大量地、重复的恶意程序
2. 然后Linux.BackDoor.Gates.5会检查系统中是否启动了DDoS模块和后门程序自有进程(如果已启动,这些进程同样会被"干掉")
3. 如果配置文件中设置有专门的标志g_iIsService,木马通过在文件/etc/init.d/中写入命令行将自己设为自启动
#!/bin/bash
<path_to_backdoor>

4. 然后Linux.BackDoor.Gates.5创建下列符号链接
ln -s /etc/init.d/DbSecuritySpt /etc/rc1.d/S97DbSecuritySpt
ln -s /etc/init.d/DbSecuritySpt /etc/rc2.d/S97DbSecuritySpt
ln -s /etc/init.d/DbSecuritySpt /etc/rc3.d/S97DbSecuritySpt
ln -s /etc/init.d/DbSecuritySpt /etc/rc4.d/S97DbSecuritySpt

5. 如果在配置文件中设置有标志g_bDoBackdoor,木马同样会试图打开/root/.profile文件,检查其进程是否有root权限。然后后门程序将自己复制到/usr/bin/bsd-port/getty中并启动
6. 在安装的最后阶段,Linux.BackDoor.Gates.5在文件夹/usr/bin/再次创建一个副本,命名为配置文件中设置的相应名称,并取代下列工具
/bin/netstat
/bin/lsof
/bin/ps
/usr/bin/netstat
/usr/bin/lsof
/usr/bin/ps
/usr/sbin/netstat
/usr/sbin/lsof
/usr/sbin/ps


0x4: 木马上线、指令接收

1. 与命令服务器设置连接后,Linux.BackDoor.Gates.5接收来自服务器的配置数据和僵尸电脑需完成的命令
2. 按照不法分子的指令,木马能够实现自动更新
3. 对指定IP地址和端口的远程站点发起或停止DDoS攻击
4. 执行配置数据所包含的命令或通过与指定IP地址的远程站点建立连接来执行其他命令


[b][b][b][b][b][b][b][b]Relevant Link:[/b][/b][/b][/b][/b][/b][/b][/b]

http://files.cnblogs.com/files/LittleHann/ddos3.zip http://news.drweb.cn/show/?i=230& http://vms.drweb.com/virus/?i=3942018 http://news.drweb.cn/show/?i=255&c=9 http://www.myexception.cn/linux-unix/1682508.html http://news.drweb.cn/show/?i=299&c=5 http://www.cnblogs.com/kerrycode/p/4754820.html


2. BillGates模块分解

It it splitted in modules usually called atddd, cupsdd, cupsddh, ksapdd, kysapdd, sksapdd, skysapdd

0x1: cupsdd

1. cupsdd is the main module which I call "Gates" (because it locks /tmp/gates.lock)
2. cupsdd unpacks cupsddh ("Bill") module (the last character depends on configuration) to the directory
3. cupsdd is stored (usually /etc)
4. cupsdd creates /etc/init.d/DbSecuritySpt and makes symlinks to it in /etc/rc[1-5].d/97DbSecuritySpt
5. cupsdd establishes connection to "Gates" CnC server on IP 116.10.189.246.
6. Newer version of "Gates" module also includes Monitor module "moni". It copies itself to /usr/bin/pojie and acts as "moni" only if ran as /usr/bin/pojie


0x2: cupsddh

cupsddh("Bill") can perform simple DDoS.

0x3: atddd, ksapdd, kysapdd, sksapdd, skysapdd

atddd, ksapdd, kysapdd, sksapdd, skysapdd is an advanced DDoS module which I call "Melinda" (it doesn't have this name and I thought I can give it). It can perform TCP, UDP, ICMP and DNS DDoS with packet forgery. The only difference between these files is the CnC server IP address.

atddd = 202.103.178.76
ksapdd = 121.12.110.96
kysapdd = 112.90.252.76
skysapdd = 112.90.22.197
sksapdd = 112.90.252.79


[b][b][b][b][b][b][b][b]Relevant Link:[/b][/b][/b][/b][/b][/b][/b][/b]

https://github.com/ValdikSS/billgates-botnet-tracker


4. 通信协议

1. Client -> CC: '\x01\x00\x00\x00\x7d\x00\x00\x00\x00\xf4\x01\x00\x00\x32\x00\x00\x00\xe8\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x02\x00\x00\x00\x01\x00\x00\x00\xc0\xa8\x38\x67\xc0\xa8\x38\x67\xc0\xa8\x38\x67\xc0\xa8\x38\x67\xc0\xa8\x38\x67\xff\xff\x01\x00\x00\x00\x00\x00\x2d\x3d\x3d\x20\x4c\x6f\x76\x65\x20\x41\x56\x20\x3d\x3d\x2d\x3a\x00\x01\x00\x00\x00\xbe\x09\x00\x00\xe9\x03\x00\x00\x4c\x69\x6e\x75\x78\x20\x33\x2e\x31\x39\x2e\x30\x2d\x34\x39\x2d\x67\x65\x6e\x65\x72\x69\x63\x00\x31\x3a\x47\x32\x2e\x34\x30\x00'

2. CC -> Client: 080000000c0000000000000000000000e8fd0000
//Online Success

3. Client进入监听状态,等待CC发送指令
4. CC在没有指令的情况下,会不断向在线的Client发送心跳包: 0400000000000000
5. Client需要回应心跳包表明自己存活: \x02\x00\x00\x00\x20\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x02\x01\x00\x00\x00\x00\xf5\x00\x00\x00\x00\x00\x00\x00


[b][b][b][b][b][b][b][b]Relevant Link:[/b][/b][/b][/b][/b][/b][/b][/b]

https://github.com/ValdikSS/billgates-botnet-tracker


3. 木马清理

0x1: 病毒自我保护策略识别

要想彻底清除必须要认识到该木马病毒的特性

1. 关闭防火墙
2. 伪装系统服务
3. 伪装系统命令
4. 定时自动启动


0x2: 对抗手段

1. 关闭防活墙
该木马病毒会自动关闭防火墙iptables,可把iptables更改服务名称
mv /etc/init.d/iptables iptables2

2. 伪装系统服务
伪装的系统服务有
DbSecuritySpt
selinux
taskgrm-

可先把这些服务停止
service taskgrm- stop
chkconfig --del  taskgrm-
rm /etc/init.d/taskgrm-
...

/etc/rc.local
etc/init.d/DbSecuritySpt
/etc/rc[1-5].d/97DbSecuritySpt

3. 伪装系统命令
伪装的系统命令有
ps
netstat
lsof
bsd-port
要把这些文件删除掉,从别的系统里再copy过来

4. 定时自动启动
木马病毒是修改了/etc/crontab文件

5. 最后还需要清除木马病毒文件及进程
files from /etc (they all have SUID bit and some of them have Immunitable bit)
1) /etc/conf.n
2) /etc/cmd.n
3) /tmp/*.lock
4) /usr/bin/pojie


[b][b][b][b][b][b][b][b][b]Relevant Link:[/b][/b][/b][/b][/b][/b][/b][/b][/b]

http://m.blog.csdn.net/blog/liukeforever/38560363# https://github.com/ValdikSS/billgates-botnet-tracker[/code] 
[b][b][b][b][b][b][b][b][b][b][b][b][b]Copyright (c) 2015 LittleHann All rights reserved[/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: