mcpField
P
performing-memory-forensics-with-volatility3

performing-memory-forensics-with-volatility3

github.com/mukul975安全35.2k82 次安装8 周前更新
代码仓库

关于 performing-memory-forensics-with-volatility3

这是一份面向事件响应人员和取证分析师的 Volatility 3 内存取证操作指南,涵盖从识别系统与进程到扫描恶意软件、提取敏感数据和整理报告的流程。

主要功能

  1. 01识别内存镜像中的操作系统
  2. 02枚举进程并查找隐藏进程
  3. 03分析网络连接与注册表
  4. 04提取凭据和敏感数据
  5. 05使用 YARA 扫描恶意软件
  6. 06汇总分析结果并生成报告

适用场景

  1. 01调查入侵系统中的恶意进程或注入代码
  2. 02排查 rootkit 与隐藏进程
  3. 03从内存中提取凭据或加密密钥
  4. 04在关机前分析勒索软件内存

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill performing-memory-forensics-with-volatility3

安装后在 Claude Code 中输入/performing-memory-forensics-with-volatility3确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

LICENSE
SKILL.es.md
references/
api-reference.md
scripts/
agent.py

详细介绍

使用 Volatility 3 执行内存取证

何时使用

  • 分析来自已失陷或可疑系统的 RAM 转储时
  • 在事件响应期间识别正在运行的恶意软件、注入代码或 rootkit 时
  • 需要从内存中提取凭据、加密密钥或网络连接时
  • 检测进程镂空、DLL 注入或隐藏进程时
  • 仅靠基于磁盘的取证不足,而易失数据至关重要时

前置条件

  • 已安装 Python 3.7+
  • 已安装 Volatility 3 框架(pip install volatility3)
  • 内存转储为 raw、ELF 或崩溃转储格式
  • 适用于目标操作系统版本的符号表(ISF 文件)
  • 有足够的磁盘空间用于分析输出(内存转储大小的 2-3 倍)
  • 可选:用于在内存中扫描恶意软件的 YARA 规则

工作流

步骤 1:获取内存转储并安装 Volatility 3
# Install Volatility 3
pip install volatility3

# Or install from source for latest features
git clone https://github.com/volatilityfoundation/volatility3.git
cd volatility3
pip install -e .

# Download Windows symbol tables (ISF packs)
# Place in volatility3/symbols/ directory
wget https://downloads.volatilityfoundation.org/volatility3/symbols/windows.zip
unzip windows.zip -d /opt/volatility3/volatility3/symbols/

# Download Linux and Mac symbol packs
wget https://downloads.volatilityfoundation.org/volatility3/symbols/linux.zip
wget https://downloads.volatilityfoundation.org/volatility3/symbols/mac.zip

# Memory acquisition tools (for live systems):
# Windows: winpmem, DumpIt, FTK Imager
# Linux: LiME (Linux Memory Extractor)
sudo insmod lime-$(uname -r).ko "path=/cases/memory/linux_mem.lime format=lime"

# Verify the memory dump
file /cases/case-2024-001/memory/memory.raw
ls -lh /cases/case-2024-001/memory/memory.raw
步骤 2:识别操作系统配置文件
# Run banners plugin to identify the OS
vol -f /cases/case-2024-001/memory/memory.raw banners

# For Windows, identify the OS version
vol -f /cases/case-2024-001/memory/memory.raw windows.info

# Output example:
# Variable        Value
# Kernel Base     0xf8047e200000
# DTB             0x1ad000
# Symbols         ntkrnlmp.pdb/GUID
# Is64Bit         True
# IsPAE           False
# primary layer   Intel32e
# KdVersionBlock  0xf8047ee232c0
# Major/Minor     15.19041
# Machine Type    34404
# KeNumberProcessors 4
# SystemTime      2024-01-18 14:32:15 UTC
# NtBuildLab      19041.1.amd64fre.vb_release.191206-1406
# NtProductType   NtProductWinNt
# NtSystemRoot    C:\WINDOWS
# PE MajorOperatingSystemVersion 10
# PE MinorOperatingSystemVersion 0

# For Linux memory dumps
vol -f /cases/case-2024-001/memory/linux_mem.lime linux.info
步骤 3:枚举进程并检测异常
# List all running processes
vol -f /cases/case-2024-001/memory/memory.raw windows.pslist | tee /cases/case-2024-001/analysis/pslist.txt

