双枪团伙新动向,借云服务管理数十万僵尸网络 | xxx双枪团伙新动向,借云服务管理数十万僵尸网络 – xxx
菜单

双枪团伙新动向,借云服务管理数十万僵尸网络

五月 23, 2020 - 360netlab

本文作者:jinyeJiaYu,suqitian,核心安全部研究员THL

概述

近日,我们的域名异常监测系统 DNSMon 捕捉到域名 pro.csocools.com 的异常活动。根据数据覆盖度估算,感染规模超过100k。我们通过告警域名关联到一批样本和 C2,分析样本后发现是与双枪恶意程序相关的团伙开始新的大规模活动。近年来双枪团伙屡次被安全厂商曝光和打击,但每次都能死灰复燃高调复出,可见其下发渠道非常庞大。本次依然是因为受感染主机数量巨大,导致互联网监测数据异常,触发了netlab的预警系统。本报告中我们通过梳理和这些URL相关的C2发现了一些模式,做了一些推测。

我们观察到恶意软件除了使用百度贴吧图片来分发配置文件和恶意软件,还使用了阿里云存储来托管配置文件。为了提高灵活性和稳定性,加大阻拦难度,开发者还利用百度统计这种常见的网络服务来管理感染主机的活跃情况。同时我们在样本中多次发现了腾讯微云的URL地址,有意思的是我们在代码中并没有找到引用这些地址的代码。至此,双枪团伙第一次将BAT三大厂商的服务集成到了自己的程序中,可以预见使用开放服务来管理僵尸网络或将成为流行趋势。有必要澄清的是,这些公开服务本身均为技术中立,此恶意代码中滥用这些公开服务完全是其作者的蓄意行为,各主要互联网公司均在用户许可中明确反对并采取措施抵御这些恶意滥用行为。

5月14日起,我们联系到了百度安全团队,采取了联合行动,对该恶意代码的传播范围做了度量,并采取了抵御措施。截止本文发稿,相关的恶意代码下载链接已经被阻断。百度安全团队对该事件的声明见文末。

IOC关联分析

从告警域名入手,通过DNS解析记录和样本流量分析建立IOC关联,过滤掉孤立和噪音节点,我们找到了一组与此次传播活动有关的关键C2。从下面截取的部分IOC关联图可以看出,几乎所有的域名都和两个关键的ip 地址 125.124.255.20 和 125.124.255.79 有关,围绕这两个ip地址,双枪团伙从19年下半年开始依次启用了一批域名来控制和下发恶意程序。事实上这个团伙长期且稳定的控制了大量 125.124.255.0/24 网段的ip地址,可以看出他们拥有非常丰富的网络资源。

通过样本溯源可以看到,这次大规模感染主要是通过诱导用户安装包含恶意代码的网游私服客户端,具体感染方式大体分为两种,下面进行深入分析。

感染方式1 — 启动器内包含恶意代码

阶段1 — 下载并加载cs.dll恶意文件

各类私服入口

点击下载链接跳到私服主页

登录器下载 “蟠龙军衔.zip”

含恶意代码的私服客户端启动器被用户下载并执行,恶意代码访问配置信息服务器,然后根据配置信息从百度贴吧下载并动态加载名为 cs.dll 的最新版本恶意程序。cs.dll 中的敏感字串使用了一种变形的 DES 加密方法,这种加密算法和我们之前捕捉到的双枪样本高度相似。我们从样本主体 exe 文件入手,逐步分析上述恶意行为。

阶段2 — 上报主机信息,释放并加载恶意驱动

cs.dll 会进行一些简单的虚拟机和杀软对抗,利用百度统计服务上报 Bot 信息,释放第 3 阶段 VMP 加壳的驱动程序(包含x86/x64两个版本)。

阶段3 — 劫持系统进程,下载后续恶意程序

驱动运行后会拷贝自己到 Windows/system32/driver/{7个随机字符}.sys ,伪造驱动设备信息为常见的合法驱动,如 fltMgr.sys ,向系统进程 Lassas.exesvchost.exe 注入 DLL 模块。完成整个初始化过程后,就形成了一个驱动和 DLL 模块通过 DeviceIoControl() 通信合作来完成作务的工作模式,这是一个驱动级别的下载器。所有敏感的配置信息都保存在驱动内部,DLL 通过调用驱动来获得配置服务器相关信息,根据下载的配置信息去百度贴吧下载其它恶意代码,进行下一阶段的恶意活动。

完成上述初始化过程后,驱动开始根据配置文件进入真正的功能操作。根据解析的配置文件,dll和驱动模块配合可以完成非常复杂的功能,下面罗列其中一部分功能。


感染方式2 — DLL 劫持

感染方式 2 依然是以私服客户端为载体,但是在技术细节上有较大差异。

