Ghidra Software Reverse Engineering Framework
repository·master·Indexed 13 days ago
https://github.com/nationalsecurityagency/ghidraA professional-grade software reverse engineering (SRE) framework developed by the NSA, providing tools for disassembly, decompilation, and analysis across various processor architectures. It includes support for headless analysis, GUI mode, and server configurations, as well as debugger agents for GDB, LLDB, x64dbg, and drgn via Trace RMI. Features include a Taint Analysis Module, BSim for signature generation with Elasticsearch integration, and Python 3 bindings via PyGhidra and ghidratrace.
What's inside Ghidra
- The Debugger Ghidra Class provides training courseware for using the Ghidra Debugger. While the material is primarily developed for Linux user-space targets, the core concepts, user interface, and workflows are largely consistent across different platforms and instruction set architectures (ISAs). Users should expect minor differences in initial setup, target behavior subtleties, and specific instruction sets depending on their environment.
Overview of the BSim plugin
masterBSim is a Ghidra plugin designed to identify structurally similar functions within large collections of binaries. It leverages Ghidra's decompiler engine, allowing it to find matches even when there are differences in compilers, architectures, or minor modifications to the original source code.Overview of PyGhidra capabilities
masterPyGhidra is a module designed to integrate Python into the Ghidra environment. It provides four primary capabilities:
- PyGhidra Python library: A dedicated Python library and its dependencies for interacting with Ghidra.
- CPython Interpreter Plugin: A Ghidra plugin that provides a CPython interpreter within the Ghidra application.
- Native CPython 3 ScriptProvider: A provider that allows Ghidra to execute
GhidraScriptswritten in native CPython 3. - Interactive Python Launcher: An interactive script (
support/pyghidra_launcher.py) used by Ghidra to install and launch PyGhidra, which manages virtual environments and handles externally managed environments.
Introduction to the Headless Analyzer
masterThe Headless Analyzer is a command-line, non-GUI version of Ghidra designed for automation and repetitive tasks. It allows you to perform operations without the Ghidra desktop interface, which is ideal for CI/CD pipelines or bulk processing.
Core Capabilities:
- Project Management: Create and populate Ghidra projects.
- Binary Analysis: Import new binaries or process existing ones already in a project.
- Scripting: Run non-GUI Ghidra scripts (program-dependent or program-independent) as pre-processing or post-processing steps.
- Automation: Perform bulk imports/processing of directories or files using wildcards.
- Control: Dictate program disposition (e.g., aborting analysis or deleting files after processing) via scripts.
Important Usage Notes:
- Concurrency: The Headless Analyzer may fail to run if the specified project is currently open in the Ghidra GUI.
- Hidden Files: In bulk mode (importing directories or using wildcards), files starting with
.are ignored by default. However, explicitly naming a hidden file (e.g.,-import /path/to/.hidden.exe) will force its import. - Logging: Log redirection is only supported if Log4J is being used.
New features in Ghidra 10.3
masterGhidra 10.3 introduced several significant features across various modules:
- Analysis: Initial support for Golang binary analysis (Go 1.18).
- Debugger:
- Added breakpoint indicators to the Decompiler margin.
- Added Debugger control actions to the global toolbar.
- Created independent launchers for Debugger agents.
- Added a dedicated Emulator tool.
- Added ability to export/serve symbols and types as Volatility ISF JSON.
- Added hover tooltips for variable values in the Static Listing, Decompiler, and Dynamic Listing.
- Added support for setting node timeouts and initial directory parameters.
- Pcode: Introduced support for the
lzcountoperator in SLEIGH, the Decompiler, and emulation, which returns the count of leading zero bits. - Processors: Added support for eBPF and BPF processors.
- GUI: Added dark theme support and the ability for programs to open to their last closed location by default.
- Scripting: Added
AssociateExternalPELibrariesScriptto fix up external references for PE programs by associating imported library files.
Use Python 3 bindings for Ghidra Trace RMI
masterTheghidratracepackage provides Python 3 bindings for interacting with Ghidra's Trace RMI (Remote Method Invocation). This allows developers to interface with Ghidra Trace capabilities using Python scripts.New features in Ghidra 9.1
masterGhidra 9.1 introduced several significant features across various domains:
- Data Types: Added bit-field support to the Structure and Union editor, including a dedicated Bit-field Editor for explicit placement in non-packed structures.
- Eclipse Integration: Includes the
GhidraSleighEditorEclipse plugin (located inExtensions/Eclipsewithin the installation directory). - GUI Improvements:
- Control-click the only sorted table column to turn off table sorting.
- Hovering on an address displays its origin in the imported file.
- Importers: Added a new loader for DYLD-shared cache files (Mach-O).
- Memory API: New API to preserve original program bytes and their mapping to memory blocks.
- Processors: Added support for Intel MCS-96, SH1/2/2a, Tricore, HCS12X, HCS05, HCS08, SH4, and MCS-48.
- Sleigh Development: Added
SleighDevToolsandGnuDisassemblerextension modules. Supports pcode JUnit tests using emulation of cross-compiled C code to verify instruction semantics.
Manage BSim databases with the bsim CLI
masterThe
bsimcommand-line utility, located in thesupportdirectory of a Ghidra distribution, is used to create, populate, and manage BSim databases. It supports all BSim database backends. Runningbsimwith no arguments will print a detailed usage message.cd <ghidra_install_dir>/support ./bsimConnect GDB to Ghidra via Trace RMI
masterTheDebugger-agent-gdbpackage allows you to connect the GNU Debugger (GDB) to the Ghidra Debugger framework using the Trace Remote Method Invocation (RMI) protocol. This enables GDB to act as a debugger agent for Ghidra.Use Rust support in Ghidra
masterGhidra provides a dedicated module for improved support when analyzing binaries written in the Rust programming language. This module enhances the reverse engineering process for Rust-specific constructs and patterns.Use Debugger-DAP for server-side DAP access
masterDebugger-DAP provides a server-side implementation of the Debug Adapter Protocol (DAP). This allows external clients (such as IDEs or other debuggers) to interact with Ghidra's debugger agents using the standardized DAP interface.Connect x64dbg to Ghidra via Trace RMI
masterTheDebugger-agent-x64dbgpackage allows you to connect the x64dbg debugger to the Ghidra framework using the Trace RMI (Remote Method Invocation) protocol. This enables integration between the x64dbg debugger and Ghidra's analysis and tracing capabilities.