zixuantemp/flarevm-mcp
GitHub: zixuantemp/flarevm-mcp
一个通过 MCP 协议桥接 Kali 与 FlareVM 的自动化 Windows 恶意软件分析平台。
Stars: 0 | Forks: 0
# FlareVM MCP 服务器
[](#available-tools)
[](#mcp-capabilities)
[](#mcp-capabilities)
[](LICENSE)
[](pyproject.toml)
一个模型上下文协议(MCP)服务器,通过统一接口提供对 [FlareVM](https://github.com/mandiant/flare-vm) 上 Windows 恶意软件分析工具的远程访问。这使得 AI 代理和安全分析师能够在无需手动操作工具的情况下执行全面的恶意软件分析和逆向工程任务。该项目旨在实现代理 AI 集成,并简化与 FlareVM 的文件传输,同时保持其隔离性。
## 快速安装
三种支持的安装路径:
**一键安装器(Kali / Debian)**
```
curl -sSL https://raw.githubusercontent.com/zixuantemp/flarevm-mcp/main/install.sh | bash
```
在 `~/.flarevm-mcp/venv` 创建虚拟环境,安装软件包,并将
你的 FlareVM 密码存储在系统密钥环中。
**pip(任何 Linux / macOS / WSL)**
```
pip install git+https://github.com/zixuantemp/flarevm-mcp.git
flarevm-mcp # runs the MCP server on stdio
```
**Docker**
```
docker run -i --rm \
-e FLAREVM_HOST=192.168.100.10 \
-e FLAREVM_USER=xtemp \
-e FLAREVM_PASSWORD=infected \
ghcr.io/zixuantemp/flarevm-mcp
```
安装后,使用你的 MCP 客户端(`~/.claude/.mcp.json` 或
`claude_desktop_config.json`)进行注册 —— 安装程序会打印一个可直接粘贴的代码片段。
## MCP 能力
此服务器实现了完整的 MCP 能力集:
- **工具(48)** — 查看 [`resources/tools-reference.md`](resources/tools-reference.md)。
- **提示(5)** — 预置的常见任务工作流。请查看 [`prompts/`](prompts/)。
- `triage_unknown_sample`、`behavioral_analysis`、`unpack_workflow`、
`injection_hunt`、`persistence_audit_report`。
- **资源(5)** — 实时和静态参考材料:
- `flarevm://tools/inventory` — 对每个配置的工具执行 `Test-Path`,实时检测。
- `flarevm://config/fakenet-default` — 生成的 FakeNet 配置。
- `flarevm://docs/yara-rules` — 已安装的 YARA 规则列表与索引。
- `flarevm://docs/cheatsheet` — 常见工作流配方。
- `flarevm://status/connection` — FlareVM 运行状况实时检查。
- **技能(3)** — Claude Code 技能包,位于 [`skills/`](skills/):
`triage-malware-sample`、`incident-response-windows`、`automated-unpacking`。
## 安全
检测运行在 **可丢弃的虚拟机** 中,绝不在分析主机上运行。请参阅
[SECURITY.md](SECURITY.md) 了解完整的威胁模型、凭证处理规则以及漏洞报告方式。
## 许可证
[MIT](LICENSE) — 版权所有 (c) 2026 zixuantemp。
## 什么是 FlareVM MCP?
**FlareVM MCP** 旨在桥接你的分析环境(通常是 Kali Linux)与隔离的 Windows 恶意软件分析虚拟机(FlareVM),实现在 Linux 和 Windows 环境中的分析能力。它通过 MCP 协议暴露 40+ 个恶意软件分析工具,允许:
- **远程文件操作** — 上传/下载样本与工件
- **静态分析** — 打包器检测(DIEC)、能力分析(CAPA)、字符串提取(FLOSS)
- **动态分析** — 进程监控、网络监控、注册表追踪
- **调试器** — x64dbg 脚本、WinDbg 崩溃分析
- **仪器化** — 用于运行时 API 监控的 Frida 钩子
- **IDA Pro 集成** — 通过 RPC 进行反编译与注释
### 架构概览
```
┌─────────────────────────────────┐
│ AI Agent / Claude Code │
│ (Kali Linux / Local Machine) │
└────────────────┬────────────────┘
│
MCP (stdio)
│
┌────────▼─────────┐
│ FlareVM MCP │
│ Server │
│ (Python/FastMCP)│
└────────┬─────────┘
│
┌────────────┼────────────────────────┐
│ │ │
WinRM SMB Share IDA RPC
│ │ (localhost)
│ │ │
┌───▼────────────▼─────────────────────┐ │
│ FlareVM (Windows VM) │ │
│ ┌──────────────────────────────────┐ │ │
│ │ Malware Analysis Tools: │ │ │
│ │ - Procmon (process monitoring) │ │ │
│ │ - DIE (packer detection) │ │ │
│ │ - FLOSS (string extraction) │ │ │
│ │ - CAPA (capability analysis) │ │ │
│ │ - x64dbg (debugger) │ │ │
│ │ - WinDbg (dump analysis) │ │ │
│ │ - Frida (dynamic instrumentation)│ │ │
│ │ - FakeNet-NG (network sim) │ │ │
│ │ - Autoruns (persistence) │ │ │
│ │ - Regshot (registry monitoring) │ │ │
│ │ - IDA Pro (reverse engineering) │ │ │
│ └──────────────────────────────────┘ │ │
│ │ │
│ IDA Pro Server (port 13337)──────────┘ │
└────────────────────────────────────────┘
```
## 当前功能
### 文件传输操作
- **`upload_file`** — 从 Kali 上传文件到 FlareVM(>8KB 使用 SMB,<8KB 使用 WinRM)
- **`download_file`** — 将分析工件下载回 Kali
- 自动 SHA256 校验和验证以确保完整性
### 基础系统工具
- **`check_connection`** — 验证 WinRM 连接并获取系统信息
- **`execute_powershell`** — 运行任意 PowerShell 命令
- **`read_file`** — 远程读取文件内容
- **`get_file_hash`** — 计算 MD5/SHA1/SHA256 哈希
- **`list_processes`** — 枚举运行中的进程(可选过滤)
### 动态分析
- **`procmon_start`** — 启动 Process Monitor(可选进程过滤)
- **`procmon_stop`** — 停止 Process Monitor 捕获
- **`procmon_export_csv`** — 将 PML 日志导出为 CSV 以供分析
- **`execute_with_monitoring`** — 执行二进制文件并全程监控(Process Monitor + 网络)
- **`monitor_network_realtime`** — 实时网络连接监控
- **`process_hacker_info`** — 通过 Process Hacker 获取详细进程信息
- **`regshot_snapshot`** — 注册表快照(前后对比分析)
- **`autoruns_analyze`** — 分析自启动程序与持久化项
### 静态分析
- **`die_analyze`** — 使用 DetectItEasy(DIEC)检测编译器/打包器
- **`floss_extract_strings`** — 使用 FLOSS 提取混淆字符串
- **`capa_analyze`** — 使用 CAPA 框架识别恶意软件能力
### 动态仪器化
- **`frida_list_processes`** — 列出可用于 Frida 注入的进程
- **`frida_spawn_and_attach`** — 启动并附加 Frida 到进程
- **`frida_attach_pid`** — 通过 PID 附加到运行中的进程
- **`frida_run_script`** — 执行 Frida 仪器化脚本
### 调试与分析
- **`x64dbg_load`** — 在 x64dbg GUI 中启动可执行文件
- **`x64dbg_run_script`** — 创建并执行 x64dbg 脚本
- **`windbg_analyze_dump`** — 使用 WinDbg 分析崩溃转储
### 网络模拟
- **`fakenet_start`** — 启动 FakeNet-NG 网络模拟
- **`fakenet_stop`** — 停止 FakeNet-NG 并获取日志
### IDA Pro 集成(FlareVM 中未内置)
- **`ida_get_metadata`** — 获取已加载二进制文件的元数据
- **`ida_list_functions`** — 分页列出函数
- **`ida_decompile_function`** — 将函数反编译为伪代码
- **`ida_disassemble_function`** — 获取汇编列表
- **`ida_list_strings`** — 列出二进制文件中的字符串
- **`ida_set_comment`** — 在 IDA 中添加/修改注释
- **`ida_rename_function`** — 重命名函数
## 系统要求
### 主机机器(Kali/分析端)
- Python 3.10+
- `python3-winrm` — Windows 远程管理库
- `smbclient` — 用于大文件传输
- `python-keyring` — 用于凭证存储
- `fastmcp` — MCP 服务器框架
### FlareVM(Windows 分析虚拟机)
- **操作系统**:Windows 10/11
- **WinRM**:已启用并配置为远程访问
- **SMB 共享**:可选但推荐(名为 `KaliShare`)
- **所需工具**:
- Procmon(SysInternals)
- x64dbg
- WinDbg
- DIEC(DetectItEasy CLI)
- FLOSS
- CAPA
- Frida for Windows
- FakeNet-NG
- Autoruns(SysInternals)
- Regshot
- IDA Pro(可选,用于 IDA 工具)
## 安装
### 1. 克隆仓库
```
cd /home/kali
git clone https://github.com/zixuantemp/flarevm-mcp.git
cd flarevm-mcp
```
### 2. 安装依赖
```
# Requires Python > 3.10
pip install -r requirements.txt
sudo apt-get install smbclient
```
### 3. 配置凭据
```
# Store FlareVM credentials in system keyring
python3 << 'EOF'
import keyring
# Configure based on your FlareVM setup
FLAREVM_HOST = "192.168.100.128" # Adjust to your VM IP
FLAREVM_USER = "USER" # Adjust to your username
FLAREVM_PASSWORD = "your_password" # Your password
# Store password securely
keyring.set_password("flarevm", FLAREVM_USER, FLAREVM_PASSWORD)
print(f"✓ Credentials stored for {FLAREVM_USER}@{FLAREVM_HOST}")
EOF
```
### 4. 更新配置
编辑 `.py` 以匹配你的环境:
```
FLAREVM_HOST = "192.168.100.10" # Your FlareVM IP
FLAREVM_USER = "xtemp" # Your Windows username
SMB_SHARE_NAME = "KaliShare" # Your SMB share name
SMB_LOCAL_PATH = "C:\\Share" # SMB mount point on FlareVM
```
### 5. 配置 MCP 服务器
用于 Claude Code 或其他 MCP 客户端,添加到你的 MCP 配置:
**Claude Code**(`~/.claude/claude.json`):
```
{
"mcp_servers": {
"flarevm": {
"command": "python3",
"args": ["/home/kali/mcp-flare/server.py"],
"env": {
"PYTHONUNBUFFERED": "1"
}
}
}
}
```
或
```
claude mcp add flare-mcp python3 /path/to/server.py
```
**其他 MCP 客户端**,请根据其文档进行配置。
### 6. 验证安装
```
# Test connection
python3 << 'EOF'
import asyncio
import json
from pathlib import Path
import sys
sys.path.insert(0, '/home/kali/mcp-flare')
async def test():
# This will attempt to load the server
print("✓ Server module loads successfully")
print("✓ All dependencies installed")
asyncio.run(test())
EOF
```
## 配置指南
### WinRM 设置(在 FlareVM 上)
1. **启用 WinRM**:
```
# On FlareVM, run as Administrator:
Enable-PSRemoting -Force
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force
Restart-Service WinRM
```
2. **从 Kali 验证连接性**:
```
python3 << 'EOF'
import winrm
session = winrm.Session(
"192.168.100.128",
auth=("USER", "password"),
transport='plaintext'
)
result = session.run_ps("Write-Output 'Hello from FlareVM'")
print(result.std_out.decode())
EOF
```
### SMB 共享设置(可选)
对于大文件传输(>8KB),在 FlareVM 上配置 SMB 共享:
1. 创建共享:
```
New-Item -Path "C:\Share" -ItemType Directory -Force
New-SmbShare -Name "KaliShare" -Path "C:\Share" -FullAccess "Everyone"
```
2. 从 Kali 测试:
```
smbclient //192.168.100.128/KaliShare -U xtemp -c "ls"
```
### IDA Pro 集成
如果使用 IDA Pro 工具:
1. 在 FlareVM 上安装 IDA Pro
2. 安装 IDA Pro MCP 插件:https://github.com/mandiant/ida-pro-mcp
3. 在 `localhost:13337` 启动 IDA Pro 并监听 MCP
4. 在 FlareVM 上验证:
```
netstat -ano | findstr :13337
```
## 使用示例
### 1. 快速恶意软件排查
```
# Using with Claude Code or Python
from mcp_client import MCPClient
client = MCPClient("flarevm")
# Upload sample
client.call("upload_file", {
"local_path": "/home/kali/samples/malware.exe",
"remote_path": "C:\\temp\\sample.exe"
})
# Get static analysis
die_result = client.call("die_analyze", {
"file_path": "C:\\temp\\sample.exe"
})
print(f"Packer: {die_result}")
# Extract strings
strings = client.call("floss_extract_strings", {
"file_path": "C:\\temp\\sample.exe"
})
# Get capabilities
capa_result = client.call("capa_analyze", {
"file_path": "C:\\temp\\sample.exe"
})
```
### 2. 动态分析带监控
```
# Monitor process execution
result = client.call("execute_with_monitoring", {
"executable": "C:\\temp\\sample.exe",
"arguments": "--test",
"duration": 30
})
# Download procmon logs
client.call("download_file", {
"remote_path": result["ProcmonLog"],
"local_path": "/home/kali/analysis/procmon_logs.pml"
})
```
### 3. 使用 Frida 进行 API 钩子
```
# Hook Windows API during execution
frida_script = """
Interceptor.attach(Module.findExportByName("kernel32.dll", "CreateProcessW"), {
onEnter: function(args) {
console.log("[*] CreateProcess called with: " + args[1].readUtf16String());
}
});
"""
result = client.call("frida_run_script", {
"target": "sample.exe",
"script_content": frida_script
})
```
### 4. 使用 x64dbg 进行交互式调试
```
# Load in debugger
client.call("x64dbg_load", {
"executable": "C:\\temp\\sample.exe"
})
# Create breakpoint script
script = """
bp 0x00401000
BreakOnDll(kernel32.dll, false)
bp CreateProcessW
"""
client.call("x64dbg_run_script", {
"script_content": script
})
```
### 5. 使用 IDA Pro 进行分析
```
# Decompile function
decomp = client.call("ida_decompile_function", {
"address": "0x00401000"
})
# Add comment
client.call("ida_set_comment", {
"address": "0x00401000",
"comment": "Entry point - possible C2 setup"
})
# Rename function
client.call("ida_rename_function", {
"function_address": "0x00401050",
"new_name": "decrypt_config"
})
```
### 6. 持久性分析
```
# Check autostart programs
autoruns = client.call("autoruns_analyze")
# Take registry snapshots
before = client.call("regshot_snapshot", {
"action": "first",
"output_dir": "C:\\temp\\regshot"
})
# Run malware
client.call("execute_with_monitoring", {
"executable": "C:\\temp\\sample.exe",
"duration": 30
})
# Compare after
after = client.call("regshot_snapshot", {
"action": "second",
"output_dir": "C:\\temp\\regshot"
})
comparison = client.call("regshot_snapshot", {
"action": "compare",
"output_dir": "C:\\temp\\regshot"
})
```
## 建议的配置
### 配置 1:最小分析实验室
**组件**:
- Kali Linux 虚拟机(4GB RAM,20GB 存储)
- FlareVM Windows 10(8GB RAM,50GB 存储)
- 网络:隔离实验室网络(无互联网)
- 存储:用于样本/日志的共享文件夹
**启用的工具**:
- Procmon、x64dbg、DIE、FLOSS、CAPA
**适用场景**:快速排查、静态分析、基础动态分析
**预估搭建时间**:2-3 小时
### 配置 2:高级研究实验室
**组件**:
- Kali Linux(独立主机,8GB+ RAM)
- 多个 FlareVM 快照(每种样本类型一个)
- IDA Pro 用于逆向工程
- 网络:隔离 + FakeNet 用于网络连接的恶意软件
- 存储:500GB+ 用于分析工件
**启用的工具**:
- 所有工具:Procmon、x64dbg、WinDbg、DIE、FLOSS、CAPA、Frida、IDA Pro、FakeNet
**工作流程**:
1. 静态分析(DIE、FLOSS、CAPA)
2. 动态分析(Procmon、网络监控)
3. 交互式调试(x64dbg、Frida)
4. 深度逆向工程(IDA Pro)
**适用场景**:专业恶意软件分析、研究、威胁情报
**预估搭建时间**:8-10 小时
### 配置 3:自动化分析流水线
**组件**:
- Kali Linux(自动化主机)
- FlareVM(自动化分析)
- 消息队列(可选 Redis/RabbitMQ)
- 数据库(SQLite/MongoDB)用于存储结果
**工作流程**:
```
Sample Upload → Static Analysis → Dynamic Analysis → Report Generation
```
**适用场景**:批量样本分析、蜜罐集成、安全运营自动化
**预估搭建时间**:1-2 天
## API 参考
### 工具分类
#### 文件传输
- `upload_file(local_path, remote_path)`
- `download_file(remote_path, local_path)`
#### 系统操作
- `check_connection()`
- `execute_powershell(command)`
- `read_file(path)`
- `get_file_hash(path, algorithm)`
- `list_processes(filter?)`
#### 动态分析
- `procmon_start(output_file, process_filter?)`
- `procmon_stop()`
- `procmon_export_csv(pml_file, csv_file)`
- `execute_with_monitoring(executable, arguments?, duration?)`
- `monitor_network_realtime(duration?, process_filter?)`
- `process_hacker_info(process_name_or_pid)`
- `regshot_snapshot(action, output_dir)`
- `autoruns_analyze(verify_signatures?)`
#### 静态分析
- `die_analyze(file_path)`
- `floss_extract_strings(file_path, min_length?)`
- `capa_analyze(file_path)`
#### 调试
- `x64dbg_load(executable, script_file?)`
- `x64dbg_run_script(script_content, save_path?)`
- `windbg_analyze_dump(dump_file, commands?)`
#### Frida 仪器化
- `frida_list_processes()`
- `frida_spawn_and_attach(executable, script_path)`
- `frida_attach_pid(pid, script_path)`
- `frida_run_script(target, script_content)`
#### 网络模拟
- `fakenet_start(config_file?)`
- `fakenet_stop()`
#### IDA Pro
- `ida_get_metadata()`
- `ida_list_functions(offset, count)`
- `ida_decompile_function(address)`
- `ida_disassemble_function(start_address)`
- `ida_list_strings(offset, count)`
- `ida_set_comment(address, comment)`
- `ida_rename_function(function_address, new_name)`
## 故障排除
### 连接问题
**问题**:"could not read Username for ... No such device or address"
```
Solution: Verify FlareVM IP is reachable
ping 192.168.100.10
```
**问题**:"WinRM connection timeout"
```
Solution: Enable WinRM on FlareVM
Run as Administrator on FlareVM:
Enable-PSRemoting -Force
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force
```
**问题**:"Keyring password not found"
```
Solution: Store credentials in keyring
python3 -c "import keyring; keyring.set_password('flarevm', 'xtemp', 'password')"
```
### 文件传输问题
**问题**:"SMB connection failed"
```
Solution:
1. Verify SMB share exists: net share
2. Check network connectivity: ping
3. Verify credentials: smbclient -U user
```
**问题**:"File upload verification failed"
```
Solution: Check available disk space on remote machine
diskspace C:\temp\
```
### 工具执行
**问题**:"Tool not found" 错误
```
Solution: Verify tool path in server.py matches your FlareVM installation
Check: C:\Tools\sysinternals\Procmon.exe
```
**问题**:"Permission denied" 文件操作
```
Solution: Ensure running WinRM as user with appropriate permissions
Run: whoami on FlareVM
```
## 安全注意事项
### 隔离
- 始终在隔离网络(无互联网,除非必要)上运行 FlareVM
- 为分析环境与生产系统使用独立凭据
- 在执行未知二进制文件前对 FlareVM 创建快照
### 凭据管理
- 使用系统密钥环(不要硬编码密码)
- 定期轮换凭据
- 为 WinRM 使用最小权限用户账户
### 网络安全
- 仅限制 WinRM 访问受信任网络
- 如通过不可信网络连接,使用 VPN
- 监控 WinRM 流量异常
### 恶意软件安全
- **永远不要**在主机上执行未知二进制文件
- **始终**在 FlareVM 中使用可疑恶意软件
- 在行为分析前验证 VM 快照
- 对网络连接的恶意软件使用 FakeNet
## 贡献
欢迎贡献!请:
1. 叉取仓库
2. 创建功能分支(`git checkout -b feature/amazing-feature`)
3. 为新功能添加测试
4. 更新文档
5. 提交拉取请求
## 许可证
本项目按原样提供,仅用于安全研究与恶意软件分析目的。
## 参考
- [FlareVM GitHub](https://github.com/mandiant/flare-vm)
- [模型上下文协议](https://modelcontextprotocol.io/)
- [WinRM 文档](https://docs.microsoft.com/en-us/windows/win32/winrm/about-windows-remote-management)
- [Frida 动态仪器化](https://frida.re/)
- [IDA Pro MCP 插件](https://github.com/mandiant/ida-pro-mcp)
## 支持
如有问题、疑问或建议:
- 在 GitHub 上提交问题
- 查看现有文档
- 阅读特定文档
**最后更新**:2026-04-17
**版本**:1.0.0
标签:AI辅助分析, DAST, Docker, FlareVM, MCP服务器, Python, SEO, Triage, Windows恶意软件, 一键安装, 云资产清单, 关键词丰富, 合规性检查, 复合剧本, 安全防御评估, 工具编排, 恶意软件分析, 持久化审计, 无后门, 样本分析, 模型上下文协议, 自动化分析, 解包, 请求拦截, 跨站脚本, 远程工具访问, 逆向工具, 逆向工程, 隔离环境, 集成