pwndbg-mcp

pwndbg-mcp

An MCP tool that enables AI agents to debug ELF binaries, particularly for CTF pwn challenges.

Category
访问服务器

README

pwndbg-mcp

中文说明

An MCP tool endows AI agent with the capability to debug ELF. This tool is designed for regular CTF challenges, especially pwn ones.

Python version GitHub License

[!IMPORTANT] It's recommended to use a tmux skill and pwndbg skill, and provide AI agent with a tmux session instead. Controlling pwndbg with MCP requires lots of tokens, and it's hard to support debugging with python script. Reference our 0RAYS/codex-pwner. (Though AI agent tends to use raw tools like reading /proc/mem to get information...)

Quickstart

As currently this repo has not been published on PyPI, clone this repo with

$ git clone https://github.com/RocketMaDev/pwndbg-mcp.git

Then use uv (install it if you don't have it) to pull dependencies and build venv, or install it as a tool.

$ uv tool install pwndbg-mcp
$ pwndbg-mcp
# or clone pwndbg-mcp and run it with uv manually

[!CAUTION] DON'T EXPOSE YOUR MCP SERVICE TO PUBLIC IF YOU DON'T DO ISOLATION! The tool load_executable, execute_command (GDB command) and eval_to_send_to_process may lead to remote code execution.

By default starting pwndbg-mcp without args launch a mcp server at localhost:8780 with gdb as main pwndbg binary, /mcp as mcp connection end point, and HTTP streamable as transport. Here is some help information:

usage: main.py [-h] [--transport {stdio,http,sse}] [--host HOST] [--port PORT] [--pwndbg BIN] [--d2dname NAME] [--d2dhost HOST] [--d2dport PORT]

pwndbg-mcp: An MCP tool endows AI agent with the capability to debug ELF

options:
  -h, --help            show this help message and exit
  --transport {stdio,http,sse}, -t {stdio,http,sse}
                        Transport mode: stdio, http (streamable HTTP, default), or sse
  --host HOST, -H HOST  Host for HTTP/SSE modes (default: localhost)
  --port PORT, -p PORT  Port for HTTP/SSE modes (default: 8780)
  --pwndbg BIN, -b BIN  pwndbg binary to launch (default: gdb)
  --d2dname NAME, -d NAME
                        Decomp2dbg section display name. Set this to enable decomp2dbg support
  --d2dhost HOST, -D HOST
                        Decomp2dbg connection host
  --d2dport PORT, -P PORT
                        Decomp2dbg connection port

It is recommended to wrap pwndbg-mcp in minimal container like bwrap since some agents like Claude Code wants to execute binary under the same directory as where it runs. Putting pwndbg-mcp in regular container like docker may lead to file path change.

The following line ro-bind your root, map your home as writable but temporary (any write action will not affect your home directory on disk), then bind common file systems, start a new pid namespace and finally start a bash.

$ bwrap --ro-bind / / --overlay-src ~ --tmp-overlay ~ --dev-bind /dev /dev --proc /proc --tmpfs /tmp --unshare-pid bash

Screenshot

<img width="2560" height="1100" alt="claude code with pwndbg-mcp" src="https://github.com/user-attachments/assets/4ea1508c-9a56-4541-ad93-28c4301dcc62" />

Preview tools

  • GDB related
    1. load_executable
    2. execute_command
    3. pwndbg_status (may be incorrect)
    4. debug_control
    5. connect_decomp2dbg
    6. pwndbg_hard_reset
  • Interact with process
    1. send_to_process
    2. eval_to_send_to_process (has access to pwntools)
    3. read_from_process
    4. interrupt_process (the same as press Ctrl-C)
  • pwndbg aliases
    1. telescope
    2. context
    3. heap
    4. bins
    5. backtrace
    6. vmmap
    7. xinfo

Use TOON as return format as it's both human-readable and token-saving.

Pros & Cons

This project draw some inspiration from pwno-mcp, and has some advantages and disadvantages.

Pros

  1. pwndbg-mcp utilizes GDB/MI for direct communication with GDB, no echo hacks
  2. Interrupts are sent via tty, just like typing Ctrl-C on keyboard, no need to keep pid
  3. eval_to_send_to_process provides AI with the ability to send any binary data

Cons

  1. All communication are encapsulated and user can not observe gdb status
  2. This project targets local debugging, thus each instance only keep one GDB session
  3. Focused on debugging, requires other MCP to work together, e.g. IDA Pro MCP
  4. Sometimes Ctrl-C kills process or can't wake up GDB. No idea how this happens

Future roadmap

Please click :star: STAR and open issues (but don't spam) to push me developing these excellent features!

  • [x] Integrate with decomp2dbg
  • [ ] Integrate with pwntools (gdb.debug/gdb.attach)
  • [ ] Attach to local process (untested)
  • [ ] Attach to remote gdbserver (untested)

Credits

pwno-mcp: Provides great bootstrap framework for pwndbg-mcp

Contribution

Contributions are welcome! But no vibe coding (sending content all generated by AI is not allowed) and spams.

LICENSE

Copyright (C) 2025-present, RocketDev, distributed under MIT License.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选