Summary
Ghidra's extension installer before version 12.0.2 contains a path traversal flaw that fails to validate ZIP entry names during extraction.
A malicious extension can use crafted filenames with directory traversal sequences to write files outside the intended directory, potentially leading to arbitrary code execution when those files are later loaded or executed.
Affected context
This vulnerability affects environments where Ghidra's extension installer is used to import extensions packaged as ZIP files.
Risk increases when users install extensions from untrusted or third-party sources, and when Ghidra runs with elevated filesystem permissions.
The issue occurs during extension extraction, where ZIP entries are written to disk without sufficient checks on their paths, allowing writes outside the designated extension directory.
Exploit preconditions
- Attack surface: Ghidra extension installation mechanism that processes ZIP-based extension packages.
- Required access: Ability to convince a user to install a malicious extension ZIP, or otherwise supply a crafted extension to the installer.
- Trigger point: User initiates installation of the crafted extension; the installer extracts ZIP entries.
- Why exploitation is possible: The installer does not normalize and validate ZIP entry paths to ensure they remain within the target directory, allowing directory traversal sequences (e.g.,
../) to control final write locations.
Why this happens
The root cause aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory.
The extension installer trusts file paths embedded in ZIP entries and writes them directly to the filesystem without canonicalizing paths and enforcing that targets remain within the intended extension directory.
This missing validation allows attackers to use relative path segments and directory traversal to escape the designated extraction root and overwrite or create arbitrary files.
Potential impact
- Malicious files may be written outside the extension directory, including into user or application configuration paths.
- Existing scripts, libraries, or executables could be overwritten, potentially leading to arbitrary code execution.
- Persistent backdoors or unauthorized tooling can be planted in directories that Ghidra or other applications later load.
- Security settings, project data, or logs could be modified or corrupted, affecting integrity and availability.
General mitigation guidance
Effective mitigation focuses on strict path handling and minimizing the trust placed in archive contents.
Common defensive patterns include:
- Normalizing and canonicalizing all archive entry paths before extraction and verifying they resolve under the intended base directory.
- Explicitly rejecting entries containing
.., absolute paths, or path separators that escape the target directory. - Extracting only to a controlled, application-owned directory with restricted privileges.
- Running Ghidra and its extension installation process with least-privilege filesystem permissions, avoiding unnecessary write access to sensitive locations.
- Encouraging the use of extensions from trusted sources and signing or verifying extension packages where possible to reduce the attack surface.
How teams detect issues like this
Organizations and developers can detect this class of issue using:
- Static code analysis rules that flag file extraction code not validating or canonicalizing archive entry paths before writing.
- Manual code review focusing on ZIP or archive processing routines, verifying that a safe join check with a known root directory is performed.
- Instrumentation or logging around extension installation that records extracted file paths, enabling anomaly detection for unexpected directories.
- Security testing (including dynamic application security testing) that attempts to install crafted ZIPs with traversal sequences to confirm robust path validation.

