Skip to main content

Vibe reversing with IDA Pro

Project description

IDA Pro MCP

Simple MCP Server to allow vibe reversing in IDA Pro.

https://github.com/user-attachments/assets/6ebeaa92-a9db-43fa-b756-eececce2aca0

The binaries and prompt for the video are available in the mcp-reversing-dataset repository.

Available functionality:

  • check_connection: Check if the IDA plugin is running.
  • get_metadata(): Get metadata about the current IDB.
  • get_function_by_name(name): Get a function by its name.
  • get_function_by_address(address): Get a function by its address.
  • get_current_address(): Get the address currently selected by the user.
  • get_current_function(): Get the function currently selected by the user.
  • convert_number(text, size): Convert a number (decimal, hexadecimal) to different representations.
  • list_functions(offset, count): List all functions in the database (paginated).
  • decompile_function(address): Decompile a function at the given address.
  • disassemble_function(start_address): Get assembly code (address: instruction; comment) for a function.
  • get_xrefs_to(address): Get all cross references to the given address.
  • get_entry_points(): Get all entry points in the database.
  • set_comment(address, comment): Set a comment for a given address in the function disassembly and pseudocode.
  • rename_local_variable(function_address, old_name, new_name): Rename a local variable in a function.
  • rename_function(function_address, new_name): Rename a function.
  • set_function_prototype(function_address, prototype): Set a function's prototype.
  • set_local_variable_type(function_address, variable_name, new_type): Set a local variable's type.

Prerequisites

  • Python (3.10 or higher)
    • Use idapyswitch to switch to the newest Python version
  • IDA Pro (8.3 or higher, 9 recommended)
  • Supported MCP Client (pick one you like)

Installation

Install (or upgrade) the IDA Pro MCP package:

pip install --upgrade git+https://github.com/mrexodia/ida-pro-mcp

Configure the MCP servers and install the IDA Plugin:

ida-pro-mcp --install

Prompt Engineering

LLMs are prone to hallucinations and you need to be specific with your prompting. For reverse engineering the conversion between integers and bytes are especially problematic. Below is a minimal example prompt, feel free to start a discussion or open an issue if you have good results with a different prompt:

You task is to analyze a crackme in IDA Pro. You can use the MCP tools to retrieve information. In general use the following strategy:

  • Inspect the decompilation and add comments with your findings
  • Rename variables to more sensible names
  • Change the variable and argument types if necessary (especially pointer and array types)
  • Change function names to be more descriptive
  • If more details are necessary, disassemble the function and add comments with your findings
  • NEVER convert number bases yourself. Use the convert_number MCP tool if needed!
  • Do not attempt brute forcing, derive any solutions purely from the disassembly and simple python scripts
  • Create a report.md with your findings and steps taken at the end
  • When you find a solution, prompt to user for feedback with the password you found

This prompt was just the first experiment, please share if you found ways to improve the output!

Manual Installation

Note: This section is for LLMs and power users who need detailed installation instructions.

Manual MCP Server Installation (Cline/Roo Code)

To install the MCP server yourself, follow these steps:

  1. Install uv globally:
    • Windows: pip install uv
    • Linux/Mac: curl -LsSf https://astral.sh/uv/install.sh | sh
  2. Clone this repository, for this example C:\MCP\ida-pro-mcp.
  3. Navigate to the Cline/Roo Code MCP Servers configuration (see screenshot).
  4. Click on the Installed tab.
  5. Click on Configure MCP Servers, which will open cline_mcp_settings.json.
  6. Add the ida-pro-mcp server:
{
  "mcpServers": {
    "github.com/mrexodia/ida-pro-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "c:\\MCP\\ida-pro-mcp",
        "run",
        "ida-pro-mcp",
        "--install-plugin"
      ],
      "timeout": 1800,
      "disabled": false,
      "autoApprove": [
        "check_connection",
        "get_metadata",
        "get_function_by_name",
        "get_function_by_address",
        "get_current_address",
        "get_current_function",
        "convert_number",
        "list_functions",
        "decompile_function",
        "disassemble_function",
        "get_xrefs_to",
        "get_entry_points",
        "set_comment",
        "rename_local_variable",
        "rename_function",
        "set_function_prototype",
        "set_local_variable_type"
      ],
      "alwaysAllow": [
        "check_connection",
        "get_metadata",
        "get_function_by_name",
        "get_function_by_address",
        "get_current_address",
        "get_current_function",
        "convert_number",
        "list_functions",
        "decompile_function",
        "disassemble_function",
        "get_xrefs_to",
        "get_entry_points",
        "set_comment",
        "rename_local_variable",
        "rename_function",
        "set_function_prototype",
        "set_local_variable_type"
      ]
    }
  }
}

To check if the connection works you can perform the following tool call:

<use_mcp_tool>
<server_name>github.com/mrexodia/ida-pro-mcp</server_name>
<tool_name>check_connection</tool_name>
<arguments></arguments>
</use_mcp_tool>

IDA Plugin installation

The IDA Pro plugin will be installed automatically when the MCP server starts. If you disabled the --install-plugin option, use the following steps:

  1. Copy (not move) src/ida_pro_mcp/mcp-plugin.py in your plugins folder (%appdata%\Hex-Rays\IDA Pro\plugins on Windows).
  2. Open an IDB and click Edit -> Plugins -> MCP to start the server.

Comparison with other MCP servers

There are a few IDA Pro MCP servers floating around, but I created my own for a few reasons:

  1. Installation should be fully automated.
  2. The architecture of other plugins make it difficult to add new functionality quickly (too much boilerplate of unnecessary dependencies).
  3. Learning new technologies is fun!

If you want to check them out, here is a list (in the order I discovered them):

Feel free to open a PR to add your IDA Pro MCP server here.

Development

Adding new features is a super easy and streamlined process. All you have to do is add a new @jsonrpc function to mcp-plugin.py and your function will be available in the MCP server without any additional boilerplate! Below is a video where I add the get_metadata function in less than 2 minutes (including testing):

https://github.com/user-attachments/assets/951de823-88ea-4235-adcb-9257e316ae64

To test the MCP server itself:

uv run fastmcp dev server.py

This will open a web interface at http://localhost:5173 and allow you to interact with the MCP tools for testing.

For testing I create a symbolic link to the IDA plugin and then POST a JSON-RPC request directly to http://localhost:13337/mcp.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ida_pro_mcp-1.2.0.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ida_pro_mcp-1.2.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file ida_pro_mcp-1.2.0.tar.gz.

File metadata

  • Download URL: ida_pro_mcp-1.2.0.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.5

File hashes

Hashes for ida_pro_mcp-1.2.0.tar.gz
Algorithm Hash digest
SHA256 326b92ec5368b1407c7e5d4deb798b620451ff21d782e6633a1387d07e5adf87
MD5 df0a18dc1b6d63fac4e56022aed9c32a
BLAKE2b-256 e487b3f042b297e78fc7209e0bfea3e094c227eb1600aeb92556203140f0a338

See more details on using hashes here.

File details

Details for the file ida_pro_mcp-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ida_pro_mcp-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa6eaf67b41b2c371b9ba57f350ef981227f5ee411e5a33b005df852c8aac3df
MD5 933b764a953375e9e75d5b11823aebff
BLAKE2b-256 eb653717cb90f29bac15f530282101bf39229ee615e0278f47f02873ffb3e74a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page