sahilsinghi/memory-forensics-triage

GitHub: sahilsinghi/memory-forensics-triage

基于 Volatility 3 的自动化内存取证分流工具,通过并行插件执行和 IOC 数据库匹配实现 60 秒内快速判定内存转储是否被入侵。

Stars: 0 | Forks: 0

# 内存取证分流工具 [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/a1dacfd830222349.svg)](https://github.com/sahilsinghi/memory-forensics-triage/actions) [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/) [![Volatility 3](https://img.shields.io/badge/volatility-3.x-green.svg)](https://github.com/volatilityfoundation/volatility3) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) 自动化的内存取证分流工具,封装了 **Volatility 3**,支持**并行运行 12 个插件**,针对涵盖 10 个 APT/勒索软件行为者的 **500 条指标的 IOC 数据库** 扫描输出结果,并生成精美的 **HTML 分流报告**。 本项目旨在作为一个作品集项目,连接起**内存取证**、**威胁情报**和 **SOC 运营**——作为 [Network Segmentation Lab](../network-segmentation-lab/) 和 [APT Profiler](../apt-threat-actor-profiler/) 项目的补充。 ## 快速演示 ``` ================================================================ Memory Forensics Triage Tool | Volatility 3 ================================================================ Dump : /path/to/win11_20260617_1430.raw Format : HTML IOC DB : data/iocs/ (10 actors, 500 indicators) Profile : auto-detect ================================================================ [1/5] Validating memory dump … OK — OS profile detected: Windows10x64_19041 [2/5] Running 12 Volatility 3 plugins in parallel (max 6 workers) … Done — 11/12 plugins succeeded, 1 errors, total 47.3s [3/5] Scanning output against IOC database … Done — 3 IOC match(es) found [4/5] Scoring process risk … Done — 89 processes scored [5/5] Generating report … ================================================================ VERDICT: COMPROMISED (overall risk score: 85/100) Top suspect: malware.exe (PID 1234) — 85/100 Report : reports/triage_win11_20260617_143012.html ================================================================ ``` ## 安装 ``` # Clone 仓库 git clone https://github.com/sahilsinghi/memory-forensics-triage.git cd memory-forensics-triage # 创建 virtual environment python3.11 -m venv .venv source .venv/bin/activate # macOS/Linux # .venv\Scripts\activate # Windows # 安装 dev dependencies pip install -e ".[dev]" ``` ## 使用说明 ### 基础用法(HTML 报告) ``` triage --dump /path/to/memory.raw ``` ### JSON 报告(用于 SIEM 摄取) ``` triage --dump memory.raw --output json --out-dir /tmp/reports/ ``` ### 自定义 IOC 数据库 ``` triage --dump memory.raw --ioc-db /my/custom/iocs/ --verbose ``` ### 使用 OS 配置提示(更快检测) ``` triage --dump memory.raw --profile Win10x64_19041 ``` ### 所有选项 ``` Options: -d, --dump PATH Path to memory dump file [required] -o, --output [html|json] Report format [default: html] --ioc-db PATH IOC YAML directory [default: data/iocs/] --out-dir PATH Output directory [default: .] --profile TEXT Volatility OS profile hint -v, --verbose Enable debug logging --help Show this message and exit ``` ## IOC 数据库 本工具自带涵盖 **10 个威胁行为者画像**的 **约 500 条指标**: | 行为者 | 类型 | 关键 TTP | |---|---|---| | LockBit 3.0 | 勒索软件 | Global\\{BEF7C86E...} mutex, StealBit exfil | | Conti | 勒索软件 | TrickBot/BazarLoader, Cobalt Strike | | APT29 (Cozy Bear) | 间谍活动 | SUNBURST, WellMess, MiniDuke | | Lazarus Group | 朝鲜 (DPRK) | ThreatNeedle, HOPLIGHT, Maui 勒索软件 | | FIN7 | 电子犯罪 | BOOSTWRITE, Lizar RAT, POS scraper | | APT41 | 军民双用 | PlugX, ShadowPad, Winnti rootkit | | Carbanak | 银行业 | ATM 监控,针对 SWIFT | | Turla | 间谍活动 | Snake rootkit, ComRAT, LightNeuron | | Equation Group | 关联 NSA | DoublePulsar, EternalBlue, GrayFish | | DarkSide | 勒索软件 | Colonial Pipeline TTP, rclone exfil | 指标类型:`process_name`, `mutex`, `network_ip`, `file_path`, `registry_key` ## 风险评分模型 | 信号 | 分值 | |---|---| | Malfind 命中(RWX 私有内存) | +40 | | 可疑的父进程 | +20 | | 进程位于 TEMP/AppData/异常路径 | +15 | | 意料之外的出站网络连接 | +15 | | IOC 数据库匹配 | 每次命中 +10 | | 合法 Windows 进程(白名单) | 分数 ÷ 2 | **判定结论**:干净 < 30 | 可疑 30-69 | 已被入侵 ≥ 70 ## 项目结构 ``` memory-forensics-triage/ ├── src/triage/ │ ├── cli.py # Click CLI entry point │ ├── validator.py # Dump validation + OS detection │ ├── orchestrator.py # Parallel plugin execution │ ├── ioc_scanner.py # IOC matching engine │ ├── risk_scorer.py # Per-process risk scoring │ ├── report_html.py # Jinja2 HTML report generator │ ├── report_json.py # JSON report for SIEM ingestion │ ├── audit_log.py # Structured JSONL audit logging │ └── plugins/ # 12 Volatility 3 plugin wrappers ├── data/iocs/ # 10 threat actor YAML files ├── templates/ # report.html.j2 (Tailwind CSS) ├── tests/ # pytest suite (no real dump needed) ├── docs/ # Architecture, IOC database guide └── examples/ # Stuxnet, Cridex download instructions ``` ## 运行测试 ``` # 完整测试套件(无需 memory dump —— 全部已 mock) .venv/bin/pytest tests/ -v # 特定测试文件 .venv/bin/pytest tests/test_ioc_scanner.py -v # 带有 coverage .venv/bin/pytest tests/ --cov=triage --cov-report=term-missing ``` ## 跨作品集桥接 —— SOC 检测实验室 此工具旨在补充 Sahil 的 **[Network Segmentation Lab](../network-segmentation-lab/)** 项目: 1. 在 SOC 实验室 Windows 虚拟机上运行 Atomic Red Team 模拟 2. 触发可被 malfind 检测到的注入 (T1055) 和网络 C2 (T1071) 3. 获取 UTM 内存快照并转换为 RAW 格式 4. 运行 `triage` 以检测所有 12 个内存插件中的痕迹 5. 与网络分段实验室中的 Suricata NIDS 告警进行交叉关联 完整操作指南:`docs/soc-lab-bridge.md` ## 添加新的 IOC ``` # 添加到现有的 actor 文件中 vim data/iocs/lockbit.yml # 或者创建一个新的 actor cp data/iocs/lockbit.yml data/iocs/newactor.yml ``` 完整的 schema 和质量检查清单请参阅 `docs/adding-new-iocs.md`。 ## 完成定义 (Definition of Done) - [x] 12 个 Volatility 3 插件封装(pslist, psscan, pstree, malfind, netscan, netstat, cmdline, handles, dlllist, modscan, mutantscan, svcscan) - [x] 通过 ThreadPoolExecutor 实现并发插件执行(最大 6 个 worker) - [x] 优雅的错误处理 —— 单个插件失败不会中断分流 - [x] 包含 10 个行为者(约 500 条指标)的 IOC 数据库,源自公开报告 - [x] 带有 5 个加权信号和进程白名单的风险评分器 - [x] 精美的 HTML 报告(Tailwind CSS,带颜色编码的判定横幅) - [x] 用于 SIEM 摄取的 JSON 报告 - [x] 结构化的 JSONL 审计日志 - [x] 无需真实内存转储即可通过的 pytest 测试套件 - [x] 包含 `--dump`, `--output`, `--ioc-db`, `--out-dir`, `--profile`, `--verbose` 的 CLI - [x] 包含 Mermaid 图表的架构文档 - [x] SOC 实验室桥接文档 - [x] 公开样本下载指南(Stuxnet, Cridex) - [x] GitHub Actions CI 工作流 ## 示例运行输出 ``` ================================================================ VERDICT: COMPROMISED (overall risk score: 85/100) Top suspect: malware.exe (PID 1234) — 85/100 Report : reports/triage_win11_20260617_143012.html ================================================================ Suspect Process Breakdown (top 5): malware.exe PID 1234 Score: 85 COMPROMISED - malfind: executable private memory (PAGE_EXECUTE_READWRITE) - IOC database match (3 hits): LockBit C2 IP, LockBit mutex - suspicious image path: C:\Users\Public\malware.exe cmd.exe PID 5678 Score: 30 SUSPICIOUS - suspicious parent: cmd.exe spawned by malware.exe lsass.exe PID 888 Score: 0 CLEAN - (no flags) IOC Matches: 185.220.101.45 network_ip LockBit CRITICAL netscan malware.exe (1234) Global\{BEF7C86E-...} mutex LockBit CRITICAL mutantscan lockbit.exe process_name LockBit CRITICAL pslist (not found) ```
标签:Python, SecList, 内存取证, 威胁情报, 安全规则引擎, 库, 应急响应, 开发者工具, 无后门, 自动化分类, 逆向工具