Siddharthh1611/MemForensics
GitHub: Siddharthh1611/MemForensics
一个基于行为分析的内存取证全栈框架,通过混合调度 Volatility 插件并关联 MITRE ATT&CK 规则来自动化检测 RAM 转储中的无文件恶意软件。
Stars: 1 | Forks: 0
# 🔬 MemForensics
**一个基于行为的内存取证框架,用于检测无文件恶意软件**
这是一个全栈 Web 应用程序,能够接收 RAM dumps,运行 Volatility 2 & 3 插件,关联行为指标,并通过交互式仪表盘直观展示无文件恶意软件。
## 架构
```
┌──────────────────────────────────────────────────────────────┐
│ Browser (React) │
│ Upload → Engine Select → Status Tracker → Dashboard │
└───────────────────────────┬──────────────────────────────────┘
│ HTTP/REST
┌───────────────────────────▼──────────────────────────────────┐
│ FastAPI Backend (:8000) │
│ /upload /analysis /analyses /report /health │
└─────────┬──────────────────────────┬────────────────────────-┘
│ Celery task │ Motor (async)
┌─────────▼────────────┐ ┌─────────▼──────────┐
│ Redis (broker) │ │ MongoDB │
│ + result backend │ │ (results store) │
└─────────┬────────────┘ └────────────────────-┘
│ worker
┌─────────▼──────────────────────────────────────────────────-─┐
│ Celery Worker │
│ ┌──────────┐ ┌──────────┐ ┌──────────────────────────┐ │
│ │ Vol2 Svc │ │ Vol3 Svc │ │ Correlation Engine │ │
│ │ imageinfo│ │ pslist │ │ - Encoded PowerShell │ │
│ │ pslist │ │ netscan │ │ - Process Injection │ │
│ │ netscan │ │ malfind │ │ - Parent/Child │ │
│ │ malfind │ │ dlllist │ │ - Network Anomalies │ │
│ │ ... │ │ ... │ │ - DLL Anomalies │ │
│ └──────────┘ └──────────┘ │ - LOLBin Abuse │ │
│ └──────────────────────────┘ │
└──────────────────────────────────────────────────────────────┘
```
## 快速开始
```
# 克隆并启动
git clone
cd memforensics
# 启动所有服务
docker-compose up --build
# 打开 dashboard
open http://localhost:3000
```
服务:
| 服务 | 端口 | 描述 |
|----------|-------|------------------------------|
| Frontend | 3000 | React 仪表盘 (nginx) |
| Backend | 8000 | FastAPI REST API + Swagger |
| MongoDB | 27017 | 分析结果存储 |
| Redis | 6379 | Celery broker |
## 功能
### 分析模式
| 模式 | 描述 |
|---------|----------------------------------------------------|
| Hybrid | Vol2 + Vol3 并行执行 — 覆盖面最大 |
| Vol3 | 现代、快速的分析;无需 profile 检测 |
| Vol2 | 传统模式;通过 imageinfo 自动检测 profile |
### Volatility 3 插件
- `windows.pslist` — 进程列表
- `windows.pstree` — 进程树
- `windows.cmdline` — 命令行
- `windows.netscan` — 网络连接
- `windows.malfind` — 内存区域异常
- `windows.dlllist` — 已加载的 DLLs
### Volatility 2 插件
- 通过 `imageinfo` 自动检测 profile
- `pslist`, `pstree`, `cmdline`, `netscan`, `malfind`, `dlllist`
### 检测规则(关联引擎)
| 规则 | 评分 | MITRE 技术 |
|-------------------------|-------|------------------------------|
| 编码的 PowerShell | +3 | T1059.001 |
| 进程注入 | +5 | T1055 |
| 可疑的父子进程关系 | +3 | T1566 / T1059 |
| 系统进程网络连接 | +4 | T1071 |
| C2 端口连接 | +4 | T1095 |
| 脚本引擎网络连接 | +4 | T1059.001 |
| 可疑的 DLL 路径 | +2 | T1574 |
| 重复的系统进程 | +4 | T1036 (Masquerading) |
| certutil 滥用 | +3 | T1140 |
| mshta 远程执行 | +5 | T1218.005 |
**阈值**:评分 ≥ 7 → 可疑 | 评分 ≥ 10 → 恶意
## API 参考
```
POST /api/v1/upload Upload RAM dump
GET /api/v1/upload/{file_id} File metadata
POST /api/v1/analysis Start analysis
GET /api/v1/analysis/{task_id} Full results
GET /api/v1/analysis/{task_id}/summary Lightweight summary
GET /api/v1/analyses List all analyses
DELETE /api/v1/analysis/{task_id} Delete task
GET /api/v1/report/{task_id}/json Download JSON report
GET /api/v1/report/{task_id}/html Download HTML report
GET /api/v1/health Service health check
```
Swagger UI: http://localhost:8000/docs
## 项目结构
```
memforensics/
├── docker-compose.yml
├── .env.example
│
├── backend/
│ ├── Dockerfile
│ ├── Dockerfile.worker
│ ├── requirements.txt
│ └── app/
│ ├── main.py FastAPI entry point
│ ├── core/
│ │ ├── config.py Settings (env vars)
│ │ ├── database.py MongoDB async client
│ │ └── celery_app.py Celery factory
│ ├── api/
│ │ ├── uploads.py Upload endpoints
│ │ ├── analysis.py Analysis endpoints
│ │ └── reports.py Report + health endpoints
│ ├── models/
│ │ └── schemas.py Pydantic models
│ ├── services/
│ │ ├── vol2_service.py Volatility 2 integration
│ │ ├── vol3_service.py Volatility 3 integration
│ │ ├── output_parser.py Normalize plugin output
│ │ ├── correlation_engine.py Malware detection rules
│ │ └── report_service.py JSON/HTML report generation
│ └── workers/
│ └── analysis_worker.py Celery task
│
└── frontend/
├── Dockerfile
├── nginx.conf
├── package.json
├── vite.config.js
└── src/
├── App.jsx Router + nav
├── index.css Global styles
├── services/api.js Axios API client
├── hooks/useAnalysisPoller.js Live polling hook
└── pages/
├── UploadPage.jsx Upload + engine select
├── AnalysesPage.jsx Task history list
└── DashboardPage.jsx Results + charts
```
## 配置
所有设置均由环境变量驱动(参见 `.env.example`)。
关键设置:
```
SUSPICION_THRESHOLD=7 # Score to flag as suspicious
PLUGIN_TIMEOUT=300 # Seconds per plugin
ANALYSIS_TIMEOUT=3600 # Max total analysis time
MAX_UPLOAD_SIZE_MB=4096 # 4 GB RAM dumps
VOL2_PATH=/opt/volatility2/vol.py
VOL3_PATH=/usr/local/bin/vol
```
## 报告输出
完成分析后:
- **JSON**:结构化的机器可读报告,用于 SIEM 接入
- **HTML**:带有样式的人类可读报告,供分析人员审查
## 注意事项
- Vol2 需要 Python 2 和正确的 profile;profile 通过 `imageinfo` 自动检测
- Vol3 需要 Python 3 和 `volatility3` pip 包
- 对于生产环境,请在环境中设置 `SECRET_KEY` 并限制 CORS 来源
- Worker 并发数默认设置为 2;增加该数值可加快并行分析速度
标签:搜索引擎查询, 请求拦截, 逆向工具