SuperAPI AI Directory

ida-reverse

Security & auditing

View repository

Updated 10-16 09:28

About this skill

Bundled upstream support

Supporting files are included at skill-relative paths. See UPSTREAM-NOTICE.md for their pinned sources, licenses, hashes, and import changes.

Supporting material availability

These paths remain unavailable in this catalog copy:

  • <support-root>/scripts/start.ps1
  • <support-root>/scripts/install-autostart.ps1

Do not invoke a step that requires one of these files. Obtain the original material and review its dependencies, license, and effects before use. Independent inline steps and the bundled helpers can proceed within the user’s authorized scope.

IDA Pro Reverse Engineering Analysis Skill

When to Use

  • Deep static analysis of a compiled target where IDA is available.
  • Tracking data flow or cross-references through large binaries.

Known Issues and Reflections (Must Read)

Pitfalls Encountered

  1. idb_open(old name idalib_open) Do not directly rely on some AI clients' MCP calls

    • Some code AI clients' MCP clients have a BUG in the output schema validation for open-type tools
    • Error:Structured content does not match the tool's output schema
    • Solution: Use the scripts/open.ps1 script to call directly via HTTP API, bypassing the MCP validation layer
    • The current ida-pro-mcp 2.x tool name is idb_open / idb_list / idb_save(no longer idalib_*)
    • After the file is opened it returns session_id(database), and subsequent tool calls need to carry this session
  2. C:\Windows\System32\ file cannot be opened due to insufficient permissions

    • idalib cannot directly read files in the System32 directory
    • Solution:open.ps1 automatically detects and copies to the 临时目录 directory before opening
  3. The server startup command blocks the conversation

    • idalib-mcp After startup, it continuously outputs INFO logs to the console
    • Solution: Use scripts/start.ps1(-WindowStyle Hidden to start silently in the background)
    • The script waits for the service to be ready and then exits automatically, without blocking the conversation
  4. MCP server names cannot use hyphens

    • Previously used ida-pro-mcp as the server name, which may cause tool registration issues
    • Current configuration: server name idapro, tool prefix idapro_*
  5. Remote HTTP vs Local Stdio

    • type:"local"(stdio) mode:idalib_open also has schema validation issues
    • type:"remote"(HTTP) mode: you can first use the script to open the file directly, then use MCP tools
    • Current approach: Remote HTTP mode
  6. PR #389 fixed some schema issues

    • Author mrexodia merged the fix via PR #389 after issue #388
    • Fixed the structuredContent schema in HTTP mode, but some code AI clients still have validation issues on their side
    • The latest main branch version has been installed
  7. idalib timeout leaves orphan worker process lock files

    • After the first open.ps1 timeout, idalib's python worker subprocess may become orphaned, holding onto .id0/.id1/.nam and not letting go
    • Any subsequent tool or manually dragging it into the IDA GUI will report "insufficient permissions"
    • Prohibited taskkill /F /T kill the process tree—/T will also kill the GUI ida.exe subprocess
    • Solution:start.ps1 only replace the managed supervisor when no one is listening on the port, or when tools/list returns quickly but lacks py_eval(old supervisor); if the RPC times out and 13337 is still listening, treat it as busy and do not kill
    • Fallback:open.ps1 when it detects that the old library is locked, automatically copies to Temp and adds a GUID prefix
  8. Opening with automatic analysis looks like it is stuck

    • idalib_open(run_auto_analysis=true) may not respond for a long time, but the backend is actually still continuing to open and analyze
    • Previously what users saw was "PowerShell has no output the whole time", which is easy to misjudge as the script being stuck
    • Current solution:open.ps1 newly added -TimeoutSeconds, and changed to background request + foreground polling + periodic progress output
    • When polling detects the session is ready, it returns early OK:文件名:session_id, and on timeout returns ERR:open_timeout_xxs
  9. HTTP MCP silently exits after login

    • Cursor/Claude's type: http will not start the process on its behalf; the old scheduled task only runs once at login
    • pythonw has no console, so when it crashes the Application log is also empty
    • Solution:start.ps1 if healthy by default, reuse it;watchdog.ps1 inspect every minute; logs are in %LOCALAPPDATA%\reverse-skill\ida-mcp\
    • Install:scripts/install-autostart.ps1. If the port is not up yet when Cursor starts, you still need to manually refresh once in the MCP panel

