Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Ghidra XML and SARIF export

From ReverseEngineering.wiki
Format
Vendor NSA
Extensions .xml, .bytes, .sarif
License Apache-2.0
On this wiki Facts · Code · Notes · Topics

Interchange files Ghidra writes and reads without its database: the program XML (root PROGRAM with MEMORY_MAP, DATATYPES, SYMBOL_TABLE, FUNCTIONS, COMMENTS... sections, plus a .bytes file) and SARIF output from the Sarif feature.

Program XML

ProgramXmlMgr (Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/ProgramXmlMgr.java) imports and exports a program as XML plus a companion .bytes file of the memory contents (the code looks for the *.bytes file next to the .xml). The file starts with a program_dtd processing instruction carrying a VERSION; the root element is PROGRAM with attributes NAME, EXE_PATH, EXE_FORMAT, IMAGE_BASE. Children read by the code: INFO_SOURCE (USER, TOOL, TIMESTAMP, VERSION), PROCESSOR (LANGUAGE_PROVIDER, NAME, FAMILY, ADDRESS_MODEL, ENDIAN), COMPILER (NAME), and the sections DATATYPES, MEMORY_MAP, REGISTER_VALUES, CODE, DATA, EQUATES, COMMENTS, PROPERTIES, BOOKMARKS, PROGRAM_TREES, PROGRAM_ENTRY_POINTS, RELOCATION_TABLE, SYMBOL_TABLE, FUNCTIONS, MARKUP (references) and EXT_LIBRARY_TABLE. Each can be switched on or off in the export options. The attribute names inside each section were not read: Unverified.

The XML is how analysts exchange names and comments with other tools: IDA ships a plug-in pair for it (Unverified) and the format is simple enough to convert with a short script.

SARIF

The Ghidra/Features/Sarif feature (sarif/SarifController.java, sarif/export/SarifExporter.java) exports program elements (symbols, functions, data types, comments, memory map...) as SARIF (the OASIS static-analysis results JSON format) and can read them back. Which element kinds map to which SARIF result properties was not read: Unverified.

Related

Format:Ghidra packed file (GZF), Technique:Moving analysis between tools.

Code & repositories

  • https://github.com/NationalSecurityAgency/ghidra @ 9a723ce99952771b8368329503aa589ae233e916 · license: Apache-2.0 (read from LICENSE; GitHub's API was busy)
    Ghidra source: ItemSerializer (packed files), ProgramXmlMgr (XML export), Sarif feature, GhidraFilesystemStorage.html.
    Tested on: source read, not run: read source only · checked 2026-10-18