x64dbg-mcp-server
- Type
- Skill
- Scanned
- Nov 12, 2026
- Version
- e26dc6a639b3
- Files read
- 15
This native x64dbg plugin starts a local HTTP MCP server that lets AI coding agents control the debugger, read or patch process memory, and load or attach to Windows processes. Because the server grants full code execution through debugger commands, a prompt-injected agent (including through the SearchForStrings tool marked read-only) or anyone who obtains the HTTP Bearer token—such as when a non-IP bind setting like localhost silently exposes the unencrypted server on 0.0.0.0—can launch arbitrary executables and write files on the host.
What it can reach
- System
- Loads and runs any executable on the machine in x64dbg, attaches to running processes by PID, suspends or resumes threads, and reads, allocates, or patches live process memory and CPU registers.
- Files
- Reads and writes mcp_config.json next to x64dbg.exe, saves debugger databases, and dumps process memory or loaded modules to any file path on disk.
- Network
- Starts an unencrypted HTTP and SSE listener on startup (default 127.0.0.1:9094 on x64 and 127.0.0.1:9095 on x32, configurable to 0.0.0.0) protected by an auto-generated Bearer token.
- Other
- Runs arbitrary internal x64dbg commands via DbgCmdExec and copies the auth token to the Windows clipboard from the configuration dialog.
Findings
-
MediumDebugger command injection in read-only SearchForStrings and other command-backed tools
SearchForStrings is advertised to MCP clients with readOnlyHint set to true, which many AI coding agents auto-approve without prompting the user. However, it builds a raw command string by pasting searchText inside quotes and passing it to DbgCmdExec. If prompt-injected text tricks the agent into searching for a string containing a quote and semicolon, x64dbg breaks out of the search argument and runs arbitrary debugger commands such as launching executables with init or writing files with savedata. Other tools including SetBreakpoint, SetConditionalBreakpoint, DumpMemory, AnalyzeCode, SetRegister, Assemble, and LoadBinary similarly interpolate unsanitized strings into DbgCmdExec.
Fix: Reject or escape double quotes, semicolons, carriage returns, and newlines in every parameter passed to DbgCmdExec or DbgCmdExecDirect, or implement SearchForStrings directly over DbgMemRead.
-
MediumInvalid bind address such as localhost silently binds the server to 0.0.0.0
When parsing the configured bind address, parseIpAddr returns 0 (INADDR_ANY, meaning 0.0.0.0 across all network interfaces) whenever it encounters any non-digit character, hostname, IPv6 address, or malformed IPv4 literal, and the configuration dialog only checks that the field is non-empty. If a user enters localhost, ::1, or 127.0.0.1 with a trailing space expecting local-only access, the server silently exposes full debugger control on every network interface over unencrypted HTTP while still displaying localhost in the UI and log.
Fix: Validate that the IP field is a valid IPv4 address (or explicitly map localhost to 127.0.0.1) before saving, and fall back to 127.0.0.1 rather than 0.0.0.0 if parsing fails.
-
MediumUnchecked integer overflow when parsing malformed or packed PE headers crashes x64dbg
Tools meant to inspect untrusted or packed binaries (DetectOEP, AnalyzeModule, GetImports, GetExports, SearchSymbols, ListSymbols, and GetFunctions) read 32-bit offsets and sizes directly from the debugged process memory and add them using unchecked integer arithmetic. A packed or crafted binary with large section VirtualAddress and VirtualSize values (or e_lfanew on 32-bit x32dbg) overflows 32-bit addition, causing a Zig panic in ReleaseSafe builds that immediately terminates x64dbg.exe or triggering undefined behavior in ReleaseFast builds.
Fix: Widen 32-bit PE header offsets and sizes to u64 or use saturating or checked addition before comparing ranges or reading debuggee memory.
-
MediumSO_REUSEADDR on Windows allows local port hijacking and auth token interception
Unlike POSIX systems, setting SO_REUSEADDR on a Windows TCP listening socket permits another process on the same computer—even under an unprivileged account—to bind to the same port and intercept incoming connections. Because x64dbg is often run elevated as Administrator while MCP clients connect over plaintext HTTP, a lower-privileged local process can hijack port 9094 or 9095, steal the Authorization Bearer token from an incoming client request, and use it to execute arbitrary programs inside the elevated x64dbg session.
Fix: Use Winsock SO_EXCLUSIVEADDRUSE instead of SO_REUSEADDR on the listening socket so other local processes cannot steal the bound port.
-
LowMulti-threaded network plugin compiled with single_threaded = true and no synchronization
Both plugin binaries are built with single_threaded = true, which strips thread synchronization from Zig's standard library, even though the plugin spawns Win32 background server, per-connection client, and dialog threads while also receiving callbacks on x64dbg's debug thread. Shared mutable buffers such as pending_events, sse_clients, and event_log are read and modified across threads without locks or atomics, so concurrent tool polling (such as WaitForEvent alongside another request or callback) can underflow pending_count and crash x64dbg.
Fix: Remove single_threaded = true in build.zig, guard shared state (pending_events, sse_clients, event_log) with a mutex, and set a receive timeout and concurrency cap on client sockets.
-
LowAuth token stored in application directory instead of user-private profile
The plugin saves mcp_config.json containing the plaintext Bearer token next to x64dbg.exe with inherited folder permissions rather than inside the current user's private profile directory. On shared multi-user Windows workstations or analysis VMs where x64dbg is installed in a shared tools folder, other local users can read mcp_config.json and authenticate to an active debugging session.
Fix: Store mcp_config.json under the current user's %APPDATA% directory or apply a restrictive DACL granting access only to the current user.
