unkn1wn0/doomsday-malware-analysis
GitHub: unkn1wn0/doomsday-malware-analysis
对 Minecraft 作弊客户端 DoomsDay 的反编译与反混淆分析仓库,用于判定其是否为恶意软件并揭示其提权、注入和规避行为。
Stars: 0 | Forks: 0
# DoomsDay 客户端恶意软件分析
## 概述
**Mod ID:** `dd` ("DoomsDay")
**版本:** 1.0.0
**作者:** L3nnart_
**支持的 MC 版本:** 1.8.9 – 1.20.5
**加载器:** Forge, Fabric, LabyMod (legacy + new), Java Agent, Standalone, BaseMod
## 反编译摘要
| 组件 | 文件 | 描述 |
|-----------|-------|-------------|
| 外部 JAR 类 | 11 | 入口点、ClassLoader、native bridge、LabyMod addons |
| LZMA payload 类 | 305 | 核心注入引擎、GUI、网络、native memory |
| 二进制资源 | 5 | 加密/打包的 payload (a–e) |
| 配置/元数据 | 6 | fabric.mod.json, mcmod.info, pack.mcmeta, addon JSONs |
**反编译的 Java 文件总数:** 317
**代码总行数:** ~50,000+
**最大的类:** `NativeEngine` (jv) — 7,061 行
### 输出结构
```
ouput/
├── README.md ← This file
├── BaseModEntrypoint.java ← BaseMod entry (mod_d.java)
├── fabric.mod.json ← Fabric mod metadata
├── mcmod.info ← Forge mod metadata
├── pack.mcmeta ← Resource pack metadata
├── addon3.json ← LabyMod legacy addon config
├── addon4.json ← LabyMod new addon config
├── 64FV7P4H2NO7Q ← 2.3MB encrypted blob
├── l.png ← Mod icon
├── META-INF/
│ └── MANIFEST.MF ← Premain-Class: net.java.ag
├── net/java/
│ ├── a ← LZMA-compressed payload (653KB)
│ ├── b ← OpenPGP public key (17KB)
│ ├── c ← Encrypted data (397KB)
│ ├── d ← Encrypted data (106KB)
│ ├── e ← Encrypted data (14KB)
│ ├── AlternativeMain.java ← Alternative main entry (y.java)
│ ├── FabricEntrypoint.java ← Fabric entrypoint (h.java)
│ ├── ForgeEntrypoint.java ← Forge entrypoint (i.java)
│ ├── JavaAgentPremain.java ← Java agent premain (ag.java)
│ ├── JnaKernelBridge.java ← JNA kernel32 bridge (g.java, 2937 lines)
│ ├── LabyModConfig.java ← LabyMod config (t.java)
│ ├── LabyModLegacyAddon.java ← LabyMod legacy addon (r.java)
│ ├── LabyModNewAddon.java ← LabyMod new addon (s.java)
│ ├── MainLoader.java ← Main loader (l.java, 1657 lines)
│ ├── NativeLibLoader.java ← Native lib loader (k.java)
│ ├── PayloadClassLoader.java ← Custom ClassLoader (m.java)
│ └── deobfuscated/ ← 305 renamed payload classes
│ ├── DoomsDayLoader.java ← Main entry, JFrame GUI (a.java)
│ ├── NativeEngine.java ← JNI bridge (jv.java, 7061 lines)
│ ├── NativeMemoryClassLoader.java ← Memory ClassLoader (ka.java, 5606 lines)
│ ├── MemoryManager.java ← Unsafe memory (ke.java, 3091 lines)
│ ├── AttachClassLoader.java ← JVM attach (jz.java, 1833 lines)
│ ├── InjectionManager.java ← Injection orchestrator (ij.java)
│ ├── ShellcodeInjector.java ← Shellcode injection (is.java)
│ ├── UpdateManager.java ← Update system (gi.java)
│ ├── ... (305 total)
│ └── README.md ← Class index with descriptions
```
## 恶意软件证据
### 1. 提权
加载器在未经用户同意的情况下提升至 root/admin 权限。
**Linux (`pkexec`):**
- `MacPrivilegeEscalator` (c.java:80-120) — 启动 `pkexec` 以 root 身份运行命令
- `InjectionManager` (ij.java:400-500) — 使用 `pkexec` 进行注入
**macOS (`osascript` + `sudo`):**
- `MacPrivilegeEscalator` (c.java:120-180) — 使用 `osascript` 显示伪造的系统对话框,然后通过 AppleScript 运行 `sudo`
- `MacCodeSigner` (eu.java) — 使用 `codesign --entitlements` 绕过 SIP (System Integrity Protection)
- `MacKeychainManager` (es.java) — 操纵 macOS Keychain 证书
**Windows (UAC 绕过):**
- `ShellcodeInjector` (is.java) — 通过进程空心化使用等效的 `runas`
- 命名管道 IPC (`\\.\pipe\javatool`) 与提权进程通信
**证据字符串:**
```
"isRunWithRoot21" — Root detection flag in DoomsDayLoader
"pkexec" — Linux privilege escalation
"osascript" — macOS AppleScript execution
"Try to disable antivirus" — AV evasion hint in ShellcodeInjector
```
### 2. 代码注入
加载器向正在运行的 Minecraft 进程注入任意代码。
虽然这可能只是为了运行真正的黑客客户端本身,但这仍然很可疑。
**JVMTI Agent 注入:**
- `InjectionManager` (ij.java) — 将 JVMTI agent 附加到正在运行的 JVM
- `AgentInjectionThread` (bu.java) — `-agentpath:` 注入
- `JvmAttachManager` (iq.java) — `JNI_GetCreatedJavaVMs` 查找目标 JVM
**Shellcode 注入:**
- `ShellcodeInjector` (is.java:15-100) — 跨架构 shellcode 注入
- 在 Windows 上将 shellcode 写入 `\\.\pipe\javatool` 命名管道
- 支持 x86 → x64, x64 → ARM64 注入
- `NativeEngine` (jv.java) — 通过 `VirtualAlloc`, `VirtualProtect` 分配内存
**JVM Attach API:**
- `AttachClassLoader` (jz.java) — 加载 `attach.dll` / `libattach.so`
- 使用 `sun.tools.attach.VirtualMachineImpl` 附加到正在运行的 JVM
- 将 classloader 注入目标进程
**进程空心化 (Process Hollowing):**
- `NativeMemoryClassLoader` (ka.java) — `ForeignKernel32`, `_VirtualProtect`, `_invoke`
- `MemoryManager` (ke.java) — `sun.misc.Unsafe` 用于任意内存访问
**证据字符串:**
```
".\\.\pipe\javatool" — Windows named pipe for injection
"\\.\pipe\return" — Return pipe for injection results
"VirtualAlloc" — Windows memory allocation
"_VirtualProtect" — Memory protection bypass
"attach.dll not found" — JVM attach library
"sun.tools.attach.VirtualMachineImpl" — JVM attach API
"ForeignKernel32" — JNA kernel32 mapping
```
### 3. 反检测 / 规避
**LZMA 压缩:**
- Payload (net/java/a) 采用 LZMA 压缩 (653KB → 2.2MB 字节码)
- 由 `MainLoader` (l.java) 在运行时解压
- 规避静态特征检测
**加密资源:**
- 资源 b–e 是加密/混淆的二进制数据
- 资源 b 中的 `OpenPGP Public Key` — 用于加密/验证
- 自定义 DataInputStream 格式:`readUTF() + readInt() + readFully()`
**二进制 Blob:**
- `64FV7P4H2NO7Q` — 2.3MB 加密 blob
- 被 `PayloadClassLoader` 引用作为外部数据源
**仅运行时加载:**
- 黑客模块在运行时下载
- 从未在 JAR 中附带 — 规避静态分析
- 模块下载后通过 JVMTI/shellcode 注入
**SIP 绕过 (macOS):**
- `MacCodeSigner` (eu.java) — `codesign --entitlements entitlement.xml`
- 为代码签名禁用 System Integrity Protection
**AV 规避:**
- 字符串:`"Try to disable antivirus"` — 表明其意图应对 AV 检测
- 命名管道 IPC 规避基于网络的检测
- 进程注入规避基于文件的检测
### 4. 进程定位
**Minecraft 进程扫描器:**
- `MinecraftVersionScanner` (gd.java) — 扫描 MC 版本 1.8.9 – 1.20.5
- 检测 Forge, Fabric 和 Tweaker 安装
- `ProcessDetectionRunnable` (ge.java) — 监控 MC 进程创建
**进程操纵:**
- `ProcessKillThread` (fn.java) — 通过 `taskkill` (Windows) 或 `kill` (Unix) 终止进程
- `ProcessStreamReader1/2` (it.java, iu.java) — 读取目标进程的 stdout/stderr
- `NativeProcessManager` (b.java) — 进程生命周期管理
**证据字符串:**
```
"Minecraft processes not found" — Process detection
"Minecraft restarted successfully!" — Post-injection confirmation
"DoomsDay loaded successfully!" — Injection success
"net.minecraft.bootstrap.Bootstrap" — MC bootstrap class detection
"1.8.9" through "1.20.5" — Supported MC versions
```
## 架构图
```
┌──────────────────────────────────────────────────────────────┐
│ DoomsDay Loader │
│ │
│ ┌─────────────┐ ┌──────────────┐ ┌────────────────────┐ │
│ │ Entry Points │ │ GUI (JFrame)│ │ Config/Settings │ │
│ │ Fabric (h) │ │ a.java │ │ au.java, cw.java │ │
│ │ Forge (i) │ │ cw/cd/cv │ │ cd.java, eg.java │ │
│ │ LabyMod (r/s)│ │ ex/cr/fr │ │ │ │
│ │ Agent (ag) │ │ │ │ │ │
│ │ Standalone(y)│ │ │ │ │ │
│ └──────┬───────┘ └──────┬───────┘ └────────┬───────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Injection Engine │ │
│ │ │ │
│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
│ │ │ JVMTI Agent │ │ Shellcode │ │ JVM Attach │ │ │
│ │ │ ij.java │ │ is.java │ │ jz.java │ │ │
│ │ │ bu.java │ │ jv.java │ │ iq.java │ │ │
│ │ │ r.java │ │ jx.java │ │ │ │ │
│ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │
│ └─────────────────────────┬───────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Native Memory Layer │ │
│ │ │ │
│ │ ka.java (5606 lines) — ClassLoader + kernel32 │ │
│ │ ke.java (3091 lines) — sun.misc.Unsafe │ │
│ │ jv.java (7061 lines) — JNI bridge │ │
│ │ kk.java — JNA kernel32 bridge │ │
│ │ kl.java — JNA ClassLoader │ │
│ └─────────────────────────┬───────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Platform Support │ │
│ │ │ │
│ │ Windows: VirtualAlloc, kernel32, named pipes │ │
│ │ macOS: SIP bypass, codesign, Keychain │ │
│ │ Linux: ptrace, pkexec, /proc filesystem │ │
│ │ ARM64: Cross-arch injection support │ │
│ └─────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────┘
```
## 关键命令行参数
| 参数 | 用途 |
|------|---------|
| `--autoinject` | 自动注入模式 |
| `--ishellcode=` | Shellcode 注入模式 |
| `--jvmti=` | JVMTI agent 路径 |
| `--jattach=` | JVM 附加模式 |
| `--loaderpid=` | 加载器进程 ID |
| `--loaderkill=` | 终止加载器进程 |
| `--killpid=` | 终止目标进程 |
| `--tmpdirpath=` | 临时目录路径 |
| `--deletefile=` | 退出时删除文件 |
| `--doomsdayversion=` | DoomsDay 版本字符串 |
| `--waitinjectmode` | 等待注入 |
| `--nativefile=` | Native 文件路径 |
| `--msgport=` | 消息端口 |
| `--offsets` | 偏移模式 |
| `--justwait` | 纯等待模式 |
| `--attach` | 附加模式 |
| `--nostd` | 无 stdio 模式 |
| `--forcenative` | 强制 native 模式 |
## 文件哈希
| 文件 | 大小 | SHA-1 |
|------|------|-------|
| net/java/a (LZMA payload) | 653,551 字节 | `23bfca215f774132c5149d072d85495f5ecf1d5e` |
| 64FV7P4H2NO7Q | ~2.3MB | (加密 blob) |
## 参考
- Mod ID: `dd`
- Main-Class: `net.java.m` (PayloadClassLoader)
- Premain-Class: `net.java.ag` (JavaAgentPremain)
- Fabric 入口点: `net.java.h`
- Forge 入口点: `net.java.i`
- LabyMod legacy: `net.java.r`
- LabyMod new: `net.java.s`
- BaseMod: `mod_d`
*报告基于 DoomsDay 黑客客户端加载器的 vineflower 反编译结果生成。*
标签:DAST, Java反编译, JS文件枚举, Minecraft, 云资产清单, 域名枚举, 恶意软件分析, 逆向工程