登录器下载页面:

下载后的登录器:

多款类似游戏的私服客户端的组件 photobase.dll 被替换成同名的恶意 DLL 文件,恶意 DLL 文件的 PE Resource 中包含 3 个关键文件:

恶意 photobase.dll 有两个关键动作:

  1. 首先会释放相应架构的恶意驱动程序,然后注册系统服务并启动;

  2. 然后加载真正的 photobase.dll 文件,并将导出函数转发到真正的 photobase.dll。

后续感染流程同上。 这是一套标准的 DLL 劫持加载方式。

阶段1 — 释放并加载恶意驱动

恶意 photobase.dll 文件会首先为即将释放的恶意驱动文件生成一个随机文件名,文件名为 10 个随机字符,文件后缀为 .dat,并把自身 PE Resource 中相应的驱动文件放到 %windir%/Temp/ 目录下。

然后为落地的恶意驱动文件注册系统服务,并启动服务:

恶意驱动接下来的活动与前面第一种感染方式雷同,即下载、解密并最终加载其他恶意文件。

阶段2 — 加载真 photobase.dll

在恶意 photobase.dll PE Resource 中的真 photobase.dll 文件的前 2 个字节被置空:

恶意 photobase.dll 从 PE Resource 中提取这份文件的时候,会把这前 2 个字节以 MZ(PE 文件头) 填充:

然后,恶意的 photobase.dll 文件会为刚载入的真正的 photobase.dll 文件载入动态链接库、导入相关函数,最后,把真 photobase.dll 中的导出函数转发到自己的导出函数中。部分转发的导出函数如下:

以上面高亮的导出函数 Sqm::AddToStream() 为例,恶意 photobase.dll 中的转发实现如下:

百度安全团队声明

基于海量威胁情报,百度安全反黑产开放平台配合测算出僵尸网络的规模。平台同时启动相关措施,尝试对受僵尸网络控制的用户进行风险提示。在本次联合行动中,通过黑产威胁情报分析、共享、应对等举措,我们对于双枪团伙的作案技术手段、逻辑及规则形成进一步认知。


附录

DES 加解密算法中的自定义转换表:

以下转换表不同于大部分 DES 加解密的公开实现,左移位数表与 SBox 表都同于常见 DES 算法实现。

# Permutation and translation tables for DES __pc1 = [     56, 48, 40, 32, 24, 16, 8,     0, 57, 49, 41, 33, 25, 17,     9, 1, 58, 50, 42, 34, 26,     18, 10, 2, 59, 51, 43, 35,     62, 54, 46, 38, 30, 22, 14,     6, 61, 53, 45, 37, 29, 21,     13, 5, 60, 52, 44, 36, 28,     20, 12, 4, 27, 19, 11, 3 ] # permuted choice key (table 2) __pc2 = [     13, 16, 10, 23, 0, 4,     2, 27, 14, 5, 20, 9,     22, 18, 11, 3, 25, 7,     15, 6, 26, 19, 12, 1,     40, 51, 30, 36, 46, 54,     29, 39, 50, 44, 32, 46,     43, 48, 38, 55, 33, 52,     45, 41, 49, 35, 28, 31 ] # initial permutation IP __ip = [     57, 49, 41, 33, 25, 17, 9, 1,     59, 51, 43, 35, 27, 19, 11, 3,     61, 53, 45, 37, 29, 21, 13, 5,     63, 55, 47, 39, 31, 23, 15, 7,     56, 48, 40, 32, 24, 16, 8, 0,     58, 50, 42, 34, 26, 18, 10, 2,     60, 52, 44, 36, 28, 20, 12, 4,     62, 54, 46, 38, 30, 22, 14, 6 ] # Expansion table for turning 32 bit blocks into 48 bits __expansion_table = [     31, 0, 1, 2, 3, 4,     3, 4, 5, 6, 7, 8,     7, 8, 9, 10, 11, 12,     11, 12, 13, 14, 15, 16,     15, 16, 17, 18, 19, 20,     19, 20, 21, 22, 23, 24,     23, 24, 25, 26, 27, 28,     27, 28, 29, 30, 31, 0 ] # 32-bit permutation function P used on the output of the S-boxes __p = [     15, 6, 19, 20, 28, 11,     27, 16, 0, 14, 22, 25,     4, 17, 30, 9, 1, 7,     23, 13, 31, 26, 2, 8,     18, 12, 29, 5, 21, 10,     3, 24 ] # final permutation IP^-1 __fp = [     39, 7, 47, 15, 55, 23, 63, 31,     38, 6, 46, 14, 54, 22, 62, 30,     37, 5, 45, 13, 53, 21, 61, 29,     36, 4, 44, 12, 52, 20, 60, 28,     35, 3, 43, 11, 51, 19, 59, 27,     34, 2, 42, 10, 50, 18, 58, 26,     33, 1, 41, 9, 49, 17, 57, 25,     32, 0, 40, 8, 48, 16, 56, 24 ] 