Workflow Principles

Step What to do What to use
1 Ensure the HTTP server is running scripts/start.ps1(no arguments)
2 Open the target binary file scripts/open.ps1 -Path "xxx.exe"
3 Use MCP analysis tools Call directly idapro_* / HTTP tools (about 65, depending on version)
4 Analysis complete Tools automatically available

Script Resources

start.ps1 — Start the MCP HTTP server

Path:scripts/start.ps1

  • Automatically resolve IDADIR(environment variable / portable desktop path / common installation path)
  • Prefer IDA's built-in Python314\python.exe -m ida_pro_mcp.idalib_supervisor
  • By default, first probe http://127.0.0.1:13337/mcp, if healthy output OK:<n>:reuse and exit
  • 13337 is listening but tools/list times out → WARN:busy / OK:busy:reuse,do not kill(supervisor is single-threaded and cannot respond while opening the database)
  • Only replace the managed supervisor when no one is listening on the port, or when it returns quickly and lacks py_eval ;never kill ida.exe, do not use taskkill /T
  • When the GUI occupies 13337, output WARN:gui_busy and exit, without starting another supervisor
  • On success output OK:<工具数>(currently about 66), on failure output ERR:timeout
  • supervisor log:%LOCALAPPDATA%\reverse-skill\ida-mcp\supervisor.log
  • The server runs in the background and does not block the conversation

How to call:

powershell -File "<skill-root>\ida-reverse\scripts\start.ps1"

watchdog.ps1 / install-autostart.ps1 — keep-alive

  • watchdog.ps1: probe 13337, if healthy OK:<n>:reuse, only call when it is down start.ps1
  • install-autostart.ps1: register scheduled task reverse-skill-ida-mcp(at login + every minute)
  • Log:%LOCALAPPDATA%\reverse-skill\ida-mcp\watchdog.log

open.ps1 — Open a binary file

Path:scripts/open.ps1

  • Call directly via the HTTP API idb_open, bypassing MCP schema validation
  • Automatically detect the System32 path and copy to a temporary directory
  • Automatically clean up old database files with the same name (.id0/.id1/.nam/.til/.i64)
  • Automatic fallback when the old database is locked: copy to Temp with a GUID prefix and then open, without error
  • Execute the open request in the background to avoid the script becoming unresponsive due to a long synchronous wait
  • Supports -TimeoutSeconds, after timeout returns ERR:open_timeout_xxs, and will not hang indefinitely
  • Output INFO:opening:已用时/超时秒数every 10 seconds, to help determine that analysis is still in progress
  • On success output OK:文件名:session_id, when degraded add (temp copy) marker
  • On failure, automatically retry using the Temp copy

How to call:

powershell -File "<skill-root>\ida-reverse\scripts\open.ps1" -Path "C:\path\to\file.exe"

Optional parameters:

# 指定 SessionId
powershell -File "scripts\open.ps1" -Path "file.exe" -SessionId "my_session"

# 跳过自动分析(大文件推荐)
powershell -File "scripts\open.ps1" -Path "large.exe" -NoAutoAnalysis

# 设置超时,避免带自动分析时长时间无返回
powershell -File "scripts\open.ps1" -Path "file.exe" -TimeoutSeconds 600

Output Conventions:

# 分析进行中(每 10 秒输出一次)
INFO:opening:11/600s

# 成功打开
OK:sample.exe:abcd1234

# 成功打开,但因锁文件降级到 Temp 副本
OK:1234abcd-sample.exe:abcd1234 (temp copy)

# 达到超时上限
ERR:open_timeout_600s

