isarmadfarooq/static-malware-analysis-nuces
GitHub: isarmadfarooq/static-malware-analysis-nuces
Stars: 0 | Forks: 0
# 🛡️ 静态恶意软件分析报告
[](https://nuces.edu.pk/)
[](https://nuces.edu.pk/)
[](https://nuces.edu.pk/)
[](#)
[](#)
[](#)
## 📋 目录
- [关于本项目](#about-this-project)
- [分析样本](#samples-analyzed)
- [分析方法论](#analysis-methodology)
- [工具与技术](#tools--technologies)
- [仓库结构](#repository-structure)
- [分析步骤摘要](#analysis-steps-summary)
- [步骤 1 – 安全环境搭建](#step-1--safe-environment-setup)
- [步骤 2 – 文件识别](#step-2--file-identification)
- [步骤 3 – 指纹与哈希](#step-3--fingerprinting--hashing)
- [步骤 4 – PE 结构分析](#step-4--pe-structure-analysis)
- [步骤 5 – DLL 与导入分析](#step-5--dll--import-analysis)
- [步骤 6 – 加壳检测](#step-6--packing-detection)
- [步骤 7 – 字符串分析与 YARA 规则](#step-7--strings-analysis--yara-rules)
- [步骤 8 – 在线沙箱分析](#step-8--online-sandbox-analysis)
- [步骤 9 – 完整 Python 自动化](#step-9--full-python-automation)
- [关键发现](#key-findings)
- [威胁摘要表](#threat-summary-table)
- [IOCs (入侵指标)](#iocs-indicators-of-compromise)
- [道德声明](#ethical-declaration)
- [作者](#author)
## 关于本项目
本仓库包含一份完整的 **基础静态恶意软件分析** 报告,该报告是 **NUCES (FAST National University)** **MS Cybersecurity** 项目 **Malware Analysis** 课程的 **作业 #1**。
此次分析 **严格使用静态分析技术** 进行 —— 在任何时刻均未执行恶意软件样本。所有工作均在 **隔离的 VMware 虚拟机** 内进行,以确保完全的隔离。
本次作业的目标是展示以下方面的熟练程度:
- 使用魔数 (Magic Bytes) 和签名分析识别文件类型
- 生成并验证加密指纹
- 分析 PE (Portable Executable) 结构
- 识别导入的 DLL 和可疑 API 调用
- 检测加壳和混淆技术
- 提取字符串并开发 YARA 检测规则
- 使用多种工具交叉验证结果
## 分析样本
| # | SHA256 (截断) | 类型 | 恶意软件家族 | VirusTotal 检出数 | 威胁 |
|---|---|---|---|---|---|
| 1 | `06cb74c0...448d9a` | `.exe` | qfthf | 14/71 | Trojan |
| 2 | `885b57ac...80bee` | `.exe` | epack/gen2 | 37/72 | Trojan |
| 3 | `ac43c5d2...455cd` | `.exe` | sonbokli/generik | 23/72 | Trojan |
| 4 | `e5f83c66...1aa0` | `.exe` | tedy | 45/68 | Trojan |
| 5 | `622706fa...1877` | `.dll` | fragtor/mekotio | 26/72 | Trojan |
| 6 | `dab744a5...ea5a` | `.dll` | rugmi | 28/59 | Trojan |
| 7 | `e702f4cd...b5e0` | `.unknown` | N/A | 3/63 | 可疑 |
**来源:** [Malware Bazaar](https://bazaar.abuse.ch/) — 样本仅用于学术研究目的下载。
## 分析方法论
```
Static Analysis Pipeline
─────────────────────────────────────────────────────────────
Sample Acquisition (Malware Bazaar)
│
▼
Secure Isolated VM (VMware / Windows 10)
│
▼
File Identification ──► Magic Bytes, TrIDNet, Python Magic Library
│
▼
Fingerprinting ──────► MD5 / SHA1 / SHA256 (certutil + hashlib)
│
▼
VirusTotal Lookup ───► Threat Intelligence Correlation
│
▼
PE Structure Analysis ► CFF Explorer + Python pefile
│
▼
DLL / Import Analysis ► Imported functions & suspicious APIs
│
▼
Packing Detection ───► Exeinfo PE + Entropy Analysis
│
▼
Strings Analysis ────► Embedded URLs, IPs, Registry Keys
│
▼
YARA Rule Development ► Per-sample detection signatures
│
▼
Sandbox Analysis ────► Hybrid Analysis + SNDBOX (online)
│
▼
Python Automation ───► End-to-end automated analysis script
─────────────────────────────────────────────────────────────
```
## 工具与技术
| 工具 | 用途 |
|---|---|
| **VMware** | 隔离分析环境 |
| **Notepad++ (Hex Editor Plugin)** | 魔数/十六进制分析 |
| **CFF Explorer** | PE 头和导入表检查 |
| **TrIDNet** | 基于签名的文件类型识别 |
| **Exeinfo PE** | 加壳器和编译器检测 |
| **Windows `certutil`** | 命令行哈希生成 |
| **YARA** | 恶意软件模式匹配和规则开发 |
| **Hybrid Analysis** | 在线动态沙箱 |
| **SNDBOX** | 在线行为分析 |
| **VirusTotal** | 威胁情报关联 |
| **Python 3.x** | 自动化 (`hashlib`, `pefile`, `python-magic`) |
## 仓库结构
```
static-malware-analysis/
│
├── README.md ← You are here
│
├── report/
│ └── Static_Malware_Analysis_Report_SarmadFarooq.pdf
│
├── yara_rules/
│ ├── rule_sample1.yar ← YARA rule for Sample 1
│ ├── rule_sample2.yar ← YARA rule for Sample 2
│ ├── rule_sample3.yar ← YARA rule for Sample 3
│ ├── rule_sample4.yar ← YARA rule for Sample 4
│ ├── rule_sample5.yar ← YARA rule for Sample 5
│ ├── rule_sample6.yar ← YARA rule for Sample 6
│ └── rule_sample7.yar ← YARA rule for Sample 7 (Linux ELF)
│
├── scripts/
│ ├── hash_generator.py ← MD5/SHA1/SHA256 generation
│ ├── file_identifier.py ← python-magic based file ID
│ ├── pe_structure_analyzer.py ← pefile PE section analysis
│ ├── dll_import_analyzer.py ← DLL & imported function extractor
│ ├── entropy_calculator.py ← Section entropy analysis
│ └── full_automation.py ← Complete end-to-end script
│
├── hashes/
│ └── sample_hashes.csv ← All MD5 / SHA1 / SHA256 values
│
└── screenshots/ ← Tool output screenshots
├── cff_explorer/
├── tridnet/
├── exeinfo_pe/
├── virustotal/
└── sandbox/
```
## 分析步骤摘要
### 步骤 1 – 安全环境搭建
使用运行 **Windows 10 (64-bit)** 的 **VMware** 配置了一个隔离的虚拟机。网络适配器已被禁用,并限制了主机与客户机之间的文件共享。来自 Malware Bazaar 的样本仅存储在 VM 内部,且从未被执行。
### 步骤 2 – 文件识别
**魔数与文件签名分析:**
- 所有 4 个 `.exe` 和 2 个 `.dll` 样本均以 `4D 5A` ("MZ") 开头 —— 确认为有效的 Windows PE 格式。
- 未知样本 1 以 `00 00 00 00` 开头 —— 无可识别签名,可能已损坏或被混淆。
- 未知样本 2 以 `EF BB BF` 开头 —— UTF-8 BOM,确认为文本/脚本文件。
**TrIDNet 结果 (值得注意):**
- 样本 5 (`.dll`):被识别为 **Inno Setup installer** (63.9%) —— 扩展名不匹配,高度疑似伪装。
- 样本 6 (`.dll`):被识别为 **DOS Borland executable** (48.6%) —— 可能是文件伪装。
**Python `python-magic` 库:**
- 提供了所有样本的明确识别,准确率始终高于单独使用 TrIDNet。
- 样本 7 被识别为 **Linux ext2 filesystem image**。
### 步骤 3 – 指纹与哈希
使用以下工具为所有 7 个样本生成了加密哈希 (MD5, SHA1, SHA256):
- Windows `certutil` 实用程序
- Python `hashlib` 库
经验证,两种方法在所有样本上的匹配率均为 100%,确认了完整性。
**VirusTotal 查询结果:**
| 样本 | 检出数 | 家族 | 首次发现 |
|---|---|---|---|
| Sample 1 (.exe) | 14/71 | qfthf | 2026-02-14 |
| Sample 2 (.exe) | 37/72 | epack/gen2 | 2026-02-14 |
| Sample 3 (.exe) | 23/72 | sonbokli/generik | 2026-02-14 |
| Sample 4 (.exe) | 45/68 | tedy | 2026-02-13 |
| Sample 5 (.dll) | 26/72 | fragtor/mekotio | 2025-09-17 |
| Sample 6 (.dll) | 28/59 | rugmi | 2025-02-23 |
| Sample 7 (.unknown) | 3/63 | N/A | 2026-02-15 |
### 步骤 4 – PE 结构分析
PE 节区使用 **CFF Explorer** 和 **Python `pefile` 库** 进行提取,并对结果进行了交叉验证。关键发现:
- **样本 2**:`.rdata` 节区的熵为 **8.00** —— 强烈的加壳或加密指标。
- **样本 4**:工具间节区数量不一致 (CFF Explorer: 9 vs pefile: 11) —— 可能表明存在混淆。
- **样本 7**:`PEFormatError` —— DOS Header MZ 签名缺失;确认为非 PE 文件 (Linux ELF/ext2 镜像)。
### 步骤 5 – DLL 与导入分析
对导入的 DLL 和函数调用进行了分析,以识别恶意功能:
| 功能 | 发现的相关 API |
|---|---|
| 密码学 | `CryptDecrypt`, `CryptImportKey` (样本 2) |
| 进程枚举 | `CreateToolhelp32Snapshot`, `Process32First/Next` (样本 2) |
| 沙箱/VM 逃逸 | `GetTickCount64`, `GlobalMemoryStatusEx` (样本 2) |
| 动态 API 加载 | `LoadLibraryA`, `GetProcAddress` (样本 2) |
| 网络 (C2) | `winhttp.dll`, `ws2_32.dll`, `wsock32.dll` (样本 5) |
| SOCKS5 代理 | 完整的代理实现 (样本 4) |
| COM/WMI 自动化 | 完整的 COM/OLE 堆栈 (样本 4) |
### 步骤 6 – 加壳检测
**Exeinfo PE + Python 熵分析:**
| 样本 | 检测到的加壳器 | 熵发现 |
|---|---|---|
| Sample 1 | None | 正常 |
| Sample 2 | None (UPX artifacts) | `.rdata` = 8.00 — **已加壳** |
| Sample 3 | Inno Setup SFX + Borland Delphi | 已加密 (14.2% 零字节) |
| Sample 4 | MEW 11 SE v1.1 → Northfox | 未加壳 |
| Sample 5 | MS Visual C++ / Borland Delphi | 未加壳 |
| Sample 6 | Radstudio v10-v12 ESD (C++ Builder) | 已加密 (12.9% 零字节) |
| Sample 7 | NOT EXE — Linux EXT2/3/4 image | 非常未加壳 (55% 零) |
### 步骤 7 – 字符串分析与 YARA 规则
使用 Windows `strings` 实用程序提取了嵌入的字符串。发现的关键 IOCs:
- **样本 5**:C2 URL — `https://casabonavitta.com/api/cfg.php` (**严重**)
- **样本 5**:注册表持久化键 — `HKCU\Software\Murrhas`
- **样本 4**:构建路径 — `C:/Users/Admin/Desktop/andrusha/client/build/main0.exe` (开发者 OPSEC 失误)
- **样本 4**:伪造身份 **Telegram Desktop v6.3.6.0**
- **样本 7**:嵌入在 Linux IoT 固件镜像中的 UPX 加壳 ELF,带有默认 root shell `/bin/sh`
**为所有 7 个样本开发了 YARA 规则**,目标是:
- 网络指标 (`http://`, `https://`)
- 持久化机制 (注册表运行键)
- 代码注入 API (`CreateRemoteThread`, `VirtualAllocEx`, `WriteProcessMemory`)
- 密码学 API (`CryptDecrypt`, `CryptImportKey`)
- 沙箱/VM 逃逸技术
- Linux 特有的 IoT 僵尸网络指标 (`/bin/busybox`, UPX 签名)
### 步骤 8 – 在线沙箱分析
选定的样本已提交至:
- **Hybrid Analysis** — 行为威胁评分
- **SNDBOX** — 网络活动、文件修改、MITRE ATT&CK 技术映射
### 步骤 9 – 完整 Python 自动化
开发了一个完整的端到端 Python 自动化脚本,用于自动化整个静态分析流程 —— 从哈希生成和文件识别到 PE 节区分析和熵计算 —— 单次运行即可处理所有 7 个样本。
## 关键发现
**样本 2 (`epack/gen2` Trojan)** — 高威胁
- `.rdata` 节区熵为 8.00 (最大值),表明存在强加壳/加密
- 存在完整的密码学流程 (`CryptDecrypt`, `CryptImportKey`)
- 反沙箱技术:硬件指纹识别、时间检查
- 通过 `LoadLibraryA` + `GetProcAddress` 进行动态 API 解析
**样本 4 (`tedy` Trojan)** — 严重威胁
- 内置 SOCKS5 代理服务器,带认证
- 身份欺骗:伪造 Telegram Desktop
- Go 编译的二进制文件,函数名完全随机化
- 系统指纹识别:硬件 GUID、主机名、操作系统版本
- 二进制字符串中泄露了开发者构建路径
**样本 5 (`fragtor/mekotio` Trojan DLL)** — 严重威胁
- 硬编码 C2 信标 URL:`https://casabonavitta.com/api/cfg.php`
- 注册表持久化:`HKCU\Software\Murrhas`
- 由可疑实体签名:TELESEC AFRICA LIMITED, Nairobi Kenya
- 扩展名伪装:DLL 被识别为 Inno Setup installer
**样本 7 (Linux IoT 固件)** — 高 / 可疑
- 多架构固件 (x86_64, ARM, MIPS, PPC, s390)
- UPX 加壳 ELF 二进制文件隐藏在固件镜像末尾
- 默认 root 账户带有 `/bin/sh` — 关键的 IoT 攻击面
- 完整的 BusyBox 网络工具包 (wget, curl, nc, iptables, ssh)
## 威胁摘要表
| 样本 | 家族 | 威胁等级 | 关键风险 |
|---|---|---|---|
| Sample 1 | qfthf | 🟡 低 | 合法的 Sysinternals 工具;检出率低 |
| Sample 2 | epack/gen2 | 🔴 高 | 密码学 + 沙箱逃逸 + 进程枚举 |
| Sample 3 | sonbokli/generik | 🟠 中低 | Inno Setup installer — 风险取决于载荷 |
| Sample 4 | tedy | 🔴 严重 | SOCKS5 代理 + 身份欺骗 + 系统指纹识别 |
| Sample 5 | fragtor/mekotio | 🔴 严重 | 活跃 C2 URL + 注册表持久化 + 可疑签名 |
| Sample 6 | rugmi | 🟡 中低 | 看似合法的 Embarcadero DLL;无活跃 C2 |
| Sample 7 | N/A | 🟠 高 / 可疑 | IoT 固件 + UPX 加壳 ELF 需进一步解包 |
## IOCs (入侵指标)
```
# C2 URLs
https://casabonavitta.com/api/cfg.php [Sample 5 - CRITICAL]
# Registry Keys
HKCU\Software\Murrhas [Sample 5 - Persistence]
# File Hashes (SHA256)
06cb74c0cafe0ee369c727b5041bba96eee44d849d66fb67def1c2afbe448d9a [Sample 1]
885b57ac755eb84c505fd41c55bc451746b29fb8101a8e1cff74d46e85a80bee [Sample 2]
ac43c5d225758269c056dadfbc92c587b3a1da2b8d19bfc1014a154d207455cd [Sample 3]
e5f83c66e93fc7e36cd7141ef14520ddeb95e90a8d86db4882fd9c04c68a1aa0 [Sample 4]
622706fa8bc0dfd26ea5b9b95072ae524387e351bf24aec1987c466dea5e1877 [Sample 5]
dab744a533bcbc4a2d3f19a54694ceb00587a0ce68d046ca9085d5013321ea5a [Sample 6]
e702f4cdacc78d8e11274132a6485354b0021ba52447e66fe910efa06b9bb5e0 [Sample 7]
# Developer Artifacts
Build path: C:/Users/Admin/Desktop/andrusha/client/build/main0.exe [Sample 4]
Impersonates: Telegram Desktop v6.3.6.0 [Sample 4]
```
## 道德声明
## 作者
| 字段 | 详情 |
|---|---|
| **Name** | Sarmad Farooq |
| **Student ID** | 25I-7722 |
| **Program** | MS Cybersecurity |
| **Course** | Malware Analysis |
| **Instructor** | Jawad Hassan |
| **Department** | Cybersecurity |
| **Institution** | NUCES (FAST National University) |
Built for educational purposes as part of the MS Cybersecurity program at NUCES.
⚠️ For defensive and research use only. Never run malware samples outside an isolated environment.
标签:Ask搜索, DAST, DNS信息、DNS暴力破解, DNS 反向解析, IP 地址批量处理, PE-bear, PE结构分析, PFX证书, Python自动化, VirusTotal, WebSocket, YARA规则, 云安全监控, 云资产清单, 依赖分析, 加壳检测, 哈希指纹, 威胁情报, 字符串提取, 安全报告, 开发者工具, 恶意软件分析, 攻击检测, 样本分析, 熵值检测, 网络信息收集, 网络安全, 网络安全审计, 课程作业, 逆向工具, 逆向工程, 隐私保护, 静态分析