联系我们

感兴趣的读者,可以在 twitter 或者通过邮件 netlab[at]360.cn 联系我们。

部分IOC:

C&Cs

pro.csocools.com www.w15773.com cs.wconf5.com cs.ledfaguang.com white.fei46413.com 

MD5

aa497dfb5a92c28f7fa5b8e049155da0 081e586a6010b3b72ba4934f8cbdb368 04db0b062c7491a124bf7388d783c17e 0c0f43ed8317869918a23a7e7bfeb0e8 1785ef2d8bd40d8af32cca0f536cb6e8 3fb5e2c05b73168c3f259d64b8978a64 

URLs

https://share.weiyun.com/5XqTYW6 https://www.w15773.com:12310/123.html https://www.w15773.com:12309/report.ashx http://www.w15773.com:12313/config.html http://www.w15773.com:8889/stat1.ashx  https://pro.csocools.com:12310/123.html https://pro.csocools.com:12309/report.ashx http://pro.csocools.com:8889/stat1.ashx  https://share.weiyun.com/5dSpU6a https://cs.wconf5.com:12709/report.ashx https://cs.wconf5.com:12710/123.html https://cs.wconf5.com:12713/config.html https://cs.wconf5.com:12715/GetTag.ashx http://cs.wconf5.com:8889/stat1.ashx  https://cs.ledfaguang.com:12710/123.html https://cs.ledfaguang.com:12709/report.ashx http://cs.ledfaguang.com:12713/config.html http://cs.ledfaguang.com:8889/stat1.ashx  http://white.fei46413.com:12313/config.html http://white.fei46413.com:8889/stat1.ashx  https://ap.echoit1.com:12310/123.html https://ap.echoit1.com:12309/report.ashx https://ap.echoit1.com:12710/123.html https://ap.echoit1.com:12709/report.ashx  http://tiebapic.baidu.com/tieba/pic/item/72f082025aafa40fcbf1a1b9bc64034f78f0199a.jpg http://tiebapic.baidu.com/tieba/pic/item/bf096b63f6246b600e2fa810fcf81a4c510fa2b4.jpg http://tiebapic.baidu.com/tieba/pic/item/c83d70cf3bc79f3da8c48b54ada1cd11728b29a8.jpg http://tiebapic.baidu.com/tieba/pic/item/8326cffc1e178a82281910c4e103738da977e8a9.jpg http://tiebapic.baidu.com/tieba/pic/item/0823dd54564e9258e210e98a8b82d158ccbf4ea9.jpg http://tiebapic.baidu.com/tieba/pic/item/a2cc7cd98d1001e9331b7b6baf0e7bec54e797aa.jpg http://tiebapic.baidu.com/tieba/pic/item/241f95cad1c8a786800c256a7009c93d70cf50ab.jpg http://tiebapic.baidu.com/tieba/pic/item/63d0f703918fa0ecb6e10b69319759ee3d6ddbb4.jpg  http://tiebapic.baidu.com/tieba/pic/item/574e9258d109b3de3570370edbbf6c81810a4c8d.jpg http://tiebapic.baidu.com/tieba/pic/item/71cf3bc79f3df8dc14f25cf7da11728b4610288d.jpg http://tiebapic.baidu.com/tieba/pic/item/8694a4c27d1ed21bd806fd83ba6eddc450da3f8d.jpg http://tiebapic.baidu.com/tieba/pic/item/5bafa40f4bfbfbed5d96e5196ff0f736aec31f8d.jpg http://tiebapic.baidu.com/tieba/pic/item/2f738bd4b31c8701b7786180307f9e2f0608ff8e.jpg http://tiebapic.baidu.com/tieba/pic/item/503d269759ee3d6d620854ad54166d224e4ade8e.jpg http://tiebapic.baidu.com/tieba/pic/item/f7246b600c338744a60bfc1a460fd9f9d62aa08e.jpg http://tiebapic.baidu.com/tieba/pic/item/b7003af33a87e95054d9200a07385343faf2b48e.jpg http://tiebapic.baidu.com/tieba/pic/item/b17eca8065380cd7fdd0718bb644ad345882818e.jpg http://tiebapic.baidu.com/tieba/pic/item/30adcbef76094b36d45cc88bb4cc7cd98c109d8e.jpg http://tiebapic.baidu.com/tieba/pic/item/2fdda3cc7cd98d107c1adf57363fb80e7aec908e.jpg http://tiebapic.baidu.com/tieba/pic/item/5d6034a85edf8db16ae0af021e23dd54574e748e.jpg http://tiebapic.baidu.com/tieba/pic/item/314e251f95cad1c81b752f41683e6709c83d518e.jpg http://tiebapic.baidu.com/tieba/pic/item/b812c8fcc3cec3fd32f07413c188d43f8694278e.jpg http://tiebapic.baidu.com/tieba/pic/item/50da81cb39dbb6fd8c9536401e24ab18962b378e.jpg http://tiebapic.baidu.com/tieba/pic/item/574e9258d109b3de3570370edbbf6c81810a4c8d.jpg http://tiebapic.baidu.com/tieba/pic/item/71cf3bc79f3df8dc14f25cf7da11728b4610288d.jpg http://tiebapic.baidu.com/tieba/pic/item/8694a4c27d1ed21bd806fd83ba6eddc450da3f8d.jpg http://tiebapic.baidu.com/tieba/pic/item/5bafa40f4bfbfbed5d96e5196ff0f736aec31f8d.jpg http://tiebapic.baidu.com/tieba/pic/item/2f738bd4b31c8701b7786180307f9e2f0608ff8e.jpg http://tiebapic.baidu.com/tieba/pic/item/503d269759ee3d6d620854ad54166d224e4ade8e.jpg http://tiebapic.baidu.com/tieba/pic/item/f7246b600c338744a60bfc1a460fd9f9d62aa08e.jpg http://tiebapic.baidu.com/tieba/pic/item/b7003af33a87e95054d9200a07385343faf2b48e.jpg http://tiebapic.baidu.com/tieba/pic/item/b17eca8065380cd7fdd0718bb644ad345882818e.jpg http://tiebapic.baidu.com/tieba/pic/item/30adcbef76094b36d45cc88bb4cc7cd98c109d8e.jpg http://tiebapic.baidu.com/tieba/pic/item/5d6034a85edf8db16ae0af021e23dd54574e748e.jpg http://tiebapic.baidu.com/tieba/pic/item/314e251f95cad1c81b752f41683e6709c83d518e.jpg http://tiebapic.baidu.com/tieba/pic/item/b812c8fcc3cec3fd32f07413c188d43f8694278e.jpg http://tiebapic.baidu.com/tieba/pic/item/50da81cb39dbb6fd8c9536401e24ab18962b378e.jpg http://tiebapic.baidu.com/tieba/pic/item/b7003af33a87e95054d9200a07385343faf2b48e.jpg http://tiebapic.baidu.com/tieba/pic/item/b17eca8065380cd7fdd0718bb644ad345882818e.jpg http://tiebapic.baidu.com/tieba/pic/item/30adcbef76094b36d45cc88bb4cc7cd98c109d8e.jpg http://tiebapic.baidu.com/tieba/pic/item/574e9258d109b3de3570370edbbf6c81810a4c8d.jpg http://tiebapic.baidu.com/tieba/pic/item/71cf3bc79f3df8dc14f25cf7da11728b4610288d.jpg http://tiebapic.baidu.com/tieba/pic/item/8694a4c27d1ed21bd806fd83ba6eddc450da3f8d.jpg http://tiebapic.baidu.com/tieba/pic/item/5bafa40f4bfbfbed5d96e5196ff0f736aec31f8d.jpg http://tiebapic.baidu.com/tieba/pic/item/2f738bd4b31c8701b7786180307f9e2f0608ff8e.jpg http://tiebapic.baidu.com/tieba/pic/item/503d269759ee3d6d620854ad54166d224e4ade8e.jpg http://tiebapic.baidu.com/tieba/pic/item/f7246b600c338744a60bfc1a460fd9f9d62aa08e.jpg http://tiebapic.baidu.com/tieba/pic/item/b7003af33a87e95054d9200a07385343faf2b48e.jpg http://tiebapic.baidu.com/tieba/pic/item/b17eca8065380cd7fdd0718bb644ad345882818e.jpg http://tiebapic.baidu.com/tieba/pic/item/30adcbef76094b36d45cc88bb4cc7cd98c109d8e.jpg http://tiebapic.baidu.com/tieba/pic/item/2fdda3cc7cd98d107c1adf57363fb80e7aec908e.jpg http://tiebapic.baidu.com/tieba/pic/item/5d6034a85edf8db16ae0af021e23dd54574e748e.jpg http://tiebapic.baidu.com/tieba/pic/item/314e251f95cad1c81b752f41683e6709c83d518e.jpg http://tiebapic.baidu.com/tieba/pic/item/b812c8fcc3cec3fd32f07413c188d43f8694278e.jpg http://tiebapic.baidu.com/tieba/pic/item/50da81cb39dbb6fd8c9536401e24ab18962b378e.jpg 

Notice: Undefined variable: canUpdate in /var/www/html/wordpress/wp-content/plugins/wp-autopost-pro/wp-autopost-function.php on line 51