
lernean lens
提供 Ghidra 配置以分析 Solana 二进制文件,结合 eBPF 和 MCP 扩展实现逆向工程。
Repository Info
About This Server
提供 Ghidra 配置以分析 Solana 二进制文件,结合 eBPF 和 MCP 扩展实现逆向工程。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Ghidra Setup for Solana Binaries with MCP Server
This repository provides a setup for running Ghidra with extensions to analyze Solana binaries, specifically the eBPF and MCP (model context protocol) extensions. The MCP server enables integration with Claude Desktop for a collaborative reverse engineering workflow.
It aggregates two key sources of open source work: GHIDRA MCP by LaurieWired EBPF EXTENSION for Ghidra by RIPTL
the ebpf extension make solana program secodeable by ghidra and the mcp protocol for ghidra abstracts away most of the complexity. Connecting these tools together allows for extracting the idl solely from the deployed binary of a solana smart contract. Demo - watch at 2x speed
Loom demo of it in action
Note: The containerization is a work in progress. For a cleaner and more stable experience, we recommend running Ghidra locally and connecting it to Claude Desktop via the MCP server. The extensions and binaries are included in this directory for convenience.
You will have to download the ghidra release yourslef: Ghidra release from NSA
Introduction
This guide will help you:
- Build and run a Docker container with Ghidra
- Open Ghidra for the first time and enable developer mode
- Install the MCP and eBPF extensions
- Load a Solana binary from the
binariesdirectory - Connect the MCP server to Claude Desktop
Prerequisites
Before you begin, ensure you have:
- Docker installed on your machine
- Claude Desktop installed
- Basic familiarity with SSH and terminal commands
The following files from this directory are required:
Dockerfileghidra_11.3.1_PUBLIC/ghidra-ebpf-0.1.zipGhidraMCP-1-0.zipbinaries/bridge_mcp_ghidra.py
Building and Running the Docker Container
-
Build the Docker image:
Open a terminal in the
lernean-lensdirectory and run:docker build -t ghidra-container .This builds the image using the provided Dockerfile, installing Ghidra, the extensions, and dependencies.
-
Run the container:
docker run -d -p 2222:22 -p 8080:8080 --name ghidra-container ghidra-container-d: Runs the container in the background-p 2222:22: Maps SSH to port 2222 on your host-p 8080:8080: Maps the MCP server port (adjust if needed)--name: Names the container for easy reference
Opening Ghidra for the First Time
-
SSH into the container:
ssh ghidrauser@localhost -p 2222Password:
ghidra(defined in the Dockerfile)Note: Enable X11 forwarding with
ssh -Xif you want to display the GUI (requires an X11 server like XQuartz on macOS). -
Launch Ghidra:
Inside the container, run:
/opt/ghidra/ghidraRunThe Ghidra interface should appear if X11 forwarding is set up correctly.
Enabling Developer Mode and Installing Extensions
-
Enable Developer Mode:
- In Ghidra, go to File → Configure
- Check "Developer Mode" and click "OK"
-
Install the MCP and eBPF Extensions:
- Go to File → Install Extensions
- Click the "+" button and select
/opt/ghidra/Extensions/ghidra-ebpf-0.1.zip - Click the "+" button again and select
/opt/ghidra/Extensions/GhidraMCP-1-0.zip - Click "OK" to install both extensions
-
Restart Ghidra:
Close Ghidra and relaunch it with:
/opt/ghidra/ghidraRunThe extensions will now be active.
Loading a Binary
To load and analyze a Solana binary (e.g., jup.so) from the binaries directory:
-
Import the binary:
In the container's terminal, run:
/opt/ghidra/support/analyzeHeadless /tmp ghidra_project -import /opt/ghidra/binaries/jup.so -loader ElfLoader -loader-applyRelocations false -processor eBPF:LE:64:default -noanalysis -overwriteThis creates a Ghidra project at
/tmp/ghidra_projectand imports the binary without immediate analysis. -
Analyze the binary:
/opt/ghidra/support/analyzeHeadless /tmp ghidra_project -process jup.soThis processes the imported binary, applying auto-analysis.
-
View the binary:
- Open Ghidra, go to File → Open Project, and select
/tmp/ghidra_project - Double-click jup.so to open it in the CodeBrowser
- Open Ghidra, go to File → Open Project, and select
Connecting to Claude Desktop
To connect the MCP server to Claude Desktop:
-
Start the MCP Server:
- Open a project in Ghidra's CodeBrowser (e.g., the one from the previous step)
- The MCP server should start automatically if the extension is installed correctly
-
Configure Claude Desktop:
Edit your Claude Desktop configuration file (e.g.,
~/Library/Application Support/Claude/claude_desktop_config.jsonon macOS):{ "mcpServers": { "ghidra": { "command": "/path/to/venv/bin/python3", "args": [ "/path/to/lernean-lens/bridge_mcp_ghidra.py" ] } } }- Replace
/path/to/venv/bin/python3with the path to your Python virtual environment's python3 executable - Replace
/path/to/lernean-lens/bridge_mcp_ghidra.pywith the absolute path tobridge_mcp_ghidra.pyin your lernean-lens directory - Open claude and it should be added.
- Replace
Notes
-
Containerization Status: The Docker setup is still being refined. For a smoother workflow, consider installing Ghidra locally, adding the extensions from this directory (
ghidra-ebpf-0.1.zipandGhidraMCP-1-0.zip), and connecting it to Claude Desktop via the MCP server. -
Included Files: The MCP and eBPF extensions, sample binaries, and the
bridge_mcp_ghidra.pyscript are provided in this directory for your use. -
Troubleshooting: If the GUI doesn't display, ensure X11 forwarding is enabled and an X11 server is running on your host machine.
Quick Start
Clone the repository
git clone https://github.com/hogyzen12/lernean-lensInstall dependencies
cd lernean-lens
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.