# Show process tree (parent-child relationships)
vol -f /cases/case-2024-001/memory/memory.raw windows.pstree | tee /cases/case-2024-001/analysis/pstree.txt

# Detect hidden processes using cross-view analysis
vol -f /cases/case-2024-001/memory/memory.raw windows.psscan | tee /cases/case-2024-001/analysis/psscan.txt

# Compare pslist vs psscan to find hidden processes
diff <(vol -f memory.raw windows.pslist | awk '{print $1}' | sort) \
     <(vol -f memory.raw windows.psscan | awk '{print $1}' | sort)

# List DLLs loaded by a suspicious process (PID 4532)
vol -f /cases/case-2024-001/memory/memory.raw windows.dlllist --pid 4532

# Check for process hollowing and injection
vol -f /cases/case-2024-001/memory/memory.raw windows.malfind | tee /cases/case-2024-001/analysis/malfind.txt

# Dump suspicious process memory for further analysis
vol -f /cases/case-2024-001/memory/memory.raw windows.memmap --pid 4532 --dump \
   -o /cases/case-2024-001/analysis/dumps/
步骤 4:分析网络连接和注册表
# List active network connections
vol -f /cases/case-2024-001/memory/memory.raw windows.netscan | tee /cases/case-2024-001/analysis/netscan.txt

# Filter for established connections
vol -f /cases/case-2024-001/memory/memory.raw windows.netscan | grep ESTABLISHED

# Filter for listening ports
vol -f /cases/case-2024-001/memory/memory.raw windows.netscan | grep LISTENING

# Extract network connections with process mapping
vol -f /cases/case-2024-001/memory/memory.raw windows.netstat | tee /cases/case-2024-001/analysis/netstat.txt

# Dump registry hives from memory
vol -f /cases/case-2024-001/memory/memory.raw windows.registry.hivelist

# Extract specific registry keys
vol -f /cases/case-2024-001/memory/memory.raw windows.registry.printkey \
   --key "Software\Microsoft\Windows\CurrentVersion\Run"

# Check services
vol -f /cases/case-2024-001/memory/memory.raw windows.svcscan | tee /cases/case-2024-001/analysis/services.txt
步骤 5:提取凭据和敏感数据
# Dump cached credentials (hashdump)
vol -f /cases/case-2024-001/memory/memory.raw windows.hashdump | tee /cases/case-2024-001/analysis/hashes.txt

# Extract LSA secrets
vol -f /cases/case-2024-001/memory/memory.raw windows.lsadump

# Dump cached domain credentials
vol -f /cases/case-2024-001/memory/memory.raw windows.cachedump

# Search for plaintext strings in process memory
vol -f /cases/case-2024-001/memory/memory.raw windows.strings --pid 4532 \
   | grep -iE '(password|credential|token|api.key)'

# Extract command history from cmd.exe/powershell
vol -f /cases/case-2024-001/memory/memory.raw windows.cmdline | tee /cases/case-2024-001/analysis/cmdline.txt

# Extract environment variables
vol -f /cases/case-2024-001/memory/memory.raw windows.envars --pid 4532
步骤 6:使用 YARA 规则扫描恶意软件
# Scan memory with YARA rules
vol -f /cases/case-2024-001/memory/memory.raw yarascan \
   --yara-file /opt/yara-rules/malware_index.yar | tee /cases/case-2024-001/analysis/yara_hits.txt

# Scan specific process memory
vol -f /cases/case-2024-001/memory/memory.raw yarascan \
   --yara-file /opt/yara-rules/apt_rules.yar --pid 4532

# Check loaded kernel modules for rootkits
vol -f /cases/case-2024-001/memory/memory.raw windows.modules | tee /cases/case-2024-001/analysis/modules.txt

# Detect unlinked/hidden modules
vol -f /cases/case-2024-001/memory/memory.raw windows.modscan | tee /cases/case-2024-001/analysis/modscan.txt

# Check for SSDT hooks (System Service Descriptor Table)
vol -f /cases/case-2024-001/memory/memory.raw windows.ssdt | grep -v "ntoskrnl\|win32k"

# Dump a suspicious executable from memory
vol -f /cases/case-2024-001/memory/memory.raw windows.dumpfiles --pid 4532 \
   -o /cases/case-2024-001/analysis/extracted/
