OGhidra conecta Grandes Modelos de Lenguaje (LLMs) vía Ollama con la plataforma de ingeniería inversa Ghidra, lo que permite el análisis binario impulsado por IA a través del lenguaje natural. Interactúa con Ghidra mediante consultas conversacionales y automatiza flujos de trabajo complejos de ingeniería inversa.
Para la versión que utiliza un Orchestrator inspirado en Claude, consulta https://github.com/llnl/OGhidra/tree/orchestrator
OGhidra une los Grandes Modelos de Lenguaje con la plataforma de ingeniería inversa de Ghidra, permitiendo análisis de binarios impulsados por IA a través del lenguaje natural. Analiza binarios de forma conversacional, automatiza flujos de trabajo complejos y mantén total privacidad con modelos de IA locales.
Tutorial de configuración en YouTube
OGhidra mejora Ghidra con capacidades de IA, permitiéndote:
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:2pxBucle agéntico: OGhidra utiliza un sistema de planificación adaptativa. Después de cada ciclo de ejecución, los resultados se revisan y la IA puede optar por recopilar más información o refinar su análisis antes de ofrecer la respuesta final.
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
Los pasos de compilación del plugin OGhidraMCP a continuación están dirigidos a Ghidra 12.0.3 (recomendado). También hay un tutorial en video de YouTube: https://www.youtube.com/watch?v=hBD92FUgR0Y
Como desarrollador, necesitarás compilar la extensión GhidraMCP antes de instalarla en Ghidra:
Requisitos previos:
Opción 1: Usar los scripts de compilación automatizados:
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
Opción 2: Proceso de compilación manual:
Crea/actualiza OGhidraMCP/gradle.properties con la ruta de instalación de Ghidra:
GHIDRA_INSTALL_DIR=/absolute/path/to/ghidra_12.0.3_PUBLIC
En Unix/Linux/macOS:
cd OGhidraMCP
$GHIDRA_INSTALL_DIR/support/gradle/gradlew buildExtension --info
En Windows:
cd OGhidraMCP
"%GHIDRA_INSTALL_DIR%\support\gradle\gradlew.bat" buildExtension --info
Localiza la extensión compilada:
OGhidraMCP/dist/ghidra_12.0.3_PUBLIC_YYYYMMDD_OGhidraMCP.zipUna vez que hayas compilado la extensión correctamente:
Instalar en Ghidra:
OGhidraMCP/dist/ghidra_12.0.3_PUBLIC_YYYYMMDD_OGhidraMCP.zip)Habilitar el plugin:
OGhidraMCPhttp://localhost:8080/methodsDEBES TENER EL CODE BROWSER ABIERTO
# 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
Si iniciaste el modo GUI, usa:
curl http://localhost:8080/methods
Edita .env para configurar tu proveedor de IA:
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
Ajusta según la ventana de contexto de tu modelo:
# 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
Acceso con un clic a tareas comunes de ingeniería inversa:
| Tool | Description |
|---|---|
| Analyze Current Function | Análisis profundo del comportamiento de la función seleccionada |
| Rename Current Function | La IA sugiere nombres significativos basados en el análisis |
| Rename All Functions | Renombrado masivo con opciones Smart/Full/Rename-Only |
| Analyze Imports | Identifica librerías y dependencias externas |
| Analyze Strings | Encuentra URL, credenciales, datos de configuración |
| Generate Report | Evaluación integral de seguridad |
Establece objetivos de análisis especializados:
# 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
Detección automática de más de 12 patrones de malware:
Los patrones activan alertas automáticas en el contexto de la IA con mapeos MITRE ATT&CK.
Construye conocimiento enriquecido y consultable a partir del análisis de binarios:
# 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
Características:
Guarda y restaura sesiones de análisis:
# 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 admite dos tipos de backend:
Usa la siguiente opción de línea de comandos para elegir un backend:
--ghidra-backend={http,pyghidra}
| Opción de backend | Descripción |
|---|---|
http | Usa el backend GhidraMCP |
pyghidra | Usa el backend PyGhidra |
Especifica un archivo de proyecto de Ghidra (.gpr) al iniciar OGhidra:
--pyghidra-project=/path/to/project.gpr
PyGhidra requiere un proyecto de Ghidra válido para poder iniciar OGhidra.
Especifica qué binario dentro del proyecto de Ghidra debe analizarse:
--pyghidra-program=<program_name>
ejemplo de llamada para seleccionar un programa en un proyecto de Ghidra:
uv run main.py --ui --ghidra-backend=pyghidra --pyghidra-project=/path/to/project.gpr --pyghidra-program=<program_name>
Requisitos:
También puedes proporcionar una ruta de binario directamente:
--pyghidra-binary=/path/to/binary
Cuando se usa esta opción, PyGhidra automáticamente:
.gpr)ejemplo de llamada para iniciar un binario directamente:
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 utiliza embeddings vectoriales para la búsqueda semántica sobre las funciones analizadas:
# Enable in .env
RESULT_CACHE_ENABLED=true
TIERED_CONTEXT_ENABLED=true
Beneficios:
La compresión de contexto por niveles conserva la información relevante:
CURRENT_LOOP_MAX_CHARS=2000 # Recent: full detail
PREV_LOOP_MAX_CHARS=400 # Previous: summaries
OLDER_LOOP_MAX_CHARS=100 # Older: references only
Realiza un seguimiento de todas las interacciones de IA para depuración:
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:9bmax_workers=2 en operaciones masivasRESULT_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 │ │
│ └────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
¡Agradecemos las contribuciones! Áreas de interés:
Consulta CODE_OF_CONDUCT.md para conocer las pautas de la comunidad.
Si utilizas OGhidra en tu investigación, por favor cita:
@software{oghidra2025,
title = {OGhidra: AI-Powered Reverse Engineering with Ghidra},
author = {Enoch Wang},
year = {2025},
url = {https://github.com/LLNL/OGhidra}
}
OGhidra se basa en excelentes proyectos de código abierto:
OGhidra se distribuye bajo los términos de la licencia BSD 3-Clause con una alternativa de licencia comercial.
LLNL-CODE-2013290