又一个 Golang 编写的僵尸网络:KmsdBot

Akamai 最近通过全球部署的蜜罐,发现了一个为游戏行业量身定制的具有 DDoS 能力与加密货币挖掘能力的僵尸网络 KmsdBot。

发现 KmsdBot

由于蜜罐是对外开放的,会有大量的攻击行为被发现,其中有很多下载恶意软件的命令。其中有一个引起了分析人员的注意:

下载日志

攻击者利用 FTP 下载所需的恶意样本,FTP 服务器上还有很多其他样本。

支持各种架构

从目录上看恶意软件支持各种 CPU 架构,但其实有些包含二进制文件,有些是空目录。攻击者可能在陆续扩展所支持的架构,扩大攻击目标范围。

download.php 脚本中包含恶意代码,用于在 Web 服务器上下载恶意软件。

恶意代码

部分架构(如 x86_64 和 386)下有恶意样本能够下载,如下所示:

大小相似的二进制文件似乎是同一恶意软件代码的修改版

这些样本都是 Go 开发的二进制文件:

client: ELF32-bitLSBexecutable, Intel80386, version1 (SYSV), staticallylinked, GoBuildID=ob_PyXeD8H4173aDP-NM/Z7DzwyNXZ8c1Wr7LyTOK/t8bg8nky3tdpKdKSAvyp/_nWexL6rk1sZt5hRLfgs, withdebug_info, notstripped
ksmdm: ELF64-bitLSBexecutable, x86-64, version1 (SYSV), dynamicallylinked, interpreter/lib64/ld-linux-x86-64.so.2, GoBuildID=lmjZVXbGVxjEutEAYziK/ak2EoKWzPPmCz2ipOltK/uKypKwO7m2jjT2AT0qnG/PiKIqd334XYNEl_likc3, withdebug_info, notstripped
ksmds: ELF64-bitLSBexecutable, x86-64, version1 (SYSV), dynamicallylinked, interpreter/lib64/ld-linux-x86-64.so.2, GoBuildID=CV7cqV3r6hVM05Ma2jpB/kc_FWOhPv8HtKZQUhiUi/jrGTR9lhjVWxp-9kHdDA/ev1S8rMmqqwjpvWz4sLX, withdebug_info, notstripped
ksmdx: ELF64-bitLSBexecutable, x86-64, version1 (SYSV), dynamicallylinked, interpreter/lib64/ld-linux-x86-64.so.2, GoBuildID=S65yXt0R7hEC1YEm5Ci7/qGG-jP6bpvA1TCgQwZoV/WpM491XNek0FReOrQmX_/EMNmhh6mJI8ycZhLPtP4, withdebug_info, notstripped
kxmd: ELF64-bitLSBexecutable, x86-64, version1 (SYSV), dynamicallylinked, interpreter/lib64/ld-linux-x86-64.so.2, GoBuildID=57pm413aVTQ8gOrUjHox/DwlgdSzYxLxitlBpe0OR/hdbtJaHv8ujFruku5AIJ/RrSUbVKsJ9wj-rBopzh3, withdebug_info, notstripped
kzmd: ELF64-bitLSBexecutable, x86-64, version1 (SYSV), dynamicallylinked, interpreter/lib64/ld-linux-x86-64.so.2, GoBuildID=2FTLNIjq7bgMnSOW0NhD/YBc64Ubft703RycI5yQL/85YkVXL_eseyGJG3XHm1/M_laLRa5tNb5oeZ24ROq, withdebug_info, notstripped

分析

这些二进制文件的包名称都是 /root/client,这意味着它们可能都是相同的恶意软件,只是版本不同。他们中有一个文件能够完成 C&C 通信、软件更新与加密货币挖掘,另一个文件可以进行攻击。

$diffclient.sourceksmdm.source
19,23c19,23
<startLines: 12to28 (16)
<startfunc1Lines: 19to30 (11)
<startfunc2Lines: 22to22 (0)
<udpclimbLines: 30to60 (30)

<tcpclimbLines: 60to88 (28)

startLines: 10to26 (16)
startfunc1Lines: 17to28 (11)
startfunc2Lines: 20to20 (0)
udpclimbLines: 28to58 (30)
tcpclimbLines: 58to86 (28)

恶意软件的攻击目标是一家名为 FiveM 的游戏公司,支持用户为 Grand Theft Auto Online 部署自定义私服。下图为样本打开 UDP 套接字后,使用 FiveM Token 构建数据包,浪费服务器资源。

构建数据包

扫描传播

ksmdx 样本中包含扫描、更新与挖矿的功能:

Packagemain: /root/client
File: client.go
(*Client)RecvLines: 23to34 (11)
(*Client)HandleLines: 34to52 (18)
(*Client).Handlefunc1Lines: 35to35 (0)
File: command.go
NewCommandLines: 15to32 (17)
(*Command)HandleLines: 32to62 (30)
File: commandfunctions.go
ShellExecLines: 11to23 (12)
scanLines: 23to50 (27)
stopscanLines: 50to69 (19)
updateminerLines: 69to108 (39)
stopmineLines: 108to127 (19)
updateclientLines: 127to159 (32)
File: main.go
mainLines: 8to16 (8)
File: methods.go
startLines: 12to28 (16)
startfunc1Lines: 19to30 (11)
startfunc2Lines: 22to22 (0)
udpclimbLines: 30to60 (30)
tcpclimbLines: 60to88 (28)
File: utils.go
randomwalletLines: 73to79 (6)
envnameLines: 79to129 (50)

ksmdx 会向 C&C 服务器发送 Bruh Started:的 HTTP POST 请求,以此进行失陷主机上线。

$./ksmdx192.168.0.14/ksmdm192.168.0.14kumdkxmds

HTTP 日志中的请求为:

192.168.0.44-- [20/Oct/2022:13:09:34-0400] "GET /ksmdm HTTP/1.1"2002904330"-""Go-http-client/1.1"

在 45833 端口上可以看到 POST 请求:

POST 请求

向 C&C 服务器发送 !scan 命令即可获取 SSH 服务凭据爆破列表:

爆破列表

!scanxxx.xxx.xxx.xxxxxx.xxx.xxx.xxx/win/kzmdsxxx.xxx.xxx.xxxkvmdkmsd

C&C 通信

蜜罐日志中能够看到恶意软件从一个新的 IP 地址对蜜罐发起攻击,上传了新的恶意样本,内置了新的 C&C IP 地址。

[pid18212] connect(3, {sa_family=AF_INET, sin_port=htons(51382), sin_addr=inet_addr("xxx.xxx.xxx.xxx")}, 16) =-1EINPROGRESS (Operationnowinprogress)
[pid1047] connect(4, {sa_family=AF_INET, sin_port=htons(51388), sin_addr=inet_addr("xxx.xxx.xxx.xxx")}, 16) =-1EINPROGRESS (Operationnowinprogress)

查看流量可以发现失陷主机使用空字节初始化连接,C&C 服务器响应 0x01,随后失陷主机返回 0x02。

[pid2514865] write(4, "0x02", 4) =4
And0x01istheresponse
xxx.xxx.xxx.xxx.51388>xxx.xxx.xxx.xxx.52280: Flags [P.], cksum0xf2b4 (correct), seq20:24, ack21, win510, options [nop,nop,TSval1019359456ecr4067014838], length4
0x0000: 45000038adf340003a069b4aab161e1fE..8..@.:..J....
0x0010: c63a6812c8bccc3881f9f90aabeb552a .:h....8......U*
0x0020: 801801fef2b400000101080a3cc230e0............<.0.
0x0030: f269b8b630783031 .i..0x01

使用 netcat 可以进行简单测试:

$echo"0x00"|ncxxx.xxx.xxx.xxx51388
0x01
[pid2516369] write(4, "0x00", 4) =4
Itlookslike0x02istheheartbeat
xxx.xxx.xxx.xxx.52280>xxx.xxx.xxx.xxx.51388: Flags [P.], cksum0xf7ac (incorrect->0xd616), seq57:61, ack57, win502, options [nop,nop,TSval4066922833ecr1019262337], length4
0x0000: 45000038301040004006132ec63a6812E..80.@.@....:h.
0x0010: ab161e1fcc38c8bcabeb54de81f9f8c2.....8....T.....
0x0020: 801801f6f7ac00000101080af2685151.............hQQ
0x0030: 3cc0b-58130783032<...0x02

通信流量如下所示:

%telnetxxx.xxx.xxx.xxx57388
Tryingxxx.xxx.xxx.xxx...
Connectedtoxxx.xxx.xxx.xxx.
Escapecharacteris'^]'.
0x00
0x010x02
0x010x02
0x010x02
0x010x02
0x010x02
0x01

挖矿

sym.main.randomwallet() 函数中内置了数个钱包地址,在连接矿池时会随机选择。分析人员在分析时,并未发现任何挖矿行为,僵尸网络只进行了 DDoS 攻击。当然,攻击者仍然可以通过 ./ksmdr -o pool.hashvault.pro 命令来启动挖矿。

