# Ghidra What's New

# Ghidra: NSA Reverse Engineering Software

Ghidra is a software reverse engineering (SRE) framework developed by NSA's Research Directorate. This framework includes a suite of full-featured, high-end software analysis tools that enable users to analyze compiled code on a variety of platforms including Windows, MacOS, and Linux. Capabilities include disassembly, assembly, decompilation, debugging, emulation, graphing, and scripting, along with hundreds of other features. Ghidra supports a wide variety of processor instruction sets and executable formats and can be run in both user-interactive and automated modes. Users may also develop their own Ghidra plug-in components and/or scripts using the exposed API. In addition there are numerous ways to extend Ghidra such as new processors, loaders/exporters, automated analyzers, and new visualizations.

In support of NSA's Cybersecurity mission, Ghidra was built to solve scaling and teaming problems on complex SRE efforts and to provide a customizable and extensible SRE research platform. NSA has applied Ghidra SRE capabilities to a variety of problems that involve analyzing malicious code and generating deep insights for NSA analysts who seek a better understanding of potential vulnerabilities in networks and systems.

# What's New in Ghidra 10.3

## The not-so-fine print: Please Read!

Ghidra 10.3 is fully backward compatible with project data from previous releases. However, programs and data type archives which are created or modified in 10.3 will not be useable by an earlier Ghidra version.

This release includes many new features and capabilities, performance improvements, quite a few bug fixes, and many pull-request contributions. Thanks to all those who have contributed their time, thoughts, and code. The Ghidra user community thanks you too!

IMPORTANT: Ghidra requires Java 17 JDK to run. A newer version of Java may be acceptable but has not been fully tested. Please see the Ghidra Installation Guide for additional information.

NOTE: Please note that any programs imported with a Ghidra beta versions or code built directly from source outside of a release tag may not be compatible and may have flaws that won't be corrected by using this new release. Any programs analyzed from a beta or other local master source build should be considered experimental and re-imported and analyzed with a release version. As an example, Ghidra 10.1 beta had an import flaw affecting symbol demangling that was not correctable. Programs imported with previous release versions should upgrade correctly through various automatic upgrade mechanisms. Any program you will continue to reverse engineer should be imported fresh with a release version or a build you trust with the latest code fixes.

NOTE: Ghidra Server: The Ghidra 10.3 server is compatible with Ghidra 9.2 and later Ghidra clients. Ghidra 10.3 clients are compatible with all 10.x and 9.x servers. Although, due to potential Java version differences, it is recommended that Ghidra Server installations older than 10.2 be upgraded. Those using 10.2 and newer should not need a server upgrade.

NOTE: Platform-specific native executables can be built directly from a release distribution. The distribution currently provides Linux 64-bit, Windows 64-bit, and MacOS x86 binaries. If you have another platform, for example a MacOS M1 based system or a Linux variant, the support/buildNatives script can build the Decompiler, demangler, and legacy PDB executables for your plaform. Please see "Building Ghidra Native Components" section in the the Ghidra Installation Guide for additional information.

## Dark Mode / Theming

Ghidra now supports UI theming, which allows for full customization of colors, fonts, and icons used consistently throughout the application. Ghidra themes are built on top of the various Java Look and Feel classes. Included are standard themes for all the supported Look and Feels. The most notable is the Flat Dark theme, which is built using the FlatLaf, a modern open-source flat Look and Feel library. Additionally, Ghidra includes various tools for editing and creating custom themes.

Also, all the main display windows (Listing, Decompiler, and Bytes Viewer) support quickly changing the font size via <Ctrl>+ or <Ctrl>-.

See the Ghidra Help pages for full details on the theming feature.

## Debugger

Perhaps the most exciting debugger change is the addition of new training course materials for the Debugger. The materials are written in Markdown so they display right on GitHub, but they can also be rendered to nice HTML pages by Pandoc for offline viewing. They are suitable both for self-paced learning and classroom environments. Even if you have used our Debugger before, we highly recommend reading these materials. They are in the docs/GhidraClass directory with the other course materials.

There are several changes to improve the user experience with the Emulator:

