Environment:0sec labs 0 Ghidra
| Knowledge Sources | |
|---|---|
| Domains | Binary_Analysis, Decompilation, Reverse_Engineering |
| Last Updated | 2026-10-30 00:00 GMT |
Overview
NVIDIA Ghidra 12.1.2 with the PyGhidra CPython bridge (pyghidra 2.1.0 + jpype1 1.5.2) for decompilation and IR lifting in the 0verse pipeline.
Description
Ghidra is the default, free (Apache-2.0) IL adapter for 0verse. The pipeline drives Ghidra's `analyzeHeadless` mode via the PyGhidra CPython bridge to produce P-Code / pseudo-C exports from raw binaries. Ghidra itself is NOT pip-installable — it must be installed separately and located via `GHIDRA_INSTALL_DIR` or `GHIDRA_HOME`. The `pyghidra` and `jpype1` packages are version-locked to the Ghidra install (the Dockerfile bundles Ghidra 12.1.2 with pyghidra 2.1.0 and jpype1 1.5.2) and must be installed from Ghidra's bundled wheel, not from a generic PyPI resolve.
Usage
Use this environment for the decompilation / IR-lifting stage of the Binary Vulnerability Discovery workflow. It is the mandatory prerequisite for the Decompile_Backends implementation and for any Windows IOCTL/driver analysis bundle commands.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux (Ubuntu 22.04+) | Java JDK required by Ghidra |
| Hardware | 8GB+ RAM | Ghidra analysis is memory-intensive for large binaries |
| Disk | 5GB | Ghidra install + analysis cache |
Dependencies
System Packages
- Ghidra 12.1.2 (installed at `$GHIDRA_INSTALL_DIR` or `$GHIDRA_HOME`)
- Java JDK (bundled with Ghidra or system OpenJDK 17+)
Python Packages
- `pyghidra` == 2.1.0 (PyGhidra CPython bridge — version-locked to Ghidra install)
- `jpype1` == 1.5.2 (JNI bridge — version-locked to the Ghidra-bundled version)
Credentials
The following environment variables must be set:
- `GHIDRA_INSTALL_DIR` or `GHIDRA_HOME`: Path to the Ghidra installation root. Without it the pipeline degrades quietly to ingest-only.
Quick Install
# Install the pyghidra bridge (version-pinned to Ghidra 12.1.2)
pip install "0verse[ghidra]"
# OR install from Ghidra's bundled wheel:
pip install "$GHIDRA_HOME/Ghidra/Features/PyGhidra/pypkg/dist/pyghidra-*.whl"
# Verify
export GHIDRA_INSTALL_DIR=/opt/ghidra
0verse triage --backend ghidra ./target_binary
Code Evidence
PyGhidra install hint from `0verse/src/zeroverse/backends/ghidra.py:47-53`:
PYGHIDRA_INSTALL_HINT = (
"the pyghidra bridge is not importable — install it with "
"`uv sync --extra ghidra` (PyPI, version-pinned to the Dockerfile's Ghidra) "
"or from the wheel bundled with your own install "
"(`$GHIDRA_HOME/Ghidra/Features/PyGhidra/pypkg/dist/pyghidra-*.whl`). "
"See docs/GHIDRA-SETUP.md"
)
Ghidra home resolution from `0verse/src/zeroverse/cli.py:1057-1061`:
ghidra_home = (
args.ghidra_home
or os.environ.get("GHIDRA_INSTALL_DIR")
or os.environ.get("GHIDRA_HOME")
)
if not ghidra_home:
raise ValueError("--ghidra-home or GHIDRA_INSTALL_DIR/GHIDRA_HOME is required")
Version-locked extras from `0verse/pyproject.toml:32`:
ghidra = ["pyghidra==2.1.0", "jpype1==1.5.2"]
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `RuntimeError: PyGhidra is unavailable` | pyghidra bridge not importable | Install from Ghidra's bundled wheel or `pip install 0verse[ghidra]` |
| Silent degradation (`ghidra=degrade`, 0/N results, run completes in ~1.3s) | `GHIDRA_INSTALL_DIR` not set or pyghidra missing | Set `GHIDRA_INSTALL_DIR`; verify pyghidra import; use `.venv/bin/python` not `uv run` (uv sync removes bundled wheels) |
| `RuntimeError: JPype is unavailable` | jpype1 not installed | Install `jpype1==1.5.2` from Ghidra's bundled wheel |
Compatibility Notes
- uv run: Do NOT use `uv run` — it syncs from `uv.lock` which excludes pyghidra/jpype1 (installed from Ghidra's bundled wheels), silently removing them. Use `.venv/bin/python` directly.
- rizin fallback: When Ghidra is unavailable, the pipeline can fall back to the rizin backend (needs `r2`/`radare2` binary + `r2ghidra` `pdg` plugin).
- Version lock: pyghidra and jpype1 pins MUST match the installed Ghidra version. Bump them together with `GHIDRA_VERSION` in the Dockerfile.