
OGhidra は、Ollama を介して大規模言語モデル (LLMs) と Ghidra リバースエンジニアリングプラットフォームを橋渡しし、自然言語による AI 駆動のバイナリ解析を可能にします。会話形式のクエリで Ghidra と対話し、複雑なリバースエンジニアリングワークフローを自動化できます。
Claudeにインスパイアされたオーケストレーターを使用するバージョンは、 https://github.com/llnl/OGhidra/tree/orchestrator を参照してください。
OGhidraは、大規模言語モデルとGhidraのリバースエンジニアリングプラットフォームを橋渡しし、自然言語によるAI駆動のバイナリ解析を可能にします。対話的にバイナリを分析し、複雑なワークフローを自動化し、ローカルAIモデルで完全なプライバシーを維持します。
YouTubeセットアップチュートリアル
OGhidraはGhidraにAI機能を追加し、以下のことが可能になります:
graph TD
A[User Query] --> B[Planning Phase]
B --> C{Execution Phase}
C -- Tool Calls --> D[Ghidra/LLM]
D --> C
C --> E[Review Phase]
E -- Agentic Loop --> B
E --> F[Final Response]
style E fill:#f9f,stroke:#333,stroke-width:2px
style B fill:#bbf,stroke:#333,stroke-width:2pxエージェントループ: OGhidraは適応型プランニングシステムを使用します。各実行サイクルの後、結果がレビューされ、AIは最終応答を提供する前に、より多くの情報を収集するか分析を洗練するかを選択できます。
python --versionjava -version# Clone repository
git clone https://github.com/LLNL/OGhidra.git
cd OGhidra
# Install dependencies (choose one)
uv sync # Using UV (recommended)
pip install -r requirements.txt # Using pip
# Configure environment
cp .env.example .env
# Edit .env with your settings
以下のOGhidraMCPプラグインビルド手順はGhidra 12.0.3(推奨)を対象としています。 YouTubeのビデオチュートリアルもあります: https://www.youtube.com/watch?v=hBD92FUgR0Y
開発者は、Ghidraにインストールする前にGhidraMCP拡張機能をビルドする必要があります:
前提条件:
オプション1: 自動ビルドスクリプトを使用:
Windows:
# Set the path to your Ghidra installation (will attempt to find last run copy of Ghidra if not set)
set GHIDRA_INSTALL_DIR=C:\path\to\ghidra_12.0.3_PUBLIC
# Run the build script
build_ghidra_plugin.bat
Unix/Linux/Mac:
# Set the path to your Ghidra installation (will attempt to find the last run copy of Ghidra if not set)
export GHIDRA_INSTALL_DIR=/path/to/ghidra_12.0.3_PUBLIC
# Run the build script (make it executable first if needed)
chmod +x build_ghidra_plugin.sh
./build_ghidra_plugin.sh
オプション2: 手動ビルド手順:
Ghidraのインストールパスを指定してOGhidraMCP/gradle.propertiesを作成/更新:
GHIDRA_INSTALL_DIR=/absolute/path/to/ghidra_12.0.3_PUBLIC
Unix/Linux/macOSの場合:
cd OGhidraMCP
$GHIDRA_INSTALL_DIR/support/gradle/gradlew buildExtension --info
Windowsの場合:
cd OGhidraMCP
"%GHIDRA_INSTALL_DIR%\support\gradle\gradlew.bat" buildExtension --info
ビルドされた拡張機能の場所:
OGhidraMCP/dist/に作成されますghidra_12.0.3_PUBLIC_YYYYMMDD_OGhidraMCP.zipのようになります拡張機能のビルドが成功したら:
Ghidraにインストール:
OGhidraMCP/dist/ディレクトリを参照ghidra_12.0.3_PUBLIC_YYYYMMDD_OGhidraMCP.zip)を選択プラグインを有効化:
OGhidraMCPプラグインを有効化http://localhost:8080/methodsで起動しますコードブラウザを開いている必要があります
# For Ollama (local models)
ollama pull gemma3:27b # Good balance (20GB RAM)
ollama pull nomic-embed-text # Embedding model for RAG
# Alternative models
ollama pull gpt-oss:120b # High quality (80GB RAM)
ollama pull devstral-2:123b # High quality (80GB RAM)
ollama pull devstral-2:123b-cloud # Cloud Model
# GUI Mode (recommended)
uv run main.py --ui
# Interactive CLI
uv run main.py --interactive
# In interactive CLI, test connection
health
GUIモードで起動した場合は、以下を使用:
curl http://localhost:8080/methods
.envを編集してAIプロバイダを設定:
LLM_PROVIDER=ollama
OLLAMA_BASE_URL=http://localhost:11434/
OLLAMA_MODEL=gemma3:27b
OLLAMA_EMBEDDING_MODEL=nomic-embed-text
LLM_PROVIDER=external
EXTERNAL_PROVIDER=google
EXTERNAL_API_KEY=your-api-key-here
EXTERNAL_MODEL=gemini-3.1-flash-lite-preview
EXTERNAL_EMBEDDING_MODEL=gemini-embedding-001
LLM_PROVIDER=custom_api
CUSTOM_API_URL=https://api.example.com/v1/chat/completions
CUSTOM_API_KEY=your-api-key-here
CUSTOM_API_MODEL=your-model-name
CUSTOM_API_EMBEDDING_MODEL=your-embedding-model
モデルのコンテキストウィンドウに基づいて調整:
# Context budget in tokens (adjust to your model's limit)
CONTEXT_BUDGET=100000 # 100K tokens for mid-size models
# 200K+ for frontier models
# Execution settings
MAX_EXECUTION_STEPS=5 # Steps per planning cycle
MAX_AGENTIC_CYCLES=3 # How many plan-execute-review loops
AGENTIC_LOOP_ENABLED=true # Enable adaptive replanning
一般的なリバースエンジニアリングタスクへのワンクリックアクセス:
| ツール | 説明 |
|---|---|
| 現在の関数を分析 | 選択した関数の動作を詳細に調査 |
| 現在の関数をリネーム | AIが分析に基づいて意味のある名前を提案 |
| すべての関数をリネーム | Smart/Full/リネームのみのオプションで一括リネーム |
| インポートを分析 | ライブラリと外部依存関係を特定 |
| 文字列を分析 | URL、認証情報、設定データを検出 |
| レポート生成 | 包括的なセキュリティ評価 |
専門的な分析目標を設定:
# In GUI: Use "Task Mode" dropdown
# In CLI: set task_mode <mode>
task_mode malware # Malware analysis with pattern detection
task_mode vuln # Vulnerability research focus
task_mode general # General reverse engineering
12以上のマルウェアパターンを自動検出:
パターンはMITRE ATT&CKマッピングとともにAIのコンテキストで自動アラートをトリガーします。
バイナリ解析からリッチで検索可能なナレッジを構築:
# Enumerate all functions with AI summaries
# Choose from:
- Rename Only: Only process generic function names
- Smart Enumeration: Focus on security-relevant functions
- Full Enumeration: Analyze every function in the binary
機能:
分析セッションの保存と復元:
# Save progress
File → Save Session
# Load previous work
File → Load Session
# Auto-save after bulk operations
# Sessions include:
- Analyzed functions with summaries
- RAG vectors for semantic search
- Performance statistics
- UI state
OGhidraは2つのバックエンドタイプをサポート:
以下のコマンドラインオプションを使用してバックエンドを選択:
--ghidra-backend={http,pyghidra}
| バックエンドオプション | 説明 |
|---|---|
http | GhidraMCPバックエンドを使用 |
pyghidra | PyGhidraバックエンドを使用 |
OGhidra起動時にGhidraプロジェクトファイル(.gpr)を指定:
--pyghidra-project=/path/to/project.gpr
PyGhidraはOGhidraを起動するために有効なGhidraプロジェクトを必要とします。
Ghidraプロジェクト内のどのバイナリを分析するかを指定:
--pyghidra-program=<program_name>
Ghidraプロジェクト内のプログラムを選択する呼び出し例:
uv run main.py --ui --ghidra-backend=pyghidra --pyghidra-project=/path/to/project.gpr --pyghidra-program=<program_name>
要件:
バイナリパスを直接指定することもできます:
--pyghidra-binary=/path/to/binary
このオプションを使用すると、PyGhidraは自動的に以下を実行:
.gpr)を作成バイナリを直接起動する呼び出し例:
uv run main.py --ui --ghidra-backend=pyghidra --pyghidra-binary=/path/to/binary
uv run main.py --ui# In GUI: Click "Generate Report" button
# Report includes:
- Executive Summary
- Function Inventory (renamed functions with behavior)
- Security Analysis (high-risk functions, patterns)
- Import Analysis
- String Analysis
- Recommendations
OGhidraは分析済み関数に対するセマンティック検索にベクトル埋め込みを使用:
# Enable in .env
RESULT_CACHE_ENABLED=true
TIERED_CONTEXT_ENABLED=true
利点:
階層型コンテキスト圧縮により関連情報を保持:
CURRENT_LOOP_MAX_CHARS=2000 # Recent: full detail
PREV_LOOP_MAX_CHARS=400 # Previous: summaries
OLDER_LOOP_MAX_CHARS=100 # Older: references only
デバッグ用にすべてのAIインタラクションを追跡:
LLM_LOGGING_ENABLED=true
LLM_LOG_FILE=logs/llm_interactions.log
LLM_LOG_FORMAT=json
# Verify plugin is loaded
# Open up codebrowser!
# Check server is running
curl http://localhost:8080/methods
# Verify Ollama is running
ollama list
# Check connectivity
curl http://localhost:11434/api/tags
# Restart Ollama service
ollama serve
# Reduce context budget
CONTEXT_BUDGET=50000
# Enable compaction
COMPACTION_ENABLED=true
COMPACTION_THRESHOLD=0.75
gemma3:9bに切り替えmax_workers=2に設定RESULT_CACHE_ENABLED=falseCUSTOM_API_REQUEST_DELAY=2.0┌─────────────────────────────────────────────────────────────┐
│ OGhidra UI │
│ (GUI / Interactive CLI) │
└────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Bridge (src/bridge.py) │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ • Agentic Loop: Plan → Execute → Review → Replan │ │
│ │ • Tool Router: Ghidra client, LLM client, CAG manager │ │
│ │ • Context Manager: Budget allocation, compression │ │
│ └────────────────────────────────────────────────────────┘ │
└───────────┬────────────────────────┬────────────────────────┘
│ │
▼ ▼
┌───────────────────────┐ ┌─────────────────────────┐
│ Ghidra Client │ │ LLM Clients │
│ • GhidraMCP Plugin │ │ • Ollama (local) │
│ • Binary operations │ │ • External APIs │
│ • Decompilation │ │ • Custom endpoints │
└───────────────────────┘ └─────────────────────────┘
│ │
└────────────┬───────────┘
▼
┌─────────────────────────────────────────────────────────────┐
│ CAG Manager (Knowledge System) │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ • Vector Store: Semantic search over functions │ │
│ │ • Pattern Detector: 12+ malware techniques │ │
│ │ • Metadata Extractor: Structured function analysis │ │
│ │ • Session Store: Persistent analysis state │ │
│ └────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
コントリビューションを歓迎します!関心のある分野:
コミュニティガイドラインについてはCODE_OF_CONDUCT.mdを参照してください。
研究でOGhidraを使用する場合は、以下のように引用してください:
@software{oghidra2025,
title = {OGhidra: AI-Powered Reverse Engineering with Ghidra},
author = {Enoch Wang},
year = {2025},
url = {https://github.com/LLNL/OGhidra}
}
OGhidraは優れたオープンソースプロジェクトに基づいています:
OGhidraは、商用ライセンスの代替を伴うBSD 3-Clauseライセンスの条件の下で配布されています。
LLNL-CODE-2013290