---
id: 18681
lang: en
title: "A Local LLM Drives Ghidra and x64dbg via MCP Inside a Virtual Machine"
published_at: "2026-11-30 10:33:17"
source_name: "Habr AI"
source_url: "https://habr.com/ru/articles/1113890/?utm_campaign=1113890&utm_source=habrahabr&utm_medium=rss"
canonical_url: "https://news.hamidun.com/en/news/18681"
categories: ["research", "autonomous"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# A Local LLM Drives Ghidra and x64dbg via MCP Inside a Virtual Machine

> **Краткая суть (BLUF):** Reverse engineers shuttle data by hand between Ghidra (a decompiler that turns a program into readable code) and x64dbg (a debugger that runs it step by step). A Habr write-up hands that routine to a local neural network. Through MCP, a protocol that connects tools to a model, the model calls both programs itself inside a virtual machine. The suspicious file never goes to the cloud. For analyzing protections, this saves hours of work.  - The Ghidra server on port 8080 has no password: keep it inside the virtual machine - Use a context of at least 16–32K tokens, or the tool schemas will push the prompt out - Run Ghidra auto-analysis first, or the tools will return a NO_PROGRAM error

Reverse engineering is the attempt to understand how someone else's program works when there is no source code. Practitioners use two sets of eyes for this. Ghidra is a decompiler: it turns a finished executable into readable pseudocode, but it does not run the program. x64dbg (and its 32-bit version, x32dbg) is a debugger: it launches the file, stops at the line you need, and shows what sits in memory and in the processor registers. The human becomes a "carrier pigeon" between them: copying code from one program into a chat, copying registers from the other back, and recalculating addresses by hand. The author of a recent Habr write-up proposes handing this routine to a local neural network. It connects through MCP, an open protocol that lets a language model call external programs as tools: request a list of functions, set a breakpoint, read memory. All of this happens inside a virtual machine (VM), an isolated "sandbox" from which the file under study never leaves.

The key condition is that everything stays with you. The binary under study, which in reverse engineering is often malicious or protected code, is not sent to cloud APIs. For those who work with third-party code under NDA or analyze malware, this is the decisive point.

## How the setup works

The scheme splits the load into two parts. The host machine with a powerful graphics card handles the heavy work: running inference on the local language model. In the author's example, the model runs through Strata and is exposed over the local network as an OpenAI-compatible API, so any client that can talk to OpenAI connects to it without modification. Inside the virtual machine live the working tools: VS Code with the Cline extension, Ghidra, and the x64dbg or x32dbg debugger.

Cline acts as the agent's brain, and two MCP servers connect to it. The first provides access to static analysis in Ghidra, the second to live debugging. As a result, the model stops being a chatbot that needs long logs fed into it. It requests the function list itself, reads the decompiled code, matches modules in memory, and tests hypotheses at runtime.

## What to install and where

For the debugger, the author uses the duty1g/x64dbg-mcp-server plugin. Its files go into the plugins folders of both debugger versions: the 64-bit one listens on port 9094, the 32-bit one on port 9095. The path to the debugger must not contain Cyrillic characters. The authorization key is copied via the Plugins menu, and each architecture has its own key.

For Ghidra, the author uses the LaurieWired/GhidraMCP extension, version 2.0. There is a common trap: the downloaded archive contains another zip inside it, and in Ghidra you must install that inner zip through Install Extensions. Then the plugin is enabled in the CodeBrowser window, after which the MCP server starts on port 8080. An important detail: it runs without a password or token. While everything stays inside the virtual machine, this is acceptable, but the port should not be exposed to the outside. Additionally, the Python bridge from the release package (a .whl file) is installed, which links Cline with Ghidra's HTTP server.

In the Cline MCP settings, three servers are configured: the two debuggers over streamableHttp with an Authorization header and the "Bearer " prefix before the token, and Ghidra via the command python -m ghidra_mcp. If the indicators turn green, the connection works.

## Model settings and launch order

Connecting the tools is only half the job. The descriptions of the Ghidra and debugger tools are lengthy, and with a small context window (the amount of text the model can hold in mind), the model loses the system prompt or the call history and then starts making up addresses. The author recommends a context of at least 16,384–32,768 tokens, and with sufficient hardware, much more, up to 512 thousand. This is a direct cost trade-off: long context requires video memory, and that memory determines which model you can actually run.

The Custom Instructions should also define roles: Ghidra for function logic, the debugger for runtime data, and always recalculate the module's base address because of ASLR (a system protection that loads programs at new addresses on each launch). The Cline mode must be switched from Plan to Act so the agent calls the tools. For safe read operations, it is convenient to enable Auto-approve, otherwise every function-list request would need manual confirmation.

The launch order is critical. First, the file is imported into Ghidra and goes through auto-analysis; until it finishes, the tools respond with a NO_PROGRAM error. Then the same file is opened in the debugger and stopped at the entry point. If the debugger was restarted, the connection must be refreshed in the MCP Servers list in Cline. After that, a starting prompt is given: the file is analyzed and paused, use both sets of tools.

## What this gives and where the limits are

This combination is useful for protocol analysis, parsing obfuscated (deliberately tangled) logic, and finding license checks. The routine of matching decompiled code against the actual memory state is handled by the agent, while the human verifies the conclusions.

The limitations are also clear. Quality depends on the local model: smaller models more often make mistakes with addresses and with untangling obfuscated code. The article is a build guide, not a benchmark: it contains no figures on speed or accuracy. The agent's results should therefore be checked manually, especially when it draws conclusions about protections. Still, as a template for a safe local setup for agentic reverse engineering, the scheme is worth repeating.

---
- **Первоисточник:** [Habr AI](https://habr.com/ru/articles/1113890/?utm_campaign=1113890&utm_source=habrahabr&utm_medium=rss)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/18681
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