Empirical Notes:

  • Snipaste.exe With automatic analysis, it takes about 324s before it returns success; this counts as "analysis taking a long time," not "script deadlock"
  • Therefore, when encountering GUI programs or relatively complex samples, it is recommended to explicitly set -TimeoutSeconds 600

Core Tool List

Overview Analysis (Step 1)

  • idapro_survey_binary(detail_level="minimal") — Quick overview: function count, strings, segments, entry point, import classification (crypto/network/file IO)
  • idapro_list_funcs(queries) — List functions (pagination, filter by name)
  • idapro_list_globals(queries) — List global variables
  • idapro_entity_query(kind, filter) — Unified query: functions/globals/imports/strings/names

Decompilation and Disassembly

  • idapro_decompile(addr) — Decompile to pseudocode
  • idapro_disasm(addr, max_instructions=N) — Disassemble
  • idapro_analyze_function(addr, include_asm=false) — Comprehensive analysis (pseudocode + strings + constants + callers + callees + blocks)
  • idapro_func_profile(queries) — Function summary metrics

Cross-References and Data Flow

  • idapro_xrefs_to(addrs) — Find who references the target address
  • idapro_xref_query(addr, direction) — Advanced xref query (direction/type filtering)
  • idapro_callees(addrs) — Subfunction list
  • idapro_callgraph(roots, max_depth) — Call graph
  • idapro_trace_data_flow(addr, direction, max_depth) — Data flow tracing (forward/backward)

Search

  • idapro_find_regex(pattern, limit) — Regex string search
  • idapro_search_text(pattern) — Search disassembly listing for text
  • idapro_find_bytes(patterns, limit) — Byte pattern search (supports ?? wildcards)
  • idapro_find(type, targets) — Advanced search (immediates/strings/references)

Memory and Data

  • idapro_get_bytes(addrs) — Read raw bytes
  • idapro_get_string(addrs) — Read string
  • idapro_get_int(queries) — Read integer value
  • idapro_get_global_value(queries) — Read global variable value
  • idapro_read_struct(queries) — Read struct field values
  • idapro_search_structs(filter) — Search structs

Modification Operations

  • idapro_set_comments(items) — Add comment (disassembly + decompilation bidirectional sync)
  • idapro_append_comments(items) — Append comment
  • idapro_rename(batch) — Batch rename (functions/globals/locals/stack variables)
  • idapro_patch_asm(items) — Patch assembly instructions
  • idapro_patch(patches) — Patch bytes
  • idapro_define_func(items) — Define function
  • idapro_undefine(items) — Undefine
  • idapro_define_code(items) — Convert bytes to code

Type System

  • idapro_declare_type(decls) — Declare C structs/enums/unions
  • idapro_set_type(edits) — Apply types to functions/globals/locals
  • idapro_infer_types(addrs) — Infer type
  • idapro_type_query(queries) — Query declared types
  • idapro_type_inspect(queries) — View type details

Stack Frame

  • idapro_stack_frame(addrs) — View stack frame variables
  • idapro_declare_stack(items) — Declare stack variable
  • idapro_delete_stack(items) — Delete stack variable

Signatures

  • idapro_make_signature(addrs) — Generate a unique byte signature for an address
  • idapro_make_signature_for_function(addrs) — Generate a signature for a function
  • idapro_find_xref_signatures(addrs) — Generate a signature for code that references an address

Debugger (requires ?ext=dbg)

  • idapro_open_file(file_path) — Open a file in the GUI IDA instance
  • Debugger tools are hidden by default and can be enabled via the URL parameter ?ext=dbg enable

Session Management (ida-pro-mcp 2.x)

  • idapro_idb_open / HTTP idb_open — ⚠️ Recommended to open with open.ps1 Open
  • idapro_idb_list / HTTP idb_list — List all sessions
  • idapro_idb_save / HTTP idb_save — Save database
  • Most analysis tools require the database=<session_id> parameter (the session output by open.ps1)

