本帖最后由 hdxzd12 于 2025-3-29 10:45 编辑
恶意软件分析报告 Mandela.exe
名称: Mandela.exe
大小: 15917568 字节 (15 MiB)
CRC32: 415212F1
CRC64: 66DAA19D15CAB783
SHA256: c6818da28a36a7ed628e5a86ede3a642b609b34b2f61ae4dba9a4814d6822d2f
SHA1: eac84b6bc1be332af4bafc1bdac30b40041a1295
BLAKE2sp: 66cf897e74990409145f649c8410248b84906d8d2d53380e31826e11f7f07762
类型:破坏性恶意软件(MBR Wiper + 文件删除 + 注册表篡改)
平台:.NET Framework 4.0+
混淆方式:.NET Reactor + 自定义混淆
动态分析:Windows 7 Professional x64
一、概述
该恶意软件通过高度混淆的.NET程序集实现多重破坏行为,包括覆盖MBR、删除系统文件、篡改注册表及图形界面干扰。其代码结构复杂,采用动态加载和反分析技术。
二、技术分析
1. 代码结构与混淆
混淆特征
控制流混淆(大量goto和switch-case)
switch (num) {
case 0: goto IL_53D;
case 1: goto IL_15AB;
}
反调试机制
- 检查调试器附加:
[DllImport("ntdll.dll")]
public static extern int NtSetInformationProcess(IntPtr hProcess, int infoClass, ref int value, int size);
- 过期日期验证(2023年4月27日):
if (DateTime.Now > new DateTime(2023, 4, 27))
throw new Exception("This assembly is protected...");
2. 核心恶意行为
(1)MBR覆盖(Bootkit)
代码路径:Mbr_Writter.Mbr()
技术细节:
- 直接写入物理磁盘扇区0(MBR区域):
IntPtr hDisk = CreateFile("\\\\.\\PhysicalDrive0", 0x10000000, 0, IntPtr.Zero, 3, 0, IntPtr.Zero);
WriteFile(hDisk, maliciousMBRData, 512, out bytesWritten, IntPtr.Zero);
影响:导致系统无法启动,需低级磁盘工具修复。
(2)文件删除
这些东西将被删掉:
C:\Windows\system32\taskmgr.exe
C:\Windows\system32\drivers\*.*
C:\Windows\regedit.exe
C:\Users\Administrator\*.doc
========
C:\Windows\system32\ntoskrnl.exe
C:\Windows\system32\hal.dll
(如果可以的话)
删除逻辑:
File.SetAttributes(file, FileAttributes.Normal);
File.Delete(file);
(3)注册表篡改
目标注册表项 |
描述 |
影响 |
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options |
设置调试器为恶意程序 (在代码中发现相关逻辑但是动态分析时候没有执行) |
劫持合法进程执行 |
HKCU\Software\Microsoft\Windows\CurrentVersion\Run |
添加自启动项1 (在代码中发现相关逻辑但是动态分析时候没有执行) |
持久化驻留 |
HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Shell |
添加自启动项2 |
持久化驻留 |
HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger |
禁用事件日志(Start=0) |
掩盖攻击痕迹 |
HKLM\SYSTEM\ControlSet001\Control\Keyboard Layout\Scancod Map |
此注册表项可以修改键盘的按键功能,实现键盘功能的自定义 |
键盘无法使用 |
3. 辅助功能模块
(1)图形干扰(GDI)
代码路径:gdi.gdi_payload()
行为:
- 调用
BitBlt 扭曲屏幕显示:
BitBlt(hdcDest, x, y, width, height, hdcSrc, xSrc, ySrc, SRCCOPY);
- 随机生成几何图形覆盖窗口。
(2)权限提升
依赖库:SysPrivileges
操作:
三、行为流程图
graph TD
A[启动] --> B[反调试检查]
B --> C{是否过期?}
C -->|是| D[抛出异常]
C -->|否| E[解密资源]
E --> F[加载恶意模块]
F --> G[MBR覆盖]
F --> H[文件删除]
F --> I[注册表篡改]
F --> J[图形干扰]
G --> K[系统无法启动]
四、修复方法(基于Win7x64)
准备一个PE系统镜像和一个原版或第三方的Win7x64系统镜像
· 进入PE系统
· 使用DiskGenius找回分区表并重建MBR
· 使用BOOTICE修复BCD文件
· 打开准备好的系统镜像,将/Windows/System32/Drivers/中的所有文件复制到C:\Windows\System32\Drivers\
· 补齐其他被删除的文件
· 打开注册表,挂载C:\Windows\System32\Config中的Software和System两个文件
· 定位到‘HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Shell’,里面有explorer.exe和Mandela.exe,把Mandela.exe 删除,保留explorer.exe
` 定位到HKLM\SYSTEM\ControlSet001\Control\Keyboard Layout\,删除Scancod Map这个注册表项
· 删除C:\Windows\Mandela.exe
· 重启进入系统,重新安装其他无法正常工作的设备驱动程序
五、附录
反编译代码片段
public void DeleteSystemFiles() {
foreach (var file in new[] {"ntoskrnl.exe", "hal.dll"}) {
try {
File.Delete(Path.Combine(Environment.SystemDirectory, file));
} catch { }
}
}
相关MITRE ATT&CK映射
技术 |
Tactic |
Technique ID |
MBR覆盖 |
Impact (TA0040) |
T1490 - Inhibit System Recovery |
注册表持久化 |
Persistence (TA0003) |
T1112 - Modify Registry |
禁用任务管理器 |
Defense Evasion (TA0005) |
T1562.001 - Disable Tools |
报告备注:
- 本分析基于部分反编译代码,完整行为需动态沙箱验证。
- 实际样本可能因环境差异表现不同。
- 建议结合EDR日志进一步追踪攻击链。
|