77oracle挖矿木马分析

$77_oracle.exe

样本基本信息

image-20230905100132892

image-20230905100259171

可以看出样本为64位PE文件,使用C++语言,编译器为VS2019。文件MD5:3b89f9f1e9932eee5a031b0266894f5f

样本分析

版本信息显示为 XMRig/6.15.2 MSVC/2019,矿池地址为5.133.65.54:80

win10_1903_x64

原版XMRig https://github.com/xmrig/xmrig/releases

https://github.com/xmrig/xmrig/releases/download/v6.15.2/xmrig-6.15.2-msvc-win64.zip

左边为$77_oracle.exe,右边为xmrig.exe(xmrig-6.15.2-msvc-win64)。可以看出main函数基本一致,应该是由此版本修改编译得到的。

编译文档 https://xmrig.com/docs/miner/build/windows

image-20230905100557005

内存中加载的config,矿池地址为5.133.65.54:80

image-20230906144528486

$77_Loader.exe

样本基本信息

image-20230907132142104

image-20230907132434816

可以看出样本为64位PE文件,使用.net框架编译,存在Smart Assembly混淆。文件MD5:6F593DBEA0A8703AF52BD66F582251A4

样本分析

首先使用de4dot去混淆,再使用dnspy进行反编译,分析

主函数

image-20230907134604164

剩下的懒得看了,就是加载资源解密,然后执行解密的powershell代码。

image-20230907135020061

直接定位到 Error executing script.

image-20230907140215501

在这里下断点就可以看见要执行的powershell了,可以选择保存进行分析。

image-20230918095119917

执行powershell

image-20230908145819741

unsapien提取打包的powershell脚本

可以看出是使用SAPIEN PowerShell Studio打包

提取powershell代码工具 https://github.com/dfir-it/unsapien

1
python2 unsapien.py 77_loader.exe >1.txt     //代码太长,保存到文件1.txt

image-20230907103515139

奇安信攻防社区的一篇文章,也是通过sapien打包powershell脚本生成的可执行文件 https://forum.butian.net/share/2340

OracleLoader.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Configuration:
Title : Loader
Initial Folder :
COM Object Path :
Script Engine : SAPIEN PowerShell V2 Host (Silent) x64
Leave Data Files : False
Leave Script Files : False
Leave COM Objects : False
Run Parallel : False
Folder Settings : 0
UserID :
Password :
Alternate Credentials : Current user
Trial Mode : False
Options : 101
MTA Mode : True
Execution restrictions : False
Allow only single instance : True
Check EnableScriptBlockLogging : False
Disable EnableScriptBlockLogging : True
Disable EnableTranscripting : True
Use AES : False
Trial Mode Day : 0
Trial Mode Month : 0
Trial Mode Year : 0
Script name : OracleLoader.ps1
Allowed OS version :
Allowed users :
Allowed hostnames :
Allowed MAC addresses :
Allowed domains :

Script: OracleLoader.ps1 [b2823679fc85abd40d50cc1bec18ce4bc803fc78e2597a92c32dec4ff63ffcaf]

太长了随便看看了看,感觉与cspsvc.ps1相似,不上分析了,可以参见参考。

参考

https://www.freebuf.com/articles/system/337691.html

https://www.anquanke.com/post/id/153070


77oracle挖矿木马分析
http://wangchenchina.github.io/2023/09/19/77oracle挖矿木马分析/
作者
Demo
发布于
2023年9月19日
许可协议