Other

  • idapro_int_convert(inputs) — Base conversion (you must use this, do not calculate the base yourself!)
  • idapro_export_funcs(addrs, format) — Export functions (json/c_header/prototypes)
  • idapro_py_eval(code) — Execute Python in the IDA context
  • idapro_server_health() — Server health check
  • idapro_server_warmup() — Prewarm subsystems (string cache, Hex-Rays, etc.)

Complete reverse engineering workflow

Step 1: Start the server

Path A — Headless idalib (requires a valid license)

powershell -File "scripts/start.ps1"

Output OK:<工具数>(currently about 65) indicates ready.

Path B — GUI + plugin (when the idalib license fails or interactive analysis is needed)

powershell -File "scripts/start-gui.ps1" -Path "C:\目标.exe"

Or double-click the portable version Launch-IDA-Pro.cmd, and open the sample in IDA.

After confirming that [MCP] ... port=13337 appears in the Output window, the MCP tools are available.

For general integration steps, see LOCAL-SETUP.md。

Step 2: Open the file

Headless:

powershell -File "scripts/open.ps1" -Path "C:\目标.exe" -TimeoutSeconds 600

Output OK:文件名:session_id indicates success (followed by (temp copy) indicates automatic fallback to a temporary copy).

If ERR:idalib_license:...appears, switch to Path B (GUI mode), and do not repeatedly retry open.ps1.

GUI mode: simply Open the sample directly in IDA; open.ps1 is not needed.

Step 3: Global overview (including the import table hard gate)

idapro_survey_binary(detail_level="minimal")

Focus on:

  • Architecture (x86/x64/ARM)
  • Entry points (main/WinMain/DllMain)
  • Interesting strings (URLs, paths, error messages)
  • Import classification (MUST): crypto functions / network APIs / file operations / process injection / registry — must be recorded as Evidence (suggested id:E-imports), available via idapro_entity_query(kind="imports") or the imports section in the survey output
  • DLL/SYS: export table goes side by side with the import table (Evidence E-exports)
  • .NET: when there is no traditional IAT, use a module/metadata/managed reference summary as an equivalent anchor and write it into the E-imports semantic slot
  • Clean import table: note the suspicion of dynamic loading, and drive dynamic API breakpoint verification
  • Hot functions (functions with high xref counts are usually key logic)

Hard gate: before writing the imports view/classification summary (or a legitimate equivalent anchor) into Evidence, MUST NOT proceed to Step 4 deep-dive conclusions, and MUST NOT claim the survey is complete. When the import table is empty or the query fails, the failure phenomenon still MUST be recorded. When unpacking IAT repair fails, MUST record E-iat-repair-fail and switch to dynamic debugging to capture APIs; do not stubbornly keep at it statically. When the user requests redoing the import table/IAT check, MUST redo the named steps (when blocked, the feasibility gate: explanation + confirmation; if forced, mark quality=unreadable), and it is forbidden to switch to unrelated steps.

Step 4: Deep dive into key functions

idapro_analyze_function(addr="关键函数名")

Or:

idapro_decompile(addr="函数名")
idapro_disasm(addr="函数名", max_instructions=50)

Step 5: Data flow and cross-references

idapro_xrefs_to(addrs="关键地址/字符串")
idapro_callgraph(roots=["关键函数"], max_depth=3)
idapro_trace_data_flow(addr="关键地址", direction="backward", max_depth=5)

Step 6: Record and refine

idapro_set_comments(items=[{"addr": "0x140001000", "comment": "你的理解"}])
idapro_rename(batch={"func": [{"addr": "函数地址", "name": "有意义的名字"}]})

Step 7: Output the report

After the analysis is complete, generate report.md to record findings and steps.

