Severity:

HIGH RISK

(8.8)

Command Injection in Ghidra Auto-Analysis Comments

CVE-2026-4946

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Arbitrary command execution on the analyst's workstation via crafted binaries and UI interaction

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Ghidra before 12.0.3 improperly treats annotation directives embedded in automatically extracted binary data as trusted input, allowing attacker-controlled @execute annotations to be rendered as active UI elements.

When an analyst clicks these apparently benign auto-generated comments (for example, in CFStrings from Mach-O binaries), Ghidra may execute arbitrary commands on the analyst's machine, turning routine reverse-engineering activity into a potential code execution vector.

Affected context

This vulnerability affects environments where Ghidra is used to analyze untrusted or potentially malicious binaries, particularly formats where auto-analysis generates comments from embedded strings (such as CFStrings in Mach-O files).

The @execute annotation mechanism, designed for trusted user-authored comments, is also applied to comments originating from binary content, causing data extracted from the sample to be interpreted as active, clickable commands in the UI.

The issue surfaces during normal analyst interaction with the disassembly or decompiler views when clicking on these annotated comments.

Exploit preconditions

  • Attack surface: Ghidra desktop application UI, primarily within disassembly/decompiler panes and auto-generated comments.
  • Required access: Ability to supply a crafted binary to a Ghidra analyst (e.g., via malware samples, shared files, or repositories).
  • User interaction: The analyst must open the malicious sample in Ghidra and click on the auto-generated comment or annotation containing the @execute directive.
  • Trigger point: Ghidra's auto-analysis pipeline extracts binary data (e.g., strings) into comments; the UI then parses and treats @execute annotations within those comments as actionable.
  • Why exploitation is possible: The annotation parsing logic does not distinguish between trusted, user-authored comments and comments derived from untrusted binary data, allowing attacker-controlled content to inherit command-execution semantics.

Why this happens

The core issue is a failure to enforce a proper trust boundary between data derived from untrusted binaries and the privileged annotation features intended for trusted user input.

Ghidra's annotation system interprets the @execute directive embedded in comments as instructions to run commands on the host, but the same parsing logic is applied to comments generated from automatically extracted binary content.

This aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command, as attacker-controlled text from the binary is effectively promoted into an OS command context without appropriate neutralization, filtering, or separation of trusted versus untrusted sources.

Potential impact

  • Execution of attacker-controlled commands on the analyst's workstation.
  • Installation of malware or backdoors within the analysis environment.
  • Exfiltration or tampering of sensitive analysis artifacts, such as projects, scripts, or proprietary samples.
  • Lateral movement from the analyst's machine into broader internal networks.
  • Undermining trust in analysis results, including potential manipulation of investigation outcomes.

General mitigation guidance

Resilient mitigations focus on separating trusted annotations from untrusted data and reducing the privileges of any command-execution mechanisms:

  • Treat all content derived from binaries (e.g., strings, auto-generated comments) as untrusted and exclude it from annotation or command-execution parsing.
  • Restrict or disable @execute-like features by default, especially in environments that routinely handle untrusted input.
  • Introduce explicit trust elevation steps for any annotation that can trigger commands, such as requiring manual creation or confirmation before it becomes executable.
  • Constrain execution contexts (for example, sandboxing or least-privilege execution) for any mechanism that can launch host commands, so that even if misused, impact is limited.
  • Apply consistent input-neutralization and encoding rules to any data that moves from binary content into UI components that can affect system state.

How teams detect issues like this

Detection approaches can focus on both source-level patterns and runtime behavior:

  • Code review: Examine the annotation parsing and command-dispatch paths to confirm that only explicitly trusted sources can introduce @execute or similar directives; look for flows where comment strings from binary analysis feed into annotation handlers.
  • Static analysis: Define rules or queries to flag instances where UI text or comments derived from untrusted input are passed into command execution APIs or annotation interpreters without clear validation or trust checks.
  • Configuration and policy checks: Periodically validate that high-risk features like command-executing annotations are disabled or tightly constrained in standard analyst configurations.
  • Runtime monitoring: On hardened analysis workstations, use host-based monitoring to profile and alert on unexpected child processes spawned from Ghidra, especially in response to UI interactions with comments or annotations.

Sources

SourceLink
github.comgithub.com/NationalSecurityAgency/ghidra/security/advisories/GHSA-mc3p-mq2p-xw6v
takeonme.orgtakeonme.org/gcves/GCVE-1337-2026-00000000000000000000000000000000000000000000000001011111111111000111111110000000000000000000000000000000000000000000000000000000110

Frequently asked

questions

Not directly in the traditional sense. Exploitation typically requires an analyst to open a crafted binary in Ghidra and click on the malicious auto-generated comment. However, attackers can deliver such binaries through common channels like email, file shares, or repositories used for sample exchange.

The attacker only needs the ability to provide a binary that the analyst will open in Ghidra. No prior access to the analyst's machine is required, but successful exploitation depends on the analyst performing the specific UI interaction that triggers the @execute annotation.

The safest pattern is to enforce strict trust boundaries: never interpret or execute annotations, commands, or scripts sourced from untrusted binary content. Reserve any command-executing annotations for explicitly authored, trusted inputs and require that such features be opt-in and clearly delineated from passive data.

Design features so that untrusted data is always treated as inert text within the UI, especially in security tools that handle attacker-controlled inputs. Combine this with systematic threat modeling for "clickable" or executable UI elements, regular security-focused code reviews, and automated checks that flag flows from untrusted content into command execution paths.

Find out what's already
exploitable in your codebase.