# Ghidra

**Ghidra** 是由美国国家安全局（NSA）研究局创建并维护的免费开源软件逆向工程（SRE）框架，用于在无法获取源代码的情况下对编译后的二进制文件进行反汇编、反编译和分析。<sup>[1](https://techyorker.com/compare/ghidra-vs-ida-pro/)</sup> 2019年3月5日，NSA在RSA网络安全会议上将该工具作为开源项目向公众发布，并于2019年4月4日公布了完整源代码。<sup>[2](https://www.axios.com/2019/03/05/nsa-releases-cybersecurity-tool-open-source)</sup><sup> • </sup><sup>[3](https://www.nsa.gov/Press-Room/Press-Releases-Statements/Press-Release-View/Article/1805182/attention-ghidra-users-full-source-code-released/)</sup> 据在发布时展示该工具的NSA官员罗布·乔伊斯（Rob Joyce）介绍，该名称读作“Gee-dra”。<sup>[2](https://www.axios.com/2019/03/05/nsa-releases-cybersecurity-tool-open-source)</sup>

| 关键事实 | 详情 |
|---|---|
| 是什么 | 由NSA开发的软件逆向工程框架，包含反汇编器、反编译器和调试器<sup>[1](https://techyorker.com/compare/ghidra-vs-ida-pro/)</sup> |
| 发布 | 2019年3月5日在RSA大会上开源；2019年4月4日随9.0.2补丁发布完整源代码<sup>[2](https://www.axios.com/2019/03/05/nsa-releases-cybersecurity-tool-open-source)</sup><sup> • </sup><sup>[3](https://www.nsa.gov/Press-Room/Press-Releases-Statements/Press-Release-View/Article/1805182/attention-ghidra-users-full-source-code-released/)</sup> |
| 许可与费用 | Apache-2.0许可证；免费，未声明价格或使用限制<sup>[4](https://github.com/NationalSecurityAgency/ghidra)</sup><sup> • </sup><sup>[1](https://techyorker.com/compare/ghidra-vs-ida-pro/)</sup> |
| 核心语言 | SLEIGH处理器规范语言；用于反编译的p-code中间表示<sup>[5](https://ghidra.re/ghidra_docs/languages/html/sleigh.html)</sup> |
| 协作 | 原生多用户项目服务器支持实时协作逆向工程<sup>[6](https://infoseclabs.io/compare/ghidra-vs-ida-pro)</sup> |
| 平台 | 官方二进制包支持Windows 10+ x86-64、Windows ARM64（x86模拟）和Linux x86-64；macOS及其他平台需用户自行构建原生组件<sup>[7](https://github.com/NationalSecurityAgency/ghidra/blob/master/GhidraDocs/GettingStarted.md)</sup> |
| 采用情况 | 发布后前六个月GitHub下载量超过50万次；截至最近一次抓取，GitHub星标数达8.65万<sup>[8](https://www.axios.com/2019/08/08/nsas-free-malware-research-tool-gains-traction-6-months-on)</sup><sup> • </sup><sup>[4](https://github.com/NationalSecurityAgency/ghidra)</sup> |

## 起源与发布

2019年之前，功能强大的逆向工程工具都是商业产品，授权费用高达数百甚至数千美元。NSA将内部开发的恶意软件研究工具Ghidra作为免费开源软件发布，Axios报道称，这可以为那些原本无力承担此类工具的安全人员“创造公平的竞争环境”。<sup>[2](https://www.axios.com/2019/03/05/nsa-releases-cybersecurity-tool-open-source)</sup> 初始版本使程序可用，但不包含源代码；一个月后，NSA于2019年4月4日公布了完整源代码及9.0.2补丁，并附带了macOS、Linux和Windows的构建说明，以便开发者创建补丁并扩展该工具。<sup>[3](https://www.nsa.gov/Press-Room/Press-Releases-Statements/Press-Release-View/Article/1805182/attention-ghidra-users-full-source-code-released/)</sup>

采用速度很快。六个月内，该软件从GitHub上的下载量超过50万次，据NSA高级研究员布莱恩·奈顿（Brian Knighton）所说，这一数字“大幅超出”了该机构的内部估计。NSA还开始为高校开设Ghidra巡回课程。<sup>[8](https://www.axios.com/2019/08/08/nsas-free-malware-research-tool-gains-traction-6-months-on)</sup>

## 架构：SLEIGH与p-code

Ghidra的分析流水线建立在两种相互关联的表示之上。SLEIGH是Ghidra的处理器规范语言：SLEIGH规范形式化地描述了将处理器机器指令的位编码转换为人类可读的汇编语言和p-code（Ghidra内部使用的代码中间表示）的过程。<sup>[5](https://ghidra.re/ghidra_docs/languages/html/sleigh.html)</sup> 一个SLEIGH文件通常描述一个微处理器，并提供足够的细节来驱动Ghidra的两大主要引擎——反汇编器和反编译器。<sup>[5](https://ghidra.re/ghidra_docs/languages/html/sleigh.html)</sup>

p-code是一种寄存器传输语言，规定了每条指令对寄存器和内存的实际操作。由于不同处理器的代码可以转换为相同的p-code形式，一套分析软件即可为所有支持的架构执行数据流分析和反编译；只需为每种处理器编写到p-code的转换即可。<sup>[5](https://ghidra.re/ghidra_docs/languages/html/sleigh.html)</sup> 反编译器首先将每条机器指令转换为p-code，然后对该语言的操作符和变量进行分析。<sup>[9](https://ghidradocs.com/11.1.2_PUBLIC/help/Decompiler/help/topics/DecompilePlugin/DecompilerConcepts.html)</sup> 该设计遵循克里斯蒂娜·西富恩特斯（Cristina Cifuentes）1994年博士论文《逆向编译技术》中提出的反编译结构：反汇编到中间表示，通过数据流和控制流分析转换为高级表示，最后进行后端代码生成。<sup>[5](https://ghidra.re/ghidra_docs/languages/html/sleigh.html)</sup>

p-code还驱动Ghidra界面内的模拟功能，提供可访问的API用于在已记录的机器状态之间插值以及外推未来状态，Ghidra还通过GDB提供了开箱即用的QEMU集成。<sup>[10](https://github.com/NationalSecurityAgency/ghidra/blob/master/DevGuide.md?plain=1)</sup>

## 功能与操作

Ghidra作为Java应用程序运行，由 `ghidraRun` 脚本启动，以图形化CodeBrowser作为主要分析界面。它支持GUI模式、无头批处理模式、单jar模式和用于Python访问的PyGhidra模式，并包含用于跨二进制文件匹配函数的行为相似性（BSim）功能。<sup>[7](https://github.com/NationalSecurityAgency/ghidra/blob/master/GhidraDocs/GettingStarted.md)</sup> 用户通过Java或Python编写的自定义脚本、插件和分析器来扩展它；一个名为GhidraDev的自定义Eclipse插件支持针对已安装构建版本的开发。<sup>[7](https://github.com/NationalSecurityAgency/ghidra/blob/master/GhidraDocs/GettingStarted.md)</sup>

**调试器。** Ghidra的调试器围绕Trace RMI协议重新架构，该协议是一种基于protobuf的TCP连接，连接Java UI与Python3后端连接器，后者对接原生调试器，如Windows x64上的WinDbg、Linux上的GDB 13或更高版本、macOS上的LLDB 10或更高版本。跟踪记录以与程序相同的数据库框架存储机器状态和随时间变化的标记，并可通过Ghidra服务器共享。作为一条设计规则，任何访问原生API的组件都不得与Ghidra UI驻留在同一JVM中，以此隔离崩溃并防止数据丢失。<sup>[10](https://github.com/NationalSecurityAgency/ghidra/blob/master/DevGuide.md?plain=1)</sup>

**协作。** 原生多用户项目服务器允许多名分析人员实时处理相同的二进制文件，评论者将此视为一项专业优势。<sup>[6](https://infoseclabs.io/compare/ghidra-vs-ida-pro)</sup>

## Ghidra与IDA Pro

Ghidra最常被拿来与[IDA Pro](https://www.edgepedia.org/zh/interactive-disassembler)比较，后者是Hex-Rays出品的商业反汇编器和反编译器，比Ghidra早问世数十年。在2026年的对比中，IDA Pro公布的起价为每年1,099美元，顶级IDA Pro Ultimate方案为每年8,599美元，而Ghidra免费且未声明使用限制；IDA Free提供x86-32和x86-64反汇编以及两个基于云的反编译器。<sup>[1](https://techyorker.com/compare/ghidra-vs-ida-pro/)</sup> 评论者认为IDA的Hex-Rays反编译器能生成最干净、最可读的伪C代码，性能也最快，推荐专业逆向工程师和漏洞利用开发者使用IDA，同时推荐Ghidra作为功能强大的免费框架，内置多架构反编译器和团队协作功能。<sup>[6](https://infoseclabs.io/compare/ghidra-vs-ida-pro)</sup> Ghidra的反编译器免费覆盖x86、x64、ARM、MIPS和PowerPC等架构；已知缺点包括Java界面在处理超大二进制文件时可能显得迟缓，以及反编译器输出可能比Hex-Rays更为冗长。<sup>[6](https://infoseclabs.io/compare/ghidra-vs-ida-pro)</sup>

这次发布改变了谁能参与其中。Axios在发布六个月后报道称，Ghidra向此前无力承担所需软件的学生、兼职者和爱好者敞开了恶意软件研究的大门。<sup>[8](https://www.axios.com/2019/08/08/nsas-free-malware-research-tool-gains-traction-6-months-on)</sup> 2020年的一本恶意软件逆向工程手册指出，Ghidra起初看起来不如IDA用户友好，这反映了IDA更长的商业历史，但也指出Ghidra强大的内置反编译器超越了IDA免费版本——后者的反编译器是付费商业扩展。<sup>[11](https://ccdcoe.org/uploads/2020/07/Malware_Reverse_Engineering_Handbook.pdf)</sup>

## 在研究和安全工作中的应用

Ghidra是恶意软件分析和二进制分析工作流的标准组件，用于可执行文件的静态分析、漏洞研究和软件保障。<sup>[12](https://toolsinfo.com/compare/ghidra-vs-ida-pro)</sup> 其开放架构使其成为研究工具的常见集成目标：[微软研究院](https://www.edgepedia.org/zh/microsoft-research)和[卡内基梅隆大学](https://www.edgepedia.org/zh/carnegie-mellon-university)的TRex类型重建工具内置了对Ghidra的支持，从而支持Ghidra覆盖的所有架构，并在基准二进制文件上测得Ghidra自身的类型推断得分比简单基线高出17.68%。<sup>[13](https://www.usenix.org/system/files/usenixsecurity25-bosamiya.pdf)</sup> 近期研究流水线还将Ghidra的反编译输出输入大型语言模型进行恶意软件分类，并使用Ghidra MCP接口通过LLM代理引导反编译器输出。<sup>[14](https://arxiv.org/abs/2601.09035)</sup><sup> • </sup><sup>[15](https://arxiv.org/abs/2606.06838)</sup>

流行也有弊端。2026年，Check Point Research报告了一起大规模活动，超过100个网站仿冒包括Ghidra和dnSpy在内的可信逆向工程工具，通过流量分发系统向访客投放SessionGate、RemusStealer和AnimateClipper等恶意软件。<sup>[16](https://www.techradar.com/pro/security/huge-hacking-campaign-uses-spoofed-ghidra-dnspy-and-spiderfoot-security-tools-to-harvest-ad-revenue-and-serve-malware)</sup> 2026年的一份GitHub安全公告还描述了一个远程代码执行问题：Ghidra客户端在反序列化RMI响应时没有 `ObjectInputFilter`，仅需打开一个精心准备的项目文件即可触发；报告者确认，在包含共享项目功能的所有版本（9.1及以后）中，相关代码路径均未改变。<sup>[17](https://github.com/NationalSecurityAgency/ghidra/security/advisories/GHSA-fgg5-g275-7742)</sup>

## 版本

Ghidra在GitHub上的NationalSecurityAgency组织下活跃开发，仓库采用Apache-2.0许可证，拥有8.65万星标。<sup>[4](https://github.com/NationalSecurityAgency/ghidra)</sup>

## References

1. [Ghidra vs IDA Pro (2026): Pricing, Features and Platforms Compared, TechYorker](https://techyorker.com/compare/ghidra-vs-ida-pro/)
2. [NSA releases cybersecurity tool to the public, Axios (March 5, 2019)](https://www.axios.com/2019/03/05/nsa-releases-cybersecurity-tool-open-source)
3. [Attention Ghidra Users: Full Source Code Released, NSA Press Release (April 4, 2019)](https://www.nsa.gov/Press-Room/Press-Releases-Statements/Press-Release-View/Article/1805182/attention-ghidra-users-full-source-code-released/)
4. [NationalSecurityAgency/ghidra, GitHub repository](https://github.com/NationalSecurityAgency/ghidra)
5. [SLEIGH, Ghidra Language Specification](https://ghidra.re/ghidra_docs/languages/html/sleigh.html)
6. [Ghidra vs IDA Pro, InfoSecLabs](https://infoseclabs.io/compare/ghidra-vs-ida-pro)
7. [Getting Started with Ghidra, GhidraDocs (Ghidra 12.2)](https://github.com/NationalSecurityAgency/ghidra/blob/master/GhidraDocs/GettingStarted.md)
8. [NSA's free malware research tool gains traction, 6 months on, Axios (August 8, 2019)](https://www.axios.com/2019/08/08/nsas-free-malware-research-tool-gains-traction-6-months-on)
9. [Decompiler Concepts, Ghidra Help (11.1.2)](https://ghidradocs.com/11.1.2_PUBLIC/help/Decompiler/help/topics/DecompilePlugin/DecompilerConcepts.html)
10. [ghidra DevGuide.md, NationalSecurityAgency/ghidra, GitHub](https://github.com/NationalSecurityAgency/ghidra/blob/master/DevGuide.md?plain=1)
11. [Malware Reverse Engineering Handbook, CCDCOE (2020)](https://ccdcoe.org/uploads/2020/07/Malware_Reverse_Engineering_Handbook.pdf)
12. [Ghidra vs IDA Pro Comparison (2026), ToolsInfo.com](https://toolsinfo.com/compare/ghidra-vs-ida-pro)
13. [TRex: Type Reconstruction for Binary Code, USENIX Security](https://www.usenix.org/system/files/usenixsecurity25-bosamiya.pdf)
14. [A Decompilation-Driven Framework for Malware Detection with Large Language Models, arXiv](https://arxiv.org/abs/2601.09035)
15. [LLM Agent-Assisted Reverse Engineering with Quantitative Readability Metrics, arXiv](https://arxiv.org/abs/2606.06838)
16. [Huge hacking campaign uses spoofed Ghidra, dnSpy, and SpiderFoot security tools, TechRadar (2026)](https://www.techradar.com/pro/security/huge-hacking-campaign-uses-spoofed-ghidra-dnspy-and-spiderfoot-security-tools-to-harvest-ad-revenue-and-serve-malware)
17. [Ghidra RCE via Unfiltered RMI Deserialisation, GitHub Security Advisory GHSA-fgg5-g275-7742](https://github.com/NationalSecurityAgency/ghidra/security/advisories/GHSA-fgg5-g275-7742)
18. [Releases, NationalSecurityAgency/ghidra, GitHub](https://github.com/NationalSecurityAgency/ghidra/releases)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Named software products and platforms › Security and penetration-testing tools

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/ghidra

English original: https://www.edgepedia.org/ghidra
