gef-mcp-for-ctf
GEF MCP Server v2.0
玄幕安全团队 - guaidao2 开发 🛡️
GDB Enhanced Features 的 Model Context Protocol (MCP) 服务器实现,支持通过 SSE 或 stdio 进行远程调试。专为安全测试和 CTF 竞赛优化。
特性
GEF/GDB 集成: 自动加载 GEF 插件,提供增强调试能力
多会话: 最多 4 个并发调试会话
SSE + stdio 双模式: 远程 HTTP SSE 或本地 Claude Desktop stdio
PTY 终端: 真实终端模拟,支持交互式调试
41 个专用工具: 覆盖调试、内存操作、二进制分析、CTF exploit 开发全流程
CTF 定向增强: checksec、ROP 搜索、format-string 检测、patch、assemble 等
安全防护: 路径注入消杀、换行防护、输出大小限制
后台僵尸回收: 自动清理崩溃的会话
安装
cd /root/Desktop/gef-mcp
pip install -r requirements.txt安装 GEF(如未安装)
bash -c "$(curl -fsSL https://gef.blah.cat/sh)"使用
# SSE 模式 (默认 :8000)
python server.py
# 指定地址和端口
python server.py --host 127.0.0.1 --port 8080
# stdio 模式 (Claude Desktop)
python server.py --transport stdioMCP 端点
SSE 端点:
http://localhost:8000/sse消息端点:
http://localhost:8000/messages/
工具列表
会话管理
工具 | 描述 |
| 创建新调试会话 |
| 列出所有活跃会话 |
| 关闭会话 |
文件与启动
工具 | 描述 |
| 加载目标二进制 |
| 加载文件 + 显示 GEF 上下文 |
断点
工具 | 描述 |
| 设置断点 (函数/地址/文件:行) |
| 按编号删除断点 |
| 列出所有断点/监视点 |
| 设置数据断点 (读/写/访问) |
执行控制
工具 | 描述 |
| 运行程序 (带参数) |
| 继续执行 |
| 单步进入 |
| 单步跳过 |
寄存器 / 栈
工具 | 描述 |
| 获取 CPU 寄存器 |
| 函数调用回溯 |
| 当前栈帧详细信息 |
反汇编
工具 | 描述 |
| 反汇编代码 |
内存操作
工具 | 描述 |
| 检查内存 (x/16xg) |
| 向内存写入值 |
| GEF patch 修改字节 |
| 十六进制 + ASCII 视图 |
| 递归解引用 (望远镜) |
| 搜索内存模式 |
| 搜索可打印字符串 |
GEF 增强
工具 | 描述 |
| 虚拟内存映射 |
| 堆信息 |
| 🔐 安全缓解措施检查 |
| GOT/PLT 信息 |
| 完整调试上下文 |
| 节区信息 |
| 入口点地址 |
| ELF 文件头信息 |
| 重置 GEF 缓存 |
CTF 专用 🔥
工具 | 描述 |
| 搜索 ROP gadgets |
| 列出所有 gadgets |
| 附加到进程 |
| 从进程分离 |
| 检测格式化字符串漏洞 |
| 写入汇编指令 |
| 写入 NOP chain |
| 任意 GEF/GDB 命令 |
与 Claude Desktop 集成
{
"mcpServers": {
"gef": {
"command": "python",
"args": ["/root/Desktop/gef-mcp/server.py", "--transport", "stdio"]
}
}
}安全说明
filepath参数经过注入消杀,拒绝含有!;|等 shell 元字符的路径pattern参数拒绝换行符,防止命令注入execute_command按设计执行任意命令——请确保调用来源可信所有会话输出有 50KB 大小限制,防止内存膨胀
调试流程示例 (CTF)
# 1. 创建会话
session = await call_tool("create_session", {})
sid = session["session_id"]
# 2. 加载目标
await call_tool("load_file", {"session_id": sid, "filepath": "./vuln"})
# 3. 安全检查
sec = await call_tool("checksec", {"session_id": sid})
# → NX: enabled | PIE: disabled | Canary: enabled ...
# 4. 查看内存布局
map = await call_tool("vmmap", {"session_id": sid})
# 5. 断点 + 运行
await call_tool("set_breakpoint", {"session_id": sid, "location": "main"})
await call_tool("run", {"session_id": sid})
# 6. 搜索 ROP gadgets
gadgets = await call_tool("rop_search", {"session_id": sid, "gadget": "pop rdi"})
# 7. 检查 GOT
got = await call_tool("got_plt", {"session_id": sid})
# 8. 修改内存
await call_tool("write_memory", {
"session_id": sid,
"address": "0x601040",
"value": "0xdeadbeef"
})许可证
MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/guaidao2/gef-mcp-for-ctf'
If you have feedback or need assistance with the MCP directory API, please join our Discord server