关于 memory-forensics-volatility
memory-forensics-volatility 是使用 Volatility 2 和 Volatility 3 分析内存转储的取证手册,面向事件响应与恶意软件调查人员。它整理了跨版本命令和 Windows、Linux 分析流程。
主要功能
- 01采集 Linux、Windows 与虚拟机内存
- 02对照 Volatility 2 和 3 命令
- 03分析进程、网络与模块
- 04检测代码注入和恶意软件迹象
- 05提取文件、凭据并生成时间线
适用场景
- 01调查内存转储中的恶意软件活动
- 02排查隐藏进程和代码注入
- 03分析网络连接及凭据痕迹
- 04检查 Linux 或 Windows 内存证据
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ yaklang/ hack-skills --skill memory-forensics-volatility安装后在 Claude Code 中输入/memory-forensics-volatility确认已加载。
附带文件VOLATILITY_CHEATSHEET.md
详细介绍
技能:内存取证 — 专家分析手册
AI 加载指令:使用 Volatility 2 和 3 的专家级内存取证技术。涵盖内存获取、操作系统识别、进程分析(隐藏进程检测)、网络连接、DLL/模块分析、代码注入检测(malfind)、凭据提取、文件雕刻、注册表分析和时间线生成。基础模型容易忽略 Vol2/Vol3 的命令差异、恶意软件指标模式以及 Linux 特有的内存分析。
0. 相关路由
深入分析前,可考虑加载:
- traffic-analysis-pcap,用于将网络痕迹与内存发现相关联
- steganography-techniques,如果怀疑提取的文件中包含隐藏数据
- windows-privilege-escalation,用于了解内存中的后渗透痕迹
快速参考
需要以下内容时,也请加载 VOLATILITY_CHEATSHEET.md:
- Vol2 与 Vol3 命令对照表
- 针对特定调查类型的常用插件序列
1. 内存获取
Linux
# LiME (Linux Memory Extractor) — kernel module
insmod lime.ko "path=/tmp/mem.lime format=lime"
# /proc/kcore (if available)
dd if=/proc/kcore of=/tmp/mem.raw bs=1M
# AVML (Microsoft's open-source)
./avml /tmp/mem.lime
Windows
# WinPmem
winpmem_mini_x64.exe memdump.raw
# FTK Imager (GUI) — capture memory to file
# DumpIt (single-click memory dump)
DumpIt.exe
# Comae (MagnetRAM)
MagnetRAMCapture.exe /output memdump.raw
虚拟机
# VMware: .vmem file in VM directory (suspend VM first)
# VirtualBox: VBoxManage debugvm "VM_NAME" dumpvmcore --filename mem.raw
# KVM/QEMU: virsh dump DOMAIN memdump --memory-only
# Hyper-V: checkpoint VM → inspect .bin files
2. Volatility 2 与 3
| 概念 | Volatility 2 | Volatility 3 |
|---|---|---|
| 配置文件系统 | --profile=Win10x64_19041 | 自动检测(符号表) |
| 镜像信息 | imageinfo | windows.info / linux.info |
| 进程列表 | pslist | windows.pslist |
| 网络 | netscan / connections | windows.netscan / windows.netstat |
| DLL | dlllist | windows.dlllist |
| 注入 | malfind | windows.malfind |
| 哈希 | hashdump | windows.hashdump |
| 文件 | filescan | windows.filescan |
| 注册表 | hivelist / printkey | windows.registry.hivelist / windows.registry.printkey |
| 安装 | pip2 install volatility | pip3 install volatility3 |
3. 分析方法
步骤 1:识别操作系统
# Vol2
vol.py -f mem.raw imageinfo
vol.py -f mem.raw kdbgscan
# Vol3
vol -f mem.raw windows.info
vol -f mem.raw banners.Banners
步骤 2:进程列表 — 隐藏进程检测
# Vol2
vol.py -f mem.raw --profile=PROFILE pslist # EPROCESS linked list
vol.py -f mem.raw --profile=PROFILE psscan # pool tag scan (finds unlinked)
vol.py -f mem.raw --profile=PROFILE pstree # parent-child hierarchy
# Vol3
vol -f mem.raw windows.pslist
vol -f mem.raw windows.psscan
vol -f mem.raw windows.pstree
危险信号:进程出现在 psscan 中但未出现在 pslist 中,表示存在 DKOM(直接内核对象操纵)隐藏行为。
步骤 3:网络连接
# Vol2
vol.py -f mem.raw --profile=PROFILE netscan # TCP/UDP endpoints
vol.py -f mem.raw --profile=PROFILE connections # XP/2003 only
vol.py -f mem.raw --profile=PROFILE connscan # closed connections
# Vol3
vol -f mem.raw windows.netscan
vol -f mem.raw windows.netstat
步骤 4:DLL / 模块分析
# Vol2
vol.py -f mem.raw --profile=PROFILE dlllist -p PID
vol.py -f mem.raw --profile=PROFILE ldrmodules -p PID # find unlinked DLLs
# Vol3
vol -f mem.raw windows.dlllist --pid PID
危险信号:DLL 出现在 dlllist 中,但在 ldrmodules 的三个列中均为 False,表示存在反射式 DLL 注入。
步骤 5:代码注入检测(Malfind)
# Vol2
vol.py -f mem.raw --profile=PROFILE malfind -p PID
vol.py -f mem.raw --profile=PROFILE malfind -D /tmp/dump/ # dump injected sections
# Vol3
vol -f mem.raw windows.malfind --pid PID
malfind 的检测内容:具有 PAGE_EXECUTE_READWRITE 属性且未映射到磁盘文件的内存区域——这是典型的 shellcode/注入指标。
步骤 6:凭据提取
# Vol2
vol.py -f mem.raw --profile=PROFILE hashdump # SAM hashes
vol.py -f mem.raw --profile=PROFILE lsadump # LSA secrets
vol.py -f mem.raw --profile=PROFILE cachedump # domain cached creds
vol.py -f mem.raw --profile=PROFILE mimikatz # (plugin) plaintext creds
# Vol3
vol -f mem.raw windows.hashdump
vol -f mem.raw windows.lsadump
vol -f mem.raw windows.cachedump
步骤 7:文件提取
# Vol2
vol.py -f mem.raw --profile=PROFILE filescan | grep -i "password\|secret\|flag"
vol.py -f mem.raw --profile=PROFILE dumpfiles -Q OFFSET -D /tmp/dump/
# Vol3
vol -f mem.raw windows.filescan
vol -f mem.raw windows.dumpfiles --virtaddr OFFSET
步骤 8:注册表分析
# Vol2
vol.py -f mem.raw --profile=PROFILE hivelist
vol.py -f mem.raw --profile=PROFILE printkey -K "Software\Microsoft\Windows\CurrentVersion\Run"
vol.py -f mem.raw --profile=PROFILE userassist # program execution evidence
# Vol3
vol -f mem.raw windows.registry.hivelist
vol -f mem.raw windows.registry.printkey --key "Software\Microsoft\Windows\CurrentVersion\Run"
步骤 9:命令历史记录
# Vol2
vol.py -f mem.raw --profile=PROFILE cmdscan # cmd.exe history
vol.py -f mem.raw --profile=PROFILE consoles # full console output
# Vol3
vol -f mem.raw windows.cmdline
步骤 10:生成时间线
# Vol2
vol.py -f mem.raw --profile=PROFILE timeliner --output=body --output-file=timeline.body
mactime -b timeline.body -d > timeline.csv
# Vol3
vol -f mem.raw timeliner.Timeliner
4. Linux 内存分析
# Vol2 (requires Linux profile)
vol.py -f mem.lime --profile=LinuxProfile linux_pslist
vol.py -f mem.lime --profile=LinuxProfile linux_pstree
vol.py -f mem.lime --profile=LinuxProfile linux_netstat
vol.py -f mem.lime --profile=LinuxProfile linux_bash # bash history
vol.py -f mem.lime --profile=LinuxProfile linux_enumerate_files
vol.py -f mem.lime --profile=LinuxProfile linux_proc_maps -p PID
vol.py -f mem.lime --profile=LinuxProfile linux_malfind
# Vol3
vol -f mem.lime linux.pslist
vol -f mem.lime linux.pstree
vol -f mem.lime linux.bash
vol -f mem.lime linux.check_afinfo # rootkit detection
vol -f mem.lime linux.check_syscall # syscall hooking
vol -f mem.lime linux.tty_check # TTY hooking
构建 Linux 配置文件(Vol2)
cd volatility/tools/linux
make
# Creates module.dwarf + System.map → zip as profile
zip LinuxProfile.zip module.dwarf /boot/System.map-$(uname -r)
# Place in volatility/plugins/overlays/linux/
5. 内存中的恶意软件指标
| 指标 | 检测方法 | 含义 |
|---|---|---|
| 进程出现在 psscan 中但未出现在 pslist 中 | 对比 pslist 与 psscan | DKOM — 进程隐藏 |
| 异常的父子关系 | pstree 分析 | 例如,svchost 由 cmd.exe 启动 |
| 非映像内存中存在 MZ 标头 | malfind | 反射式 DLL / PE 注入 |
| RWX 内存没有关联文件 | malfind | Shellcode 注入 |
| DLL 从所有 PEB 列表中解除链接 | ldrmodules(全部为 False) | 隐蔽加载 DLL |
| svchost.exe 不是 services.exe 的子进程 | pstree | 伪造的 svchost(恶意软件) |
| 异常网络连接 | netscan + PID 关联 | C2 通信 |
| SSDT/IDT 中的挂钩 | ssdt / idt 插件 | Rootkit |
| 内核对象已修改 | linux_check_syscall | Linux Rootkit |
正常的父子进程关系(Windows)
System (4)
└── smss.exe
└── csrss.exe
└── wininit.exe
└── services.exe
└── svchost.exe (multiple)
└── spoolsv.exe
└── lsass.exe
└── winlogon.exe
└── explorer.exe
└── user applications
6. 决策树
Memory dump acquired — need to analyze
│
├── What OS?
│ ├── Windows → vol imageinfo / windows.info (§3 Step 1)
│ └── Linux → build profile or use Vol3 auto-detect (§4)
│
├── Malware investigation?
│ ├── Check processes: pslist vs psscan (hidden?) (§3 Step 2)
│ ├── Check parent-child: pstree (suspicious spawning?) (§5)
│ ├── Check injections: malfind (RWX memory?) (§3 Step 5)
│ ├── Check DLLs: ldrmodules (unlinked?) (§3 Step 4)
│ ├── Check network: netscan (C2 connections?) (§3 Step 3)
│ └── Extract suspicious files: dumpfiles (§3 Step 7)
│
├── Credential recovery?
│ ├── SAM hashes → hashdump (§3 Step 6)
│ ├── LSA secrets → lsadump (§3 Step 6)
│ ├── Cached domain creds → cachedump (§3 Step 6)
│ └── Plaintext passwords → mimikatz plugin (§3 Step 6)
│
├── Incident timeline?
│ ├── timeliner for comprehensive timeline (§3 Step 10)
│ ├── cmdscan / consoles for command history (§3 Step 9)
│ ├── userassist for program execution (§3 Step 8)
│ └── Cross-reference with PCAP timeline (→ traffic-analysis-pcap)
│
├── CTF / flag hunting?
│ ├── filescan + grep for flag patterns (§3 Step 7)
│ ├── cmdscan for typed flags/passwords (§3 Step 9)
│ ├── Clipboard: clipboard plugin
│ ├── Screenshots: screenshot plugin
│ └── Environment vars: envars plugin
│
└── Linux-specific?
├── linux_bash for shell history (§4)
├── linux_check_syscall for rootkit (§4)
└── linux_netstat for connections (§4)
评论
支持 Markdown