> - There is a dedicated Emulator tool. Previously, it was not apparent an Emulator GUI even existed in the Debugger tool. Most only accessed it via scripting. The Emulator tool is the same as the Debugger tool, but without the back-end debugger management plugins. This both showcases the Emulator and makes it safer to access, e.g., when examining malware. The launch buttons are removed, nearly eliminating the risk of accidental detonation.
> - The control actions (step, suspend, resume, etc.) have been moved to the main toolbar. When toggled to control the emulator, it is now possible to emulate to the next breakpoint. Before, it was only possible to step. If you were savvy, you could use the Go To Time action to run many steps, but you had to predict precisely how many steps. These controls present the Emulator as a more traditional trap-and-trace debugger and retain support for time travel.
> - Breakpoints are now applied to the Emulator. They also support injecting custom Sleigh semantics into the Emulator. This makes it possible, e.g., to stub out external function calls. Breakpoints are now displayed in the Decompiler margin, too.
> - Regarding uninitialized/undefined memory, the Emulator will still treat undefined bytes as zeros. When decoding an instruction; however, it will now interrupt if when encounters undefined bytes. Previously, it would just decode them as if zeros, which was never useful.
> - Nascent support for stack unwinding has been added. Up to now, we have relied on the back-end debugger to unwind the stack, which ruled out displaying accurate stack frames during emulation. There is still more work for full UI integration, but you can unwind a stack (whether on target or emulated) using the Debugger -> Analysis menu and view the results by navigating the Dynamic Listing to stack space. Please understand it may not work in most situations, yet.
> - Several miscellaneous actions have been added: To invalidate the Emulator cache, use the Debugger -> Configure Emulator menu. Use this whenever the Emulator seems to be ignoring configuration changes, especially when modifying custom Sleigh breakpoints. To display all bytes (not just changed ones) in the Dynamic Listing, choose Load Bytes from Emulator in the Auto-Read drop-down. To manually add or remove memory regions, e.g., to create and initialize a heap for emulation, use the new actions in the Regions window

There are several Debugger UI improvements:

> - The control actions are duplicated in the main toolbar. Previously, these were only in the Objects window. (They remain there for back-end connector/model development, troubleshooting, and diagnostics.) The actions in the main toolbar can be toggled to control a live target or the Emulator. The Emulator stepping actions have been removed from the Threads panel. (They never really made sense there.) Toggling these actions to the Emulator effectively forks an emulator from the target's live state, i.e., for extrapolation, just as the old emulator stepping actions did.
> - The current program counter is now displayed in the top right corner of the Dynamic Listing (or whatever the listing is configured to track). It will display in red if the address cannot be shown in the listing, e.g., because it is not mapped in memory. This provides better feedback when the listings seem to be out of sync.
> - GDB's advance command has been added to the Listing context menus as well as the equivalent actions for other debuggers. (More generally, any command provided by a back-end connector that takes a single address parameter is presented in context menus where an address is available.)
> - The Go To dialog in the Dynamic Listing can now take simple addresses in hexadecimal. Previously, it only took Sleigh expressions, which are powerful, but made the common case too complicated. It still accepts Sleigh expressions, and those expressions can now refer to labels (symbols) from any mapped program database (static image).
> - A new kind of hover has been added for displayed variables. If there is a debugger target (live or emulated) mapped to the current program, the hover will display the variable's current value. This applies to Listings and the Decompiler window.
> - You can now select a different thread, frame, or snapshot without activating it. Single-click to select. Double-click to activate.

There are a few small improvements to back-end debugger integration:

> - You can now set the working directory when launching a Windows target.
> - GADP agents now accept a single connection and automatically terminate when Ghidra disconnects.
> - Launch scripts have been added for starting a GADP agent from the command line.
> - There is now a script to build the Java bindings needed for the LLDB connector.

## Decompiler

Support has been added for expanding assignment statements on structures or arrays, where multiple fields or elements are moved as a group by a single instruction. This is especially helpful for analyzing structure initialization code and stack strings.

Support continues to improve for structures that are either stored across multiple registers or in a single register that is accessed in pieces. Data types associated with the component fields are propagated more fully throughout the function, and assignments to fields are displayed simply.

## Data Types

Data Type Archives may now optionally target a specific architecture as specified by a processor and associated compiler specification such as data organization. This has the advantage of better conveying datatype details for a desired architecture and preserving aspects which may change when resolved into a program. In the future, this will also allow function definitions to retain architecture-specific details.

Function definition data types have been improved to preserve calling convention names which may differ from the predefined generic calling convention names to include those which may have originated from an extended compiler specification. In addition, function definitions now support the noreturn attribute.