Prompt engineering guidelines

  1. Do not calculate number bases manually — whenever you need to convert numbers, use idapro_int_convert
  2. Survey first, then deep dive — look at the overview first, then analyze in a targeted way
  3. Continuously add comments and rename — keep updating function names and variable names during analysis to improve the accuracy of subsequent analysis
  4. Track cross-references — when you find interesting data/strings, use xrefs_to to see who references it
  5. When encountering obfuscated code — first perform preprocessing such as string decryption, import hash removal, and control flow flattening removal
  6. C++ STL code — after identifying library functions with FLIRT/Lumina, then analyze the business logic
  7. Do not brute-force — analysis should derive the solution from the disassembly, using simple Python to assist calculations
  8. When encountering "No database bound" — no binary file has been opened yet, first execute open.ps1
  9. When encountering "Failed to open database" — possibly the old database file is locked,open.ps1 will automatically fall back to a Temp copy (output contains the (temp copy) marker)
  10. When opening the GUI/complex samples with auto-analysis — by default add -TimeoutSeconds 600, do not mistake a long INFO:opening:... for the script being stuck

Routing context

Upstream entry: skills/SKILL.md(master control),routing.md Upstream alternative: radare2/(if you do not want to open IDA, you can first do quick reconnaissance with r2) Downstream exit:

  • Requires Frida dynamic verification → reverse-engineering/tools-dynamic.md
  • Requires symbolic execution/angr → reverse-engineering/tools-dynamic.md
  • Requires general reverse engineering methodology → reverse-engineering/SKILL.md

Peer related modules: radare2/(alternative when IDA is unavailable)


On-Demand Bootstrap

The entry script of this skill has been integrated into the unified bootstrap system.

Automation capability boundaries

Tool Can be installed automatically Installation method Description
idalib-mcp ✓ pip install (from GitHub) start.ps1 automatically installed when missing
IDA Pro itself ✗ Commercial software, requires manual installation Set the IDADIR environment variable to point to the installation directory

Installation steps (verified)

# 1. 设置 IDA 路径(替换为你的实际 IDA 安装目录)
setx IDADIR "<你的IDA安装目录>"

# 2. 从 GitHub 安装 ida-pro-mcp(PyPI 上的 ida-mcp 是另一个项目,不要装错!)
pip install git+https://github.com/mrexodia/ida-pro-mcp.git

# 3. 安装 IDA 插件(选择 Streamable HTTP + Global + 全选客户端)
ida-pro-mcp --install

# 4. 重启 IDA Pro,打开目标文件
# 插件自动监听 127.0.0.1:13337

# 5. 验证
ida-pro-mcp --config

⚠️ Note: The ida-mcp package on PyPI (author jtsylve) is a different project, not the one we need. Must install mrexodia/ida-pro-mcp。

Bootstrap trigger points

  • scripts/start.ps1: when idalib-mcp is missing, automatically call bootstrap-reverse.ps1
  • MCP registration: bootstrap will automatically write idapro into the Claude MCP configuration

Prerequisites

  • IDA Pro is installed and the IDADIR environment variable is set (or the default path in the script is correct)
  • It is recommended to use the ida-pro-mcpin IDA's bundled Python314 (already included in the portable version)
  • Common local configuration:
    • User env IDADIR → IDA installation directory (including ida.exe)
    • optional ~\Tools\bin\idalib-mcp.cmd / ida-pro-mcp.cmd wrapper
    • The client MCP server name should only be idapro → http://127.0.0.1:13337/mcp

Task completion self-check (MUST pass before claiming completion)

  • Did I execute every step in the workflow (rather than just reading it)?
  • Have survey/imports been written into Evidence (E-imports or equivalent)? Do DLL/SYS contain E-exports? If IAT fails, is E-iat-repair-fail recorded?
  • If the user requested redoing the import table/IAT, did I redo the same step?
  • Did I use the real tool path based on tool-index ?
  • Did I produce reproducible evidence (commands/scripts/screenshots/reports)?
  • Have I completed and written back the Checklist items required by RULES?

Limitations

  • Commercial license required; MCP automation adds setup overhead.
  • Heavily obfuscated targets still demand manual deobfuscation work.

Adapted from zhaoxuya520/reverse-skill (MIT).