Skip to content
Back to skills

Malware Analysis Methodology

ASecurity

恶意软件分析方法论。当需要分析可疑二进制文件(PE/ELF/Mach-O)、内存 dump 中的恶意代码、或已知恶意软件家族样本时使用。覆盖静态分析、动态分析、代码逆向、IOC 提取全流程。红队视角:理解检测面以改进免杀

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 17, 2026
toolspythongoshellbashapiperformance

Works with

  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned October 17, 2026

npx -y skills add NetVar1337/agent-skill-canon --skill malware-analysis-methodology --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Malware Analysis Methodology?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Malware Analysis Methodology
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/netvar1337-malware-analysis-methodology/badge)](https://www.skillsdirectory.com/skills/netvar1337-malware-analysis-methodology)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: malware-analysis-methodology
description: "恶意软件分析方法论。当需要分析可疑二进制文件(PE/ELF/Mach-O)、内存 dump 中的恶意代码、或已知恶意软件家族样本时使用。覆盖静态分析、动态分析、代码逆向、IOC 提取全流程。红队视角:理解检测面以改进免杀"
metadata:
  tags: "malware,analysis,reverse,PE,ELF,static,dynamic,sandbox,IOC,恶意软件,样本分析,逆向"
  category: "malware"
  mitre_attack: "T1059,T1055,T1027,T1497,T1140"
---

# 恶意软件分析方法论

> **红队价值**:理解样本如何被分析 → 知道哪些特征会暴露 → 改进免杀和 OPSEC

## ⛔ 深入参考

- PE/ELF 静态分析详细命令与脚本 → [references/static-analysis.md](references/static-analysis.md)
- 动态分析与沙箱对抗 → [references/dynamic-analysis.md](references/dynamic-analysis.md)

---

## Phase 0: 样本处理与安全准备

⛔ **NEVER** 在非隔离环境执行样本!

```bash
# 计算哈希
sha256sum sample.bin
md5sum sample.bin

# 基础识别
file sample.bin
strings -n 6 sample.bin | head -50

# 检查是否加壳
upx -t sample.bin         # UPX
die sample.bin            # Detect It Easy
```

决策:
```
样本类型?
├─ PE (Windows) → Phase 1A
├─ ELF (Linux) → Phase 1B
├─ Mach-O (macOS) → Phase 1C
├─ Shellcode/内存 dump → Phase 2(直接动态分析)
└─ 脚本(PS1/VBS/JS/Python)→ 直接静态阅读代码
```

## Phase 1A: PE 静态分析

```bash
# PE 头信息
python3 -c "
import pefile
pe = pefile.PE('sample.exe')
print(f'Compiled: {pe.FILE_HEADER.TimeDateStamp}')
print(f'Sections: {len(pe.sections)}')
for s in pe.sections:
    print(f'  {s.Name.decode().strip(chr(0)):8} Entropy:{s.get_entropy():.2f} VSize:{s.Misc_VirtualSize}')
print(f'Imports: {len(pe.DIRECTORY_ENTRY_IMPORT)}')
for entry in pe.DIRECTORY_ENTRY_IMPORT:
    print(f'  {entry.dll.decode()}')
"
```

**关键 Import 特征映射:**
| Import API | 功能推断 |
|-----------|---------|
| VirtualAlloc + WriteProcessMemory | 进程注入 |
| CreateRemoteThread | 远程线程注入 |
| WinHttpOpen / InternetOpenA | 网络通信/C2 |
| CryptEncrypt / BCryptEncrypt | 加密(可能是勒索软件) |
| RegSetValueEx + RunKey | 持久化 |
| NtQueryInformationProcess | 反调试 |
| IsDebuggerPresent | 反调试 |
| GetTickCount / QueryPerformanceCounter | 沙箱检测 |

## Phase 1B: ELF 静态分析

```bash
readelf -h sample          # ELF 头
readelf -S sample          # 节表
readelf -d sample          # 动态链接
nm sample 2>/dev/null      # 符号表(未 strip 时)

# 高熵节 = 可能加密/压缩
python3 -c "
from elftools.elf.elffile import ELFFile
import math
from collections import Counter
with open('sample','rb') as f:
    elf = ELFFile(f)
    for s in elf.iter_sections():
        data = s.data()
        if len(data) > 100:
            entropy = -sum((c/len(data))*math.log2(c/len(data)) for c in Counter(data).values())
            if entropy > 7.0:
                print(f'[!] 高熵: {s.name} entropy={entropy:.2f}')
"
```

## Phase 2: 动态分析决策

```
目标:观察样本运行时行为
├─ 有沙箱环境 → 直接投递(AnyRun/Cuckoo/CAPE)
├─ 本地 VM → strace/procmon + 网络抓包
└─ 仅有样本无法执行 → 纯静态(Ghidra/IDA)
```

**Windows 动态分析:**
```
1. Procmon 过滤进程名 → 文件/注册表/网络操作
2. Wireshark/fakenet → C2 通信
3. API Monitor → 关键 API 调用序列
```

**Linux 动态分析:**
```bash
strace -f -e trace=network,process,file -o trace.log ./sample
ltrace -f -o ltrace.log ./sample
# 另一终端监控
ss -tlnp    # 监听端口
ss -tnp     # 外连
```

## Phase 3: IOC 提取清单

⛔ 必须提取以下所有类型 IOC:

- [ ] 文件哈希(MD5 + SHA256)
- [ ] 网络指标(IP/域名/URL/URI 路径)
- [ ] 文件系统指标(创建/修改的文件路径)
- [ ] 注册表指标(Windows)
- [ ] 进程指标(进程名、命令行、父子关系)
- [ ] 持久化机制(启动项/计划任务/服务/cron)
- [ ] MITRE ATT&CK TTP 映射

## Phase 4: 红队反思(OPSEC 审查)

分析完成后,从红队视角反思:

```
该样本暴露了哪些特征?
├─ 静态特征 → 特定字符串/Import/节名/编译时间
├─ 行为特征 → 进程注入方式/持久化手法/C2 模式
├─ 网络特征 → User-Agent/URI 模式/心跳间隔
└─ 内存特征 → 未加密字符串/固定 XOR key/特征字节序列
```

→ 用于改进自身工具的免杀设计

## 工具速查

| 用途 | 工具 |
|------|------|
| PE 分析 | pefile, pestudio, CFF Explorer |
| ELF 分析 | readelf, pyelftools, radare2 |
| 反编译 | Ghidra, IDA Pro, Binary Ninja |
| 字符串提取 | FLOSS (FireEye), strings |
| 沙箱 | AnyRun, CAPE, Cuckoo |
| 网络 | Wireshark, FakeNet-NG |
| YARA | yara-python, yarGen |

Files in this skill

  • SKILL.md4.8 KB
  • references/dynamic-analysis.md4.9 KB
  • references/static-analysis.md5.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.