Enum handling has been improved in the data type manager when creating new enums from an existing set of enum values, for example define_ enums parsed from header files. Enum values will be automatically sized to fit all the values contained in the enum. Setting the size of an Enum will check if the values will fit within the new size. In addition, define_ values created as enums with a single value are sized to the minimum size to fit the value. Parsed enums from header files are sized based on the declared size of an int from the data organization used to parse. A future version will have a setting to size all parsed enums to the smallest size that will fit all the values.

## C Header File Parsing

The C-Parser GUI has been refactored to remove include paths from the Options section done as -D define lines, to a new Include section. This should make it easier to configure paths to the include files and has the added benefit of coloring the include file entries red if they are not found within any include path. You may find creating and using a Ghidra Script instead of the GUI an easier repeatable process. There are several included examples scripts, including ones to parse AVR8 header files, and Visual Studio version 22 files.

All supplied data type archive GDT files, except macOS, have been re-parsed to include the new processor architecture.

## Mach-O Binary Import

Mach-O binary analysis continues to improve. Support has been added for new file formats introduced in iOS 16 and macOS 13. Improvements have also been made to function identification, symbol detection, and Objective-C support.

## Analysis

New ApplyDataArchives analyzer settings enable use of locally created GDT data type archive files or project archives in the analysis pipeline. Used in conjunction with analysis options settings saved to a named analysis configuration you can easily switch to using a new GDT file and associated analysis options for a given type of binary. For example, if you are working with AVR8 binaries and have an associated AVR8.gdt file, create an AVR8 configuration and it will be used as the default analysis options configuration until you change to a new configuration.

Constant Propagation now deals with constants passed as stack parameters. In addition, there are several new settings which can better control when a constant is considered to be an address. For example, processors with small memory spaces, the setting Require pointer param data type, will only create a reference if the parameter is declared with a data type that would be a pointer. This can be useful for Harvard architectures with multiple address spaces used in conjunction with the PointerTypedef to specify the address space of the pointer. Currently, once you change the parameter of a called function to be a pointer, you will need to re-run analysis to get the constants passed to the function to be turned into a reference. This will be automated in the near future.

By default, pointer-to-pointer analysis is turned off for ARM binaries in the Operand and Data Reference analyzers. This can result in fewer references created and can be turned back on if your ARM binaries use pointers data stored in memory instead of offset values from the current PC to calculate all references.

Added support for PE MinGW pseudo-relocation processing.

## Shared Projects

Folder and file links to contents of another shared project repository may now be added to a Ghidra Project. This could allow a team to include a program or subfolder that resides in another project rather than copying the program into your project for easy access. The linked files are opened for read-only viewing.

## Processors

Improvements and bug fixes have been made to many processors since 10.2 to include: `AARCH64, ARM, Coldfire, HCS12 MIPS X86, PowerPC, RISCV SPARC, SuperH, TriCore, V850, Z80, 6x09, 68K, and 8051`.

Two new user-submitted processors, `eBPF` and `BPF`, add support for two variants of Berkeley Packet Filter binaries.

A user-submitted refactoring of X86 `LOCK/UNLOCK` decoding and semantics has been committed. There are currently some issues with the Decompiler re-arranging code outside of the `LOCK/UNLOCK` which will be addressed with an upcoming patch. If your analysis depends on the LOCK/UNLOCK semantics, please be aware of the issue.

A new leading zeroes count operator, called `lzcount`, has been added to p-code, and it can now be used by SLEIGH developers to model processor instructions. The Decompiler can simplify common code idioms using these instructions, and emulation is supported.

## User Interface Improvements

Diff can now be performed between two open programs which may include remote files previously opened via a Ghidra-URL.

## GoLang 1.18 Support

An importer, Analyzer, and Internal changes have been made to support GoLang. Currently, only version 1.18 is supported; however slightly older or newer versions may work. There are still some Decompiler issues with multiple return parameters to be worked out, however the implementation was thought complete enough for initial real use. Please consider the feature an evolving initial implementation.

## Ghidra Startup

Ghidra now remembers the last location of a program when it is closed. When that program is later re-opened, Ghidra will position the program to that location. Also, there are options for where Ghidra should start for new programs and optionally when Ghidra completes the initial analysis.

## Template Simplification

Ghidra now has options for simplifying the display of symbol names, in both the Listing and Decompiler, with complex template information embedded in them. The simplification should result in a much less busy display when dealing with templates.

## Additional Bug Fixes and Enhancements

Numerous other bug fixes and improvements are fully listed in the ChangeHistory file.

https://www.nsa.gov/ghidra