│╎0x0065b6b0488d05356c08. learax, [0x006e22ec] ; "42WDUXX5UYtNf9DyboNRx6TgNrJD43QfgTvEjh8djtdKVoNppnN96Nz8sVp2wWJTQgW9e8XjFLkv6KpSEgwWbLXLMKn5wwg42vGrE1WDpKgue8Y9ewpi6gXupMqDqYi"
│╎0x0065b6b74889442428movqword [var_28h], rax
│╎0x0065b6bc48c74424305f. movqword [var_30h], 0x5f ; '_'
│╎ ; [0x5f:8]=-1 ; 95
│╎0x0065b6c5488d053d6d08. learax, [0x006e2409] ; "46DBehyheMSatgdGffv8SVAEK8ts6Ur4wToVNL99Yqo6ZGnv7q4QpaxG7YnaasngPvN1rbyxYyCZAABgyXyme92wRMaVn1V3617de4a96262c6f5d9e98bf9292dc29"
│╎0x0065b6cc4889442438movqword [var_38h], rax
│╎0x0065b6d148c74424405f. movqword [var_40h], 0x5f ; '_'
│╎ ; [0x5f:8]=-1 ; 95
│╎0x0065b6da488d05c96c08. learax, [0x006e23aa] ; "45yK4gR5QCNag2X4g6ss6PUiL4s1e929b8mev4Rz3CbiTPU9NSXYHiyPL9FMi6cDVvD7EKho4atUf82s3vkVfFXNSsMqyUE46DBehyheMSatgdGffv8SVAEK8ts6Ur4"
│╎0x0065b6e14889442448movqword [var_48h], rax
│╎0x0065b6e648c74424505f. movqword [var_50h], 0x5f ; '_'
│╎ ; [0x5f:8]=-1 ; 95
│╎0x0065b6ef488d05556c08. learax, [0x006e234b] ; "42vGrE1WDpKgue8Y9ewpi6gXupMqDqYiKV4EwM7CFZFuNdRKP3dG6rADE7DRAcoEWGY6LmgCRKAiX16wGAu3Tj4mMQ9HR5B45yK4gR5QCNag2X4g6ss6PUiL4s1e929"

对样本分析后,可以确定很多文件都是同一代码库的不同版本,僵尸网络仍然在积极迭代更新。

$diffreports/kxmd/kxmd-src.txtreports/75569874dadb814ce51d121c108ead006b0f39c27057945b649837563f635f51/75569874dadb814ce51d121c108ead006b0f39c27057945b649837563f635f51-src.txt
8c8

< (*Command)HandleLines: 32to136 (104)

(*Command)HandleLines: 32to144 (112)
11,18c11,20
<scanLines: 23to50 (27)
<stopscanLines: 50to69 (19)
<updateminerLines: 69to108 (39)
<stopmineLines: 108to127 (19)
<updateclientLines: 127to161 (34)
<loadclientLines: 161to180 (19)
<startminerLines: 180to193 (13)

<reloadminerLines: 193to208 (15)

scanLines: 23to52 (29)
startscanLines: 52to75 (23)
stopscanLines: 75to97 (22)
updateminerLines: 97to144 (47)
stopmineLines: 144to166 (22)
updateclientLines: 166to202 (36)
loadclientLines: 202to221 (19)
removefileLines: 221to235 (14)
startminerLines: 235to248 (13)
reloadminerLines: 248to264 (16)
54,60c56,62
<getrandpathLines: 12to62 (50)
<getLines: 62to109 (47)
<fivemLines: 109to156 (47)
<fivemguidLines: 156to204 (48)
<post1Lines: 204to255 (51)
<postLines: 255to344 (89)

<bigdataLines: 344to386 (42)

getrandpathLines: 11to61 (50)
getLines: 61to108 (47)
fivemLines: 108to158 (50)
fivemguidLines: 158to206 (48)
post1Lines: 206to257 (51)
postLines: 257to346 (89)
bigdataLines: 346to388 (42)

攻击流量分析

在四层 TCP/UDP 攻击数据包中,随机数据作为 Payload。在七层 HTTP 攻击数据包中,针对特定路径发起 GET/POST 请求。

攻击请求

攻击请求

攻击请求

在函数 sym.main.connect() 中定义了 C&C 通信,如下所示:

C&C 通信

C&C 通信

TCP 洪水数据包

结论

KmsdBot 最初针对游戏公司进行攻击,目前已经转向大型奢侈品品牌。尽管攻击方式仍然是原始的 SSH 服务爆破,但仍然应该引起注意。

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/134337.html<

(0)
运维的头像运维
上一篇2025-03-01 02:51
下一篇 2025-03-01 02:53

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注