步骤 7:将发现整理成报告
# Generate comprehensive analysis summary
echo "=== MEMORY FORENSICS REPORT ===" > /cases/case-2024-001/analysis/memory_report.txt
echo "Image: memory.raw" >> /cases/case-2024-001/analysis/memory_report.txt
echo "OS: Windows 10 Build 19041" >> /cases/case-2024-001/analysis/memory_report.txt
echo "" >> /cases/case-2024-001/analysis/memory_report.txt

echo "--- Suspicious Processes ---" >> /cases/case-2024-001/analysis/memory_report.txt
cat /cases/case-2024-001/analysis/malfind.txt >> /cases/case-2024-001/analysis/memory_report.txt

echo "--- Network Connections ---" >> /cases/case-2024-001/analysis/memory_report.txt
cat /cases/case-2024-001/analysis/netscan.txt >> /cases/case-2024-001/analysis/memory_report.txt

echo "--- YARA Matches ---" >> /cases/case-2024-001/analysis/memory_report.txt
cat /cases/case-2024-001/analysis/yara_hits.txt >> /cases/case-2024-001/analysis/memory_report.txt

# Calculate hash of the memory dump for integrity
sha256sum /cases/case-2024-001/memory/memory.raw >> /cases/case-2024-001/analysis/memory_report.txt

关键概念

概念描述
易失数据仅存在于 RAM 中、断电即丢失的信息
进程镂空恶意软件用恶意代码替换合法进程内存的技术
DLL 注入将未经授权的 DLL 加载到正在运行的进程地址空间
EPROCESS表示进程的 Windows 内核结构;进程列表的基础
池扫描在内存中搜索内核对象特征以发现隐藏痕迹
VAD(虚拟地址描述符)跟踪进程虚拟内存区域的内存管理结构
ISF(中间符号格式)Volatility 3 用于操作系统特定结构定义的符号表格式
Malfind通过检查 VAD 权限和内容来检测注入代码的插件

工具与系统

工具用途
Volatility 3主要的开源内存取证框架
LiME用于获取 Linux RAM 转储的 Linux 内存提取器
WinPmemWindows 物理内存获取驱动程序
DumpItComae 一键式 Windows 内存转储工具
YARA用于恶意软件特征扫描的模式匹配引擎
Rekall替代内存取证框架(Google)
MemProcFS用于内存分析的内存进程文件系统
strings从二进制内存转储中提取可打印字符串

常见场景

场景 1:活跃恶意软件调查 使用 DumpIt 获取内存,运行 pslist/pstree 识别可疑进程,使用 malfind 检测 svchost.exe 中的注入代码,转储注入的内存段,使用识别 Cobalt Strike beacon 的 YARA 规则进行扫描,从 netscan 提取 C2 IP,与网络日志关联。

场景 2:入侵后的凭据窃取 运行 hashdump 和 lsadump 提取缓存的凭据,在 cmdline 输出中识别 mimikatz 执行,检查文件系统痕迹中是否存在 lsass.exe 内存转储,与网络连接中的横向移动证据关联。

场景 3:Rootkit 检测 比较 pslist(使用 EPROCESS 链表)与 psscan(池扫描)以发现未链接的进程,检查 modules 与 modscan 以发现隐藏的内核驱动程序,检查 SSDT 是否存在重定向系统调用的钩子,转储可疑模块以进行静态分析。

场景 4:勒索软件事件恢复 在系统关机前从勒索软件进程内存中提取加密密钥,使用 YARA 识别勒索软件变种,通过命令行痕迹找到初始执行点,通过网络连接映射横向移动。

输出格式

Memory Forensics Analysis:
  Image:            memory.raw (16 GB)
  OS Identified:    Windows 10 x64 Build 19041
  Capture Time:     2024-01-18 14:32:15 UTC

  Process Analysis:
    Total Processes:    87
    Hidden Processes:   2 (PIDs: 4532, 6128)
    Injected Processes: 3 (malfind detections)
    Suspicious:         svchost.exe (PID 4532) - injected code at 0x7FFE0000

  Network Connections:
    Total:        45
    Established:  12
    Suspicious:   3 (C2 connections to 185.xx.xx.xx:443)

  Credentials Found:
    NTLM Hashes:      4 accounts
    Cached Creds:      2 domain accounts

  YARA Matches:
    CobaltStrike_Beacon:  PID 4532 (3 hits)
    Mimikatz_Memory:      PID 6128 (1 hit)

  Extracted Artifacts:   15 files dumped to /analysis/extracted/

评论

支持 Markdown