关于 performing-memory-forensics-with-volatility3-plugins
使用 Volatility3 分析内存转储的安全技能,可调查进程、注入代码、模块和网络连接。适用于检查 Windows、Linux 和 macOS 内存的事件响应人员与取证分析师。
主要功能
- 01分析多个操作系统的内存转储
- 02检测注入和隐藏进程
- 03枚举已加载模块与句柄
- 04检查网络连接
- 05使用 YARA 扫描内存
适用场景
- 01调查 RAM 中疑似恶意软件
- 02查找隐藏进程和注入代码
- 03检查内存转储中的网络活动
- 04搜索内存中的已知恶意软件特征
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill performing-memory-forensics-with-volatility3-plugins安装后在 Claude Code 中输入/performing-memory-forensics-with-volatility3-plugins确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
LICENSEassets/template.mdreferences/api-reference.mdstandards.mdworkflows.mdscripts/agent.pyprocess.py详细介绍
使用 Volatility3 插件进行内存取证
概述
Volatility3(v2.26.0+,功能对齐版本于 2025 年 5 月发布)是内存取证的标准框架,取代了旧版的 Volatility2。它分析 Windows、Linux 和 macOS 的 RAM 转储,以检测磁盘取证无法发现的恶意进程、代码注入、rootkit、凭据窃取和网络连接。关键插件包括 windows.malfind(检测表示注入的 RWX 内存区域)、windows.psscan(查找隐藏进程)、windows.dlllist(枚举已加载模块)、windows.netscan(活动网络连接)和 windows.handles(打开的文件/注册表句柄)。2024 年插件竞赛引入了 ETW Scan,用于从内存中提取 Windows 事件跟踪数据。
何时使用
- 在进行安全评估并使用 volatility 插件进行内存取证时
- 在遵循相关安全事件的事件响应流程时
- 在执行安全测试或审计活动时
- 通过动手测试验证安全控制措施时
前提条件
- 已安装
volatility3框架的 Python 3.9+ - 内存转储文件(
.raw、.dmp、.vmem、.lime) - Windows 符号表(ISF 文件,自动下载)
- 了解 Windows 进程内存架构
- 用于内存中扫描的 YARA 集成
工作流
步骤 1:用于恶意软件检测的进程分析
#!/usr/bin/env python3
"""Volatility3-based memory forensics automation for malware analysis."""
import subprocess
import json
import sys
import os
class Vol3Analyzer:
"""Automate Volatility3 plugin execution for malware analysis."""
def __init__(self, dump_path, vol3_path="vol"):
self.dump_path = dump_path
self.vol3 = vol3_path
self.results = {}
def run_plugin(self, plugin, extra_args=None):
"""Execute a Volatility3 plugin and capture output."""
cmd = [
self.vol3, "-f", self.dump_path,
"-r", "json", plugin,
]
if extra_args:
cmd.extend(extra_args)
try:
result = subprocess.run(
cmd, capture_output=True, text=True, timeout=300
)
if result.returncode == 0:
return json.loads(result.stdout)
except (subprocess.TimeoutExpired, json.JSONDecodeError) as e:
print(f" [!] {plugin} failed: {e}")
return None
def detect_process_injection(self):
"""Use malfind to detect injected code regions."""
print("[+] Running windows.malfind (code injection detection)")
results = self.run_plugin("windows.malfind")
injected = []
if results:
for entry in results:
injected.append({
"pid": entry.get("PID"),
"process": entry.get("Process"),
"address": entry.get("Start VPN"),
"protection": entry.get("Protection"),
"hexdump": entry.get("Hexdump", "")[:200],
})
print(f" [!] Injection in PID {entry.get('PID')} "
f"({entry.get('Process')}) at {entry.get('Start VPN')}")
self.results["injected_processes"] = injected
return injected
def find_hidden_processes(self):
"""Compare pslist vs psscan to find hidden processes."""
print("[+] Running process comparison (pslist vs psscan)")
pslist = self.run_plugin("windows.pslist")
psscan = self.run_plugin("windows.psscan")
if not pslist or not psscan:
return []
list_pids = {e.get("PID") for e in pslist}
scan_pids = {e.get("PID") for e in psscan}
hidden = scan_pids - list_pids
if hidden:
print(f" [!] {len(hidden)} hidden processes found!")
for entry in psscan:
if entry.get("PID") in hidden:
print(f" PID {entry['PID']}: {entry.get('ImageFileName')}")
self.results["hidden_processes"] = list(hidden)
return list(hidden)
def analyze_network(self):
"""Extract active network connections."""
print("[+] Running windows.netscan")
results = self.run_plugin("windows.netscan")
connections = []
if results:
for entry in results:
conn = {
"pid": entry.get("PID"),
"process": entry.get("Owner"),
"local": f"{entry.get('LocalAddr')}:{entry.get('LocalPort')}",
"remote": f"{entry.get('ForeignAddr')}:{entry.get('ForeignPort')}",
"state": entry.get("State"),
"protocol": entry.get("Proto"),
}
connections.append(conn)
self.results["network_connections"] = connections
return connections
def extract_dlls(self, pid=None):
"""List loaded DLLs per process."""
print(f"[+] Running windows.dlllist{f' (PID {pid})' if pid else ''}")
args = ["--pid", str(pid)] if pid else None
results = self.run_plugin("windows.dlllist", args)
dlls = []
if results:
for entry in results:
dlls.append({
"pid": entry.get("PID"),
"process": entry.get("Process"),
"base": entry.get("Base"),
"name": entry.get("Name"),
"path": entry.get("Path"),
"size": entry.get("Size"),
})
self.results["loaded_dlls"] = dlls
return dlls
def scan_with_yara(self, rules_path):
"""Scan memory with YARA rules."""
print(f"[+] Running windows.yarascan with {rules_path}")
results = self.run_plugin(
"windows.yarascan",
["--yara-file", rules_path]
)
matches = []
if results:
for entry in results:
matches.append({
"rule": entry.get("Rule"),
"pid": entry.get("PID"),
"process": entry.get("Process"),
"offset": entry.get("Offset"),
})
self.results["yara_matches"] = matches
return matches
def full_triage(self):
"""Run full malware-focused memory triage."""
print(f"[*] Full memory triage: {self.dump_path}")
print("=" * 60)
self.detect_process_injection()
self.find_hidden_processes()
self.analyze_network()
return self.results
if __name__ == "__main__":
if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} <memory_dump>")
sys.exit(1)
analyzer = Vol3Analyzer(sys.argv[1])
results = analyzer.full_triage()
print(json.dumps(results, indent=2, default=str))
验证标准
- 使用正确的操作系统配置文件解析内存转储
- 通过 malfind 检测到具有 RWX 区域的注入进程
- 通过 pslist/psscan 比较识别出隐藏进程
- 网络连接揭示 C2 通信端点
- YARA 规则匹配内存中的已知恶意软件特征
- 从 lsass 进程内存中提取凭据产物
参考
评论
支持 Markdown