Summary
A directory traversal flaw in the jadx XAPK plugin loader allows a crafted .xapk archive to write files outside the intended temporary unpack directory.
When certain path and launch conditions are met, an attacker-controlled JAR can be planted in the plugins directory, leading to execution of malicious plugin code on subsequent jadx runs.
Affected context
This vulnerability appears when jadx processes untrusted .xapk files using the XAPK plugin loader in versions 1.5.2 through 1.5.5.
It is most relevant on systems where:
- Users open
.xapkfiles from arbitrary sources, - The current working directory for launching jadx is an ancestor of the configuration directory,
- The plugins
dropinsdirectory is located under that ancestor path.
Under these conditions, path resolution during XAPK unpacking can escape the temporary directory and reach the plugins location.
Exploit preconditions
- Attack surface: Local desktop or build environment where a user runs jadx on attacker-supplied
.xapkfiles. - Required access: Ability to convince a user or automated process to open a malicious
.xapkwith a vulnerable version of jadx. - Trigger point: XAPK unpacking via
XApkLoader, which resolves archive entry names withtmpDir.resolve(fileName)after a current-working-directory-based ZIP path check. - Why exploitation is possible: The security check is tied to the current working directory and does not enforce that resolved paths stay inside the dedicated temporary unpack directory. A crafted entry name can escape
tmpDirand targetplugins/dropins, allowing arbitrary JAR placement that is later loaded byURLClassLoaderandServiceLoader.
Why this happens
The core issue is improper validation and normalization of file paths derived from archive entry names, a pattern associated with CWE-22: Improper Limitation of a Pathname to a Restricted Directory.
Instead of enforcing that all extracted entries remain within the XAPK temporary directory, the implementation relies on a current-working-directory-based ZIP security check and then directly calls tmpDir.resolve(fileName). This approach trusts the archive entry names to be safe and does not robustly prevent directory traversal or path escape.
As a result, a malicious archive can cause files to be written outside the intended unpack directory, including into the configurable plugins dropins folder, where they are later treated as trusted plugin JARs and loaded for execution.
Potential impact
- An attacker-controlled JAR may be written into the
plugins/dropinsdirectory. - Malicious plugin code can be executed during subsequent jadx runs.
- The user's local jadx environment could be fully compromised.
- Arbitrary code execution can occur in the context of the user running jadx.
- Local files accessible to the user may be read or modified by attacker-controlled plugin logic.
General mitigation guidance
Effective mitigation focuses on tightening path handling during archive extraction and reducing trust in plugin discovery paths.
Common defensive patterns include:
- Ensuring archive extraction routines enforce that all resolved paths remain within a dedicated, restricted directory (e.g., by normalizing paths and checking ancestry before writes).
- Rejecting archive entries that contain path traversal components or absolute paths.
- Treating plugin directories as sensitive and limiting how and from where plugin JARs can be discovered.
- Running tools that process untrusted archives with least privilege, so even if an arbitrary file write occurs, it has minimal impact.
- Applying a secure-by-default configuration that disables automatic plugin loading from writable locations or requires explicit user confirmation.
How teams detect issues like this
Detection typically combines code-level inspection with runtime monitoring:
- Static analysis or manual code review focusing on archive extraction logic that uses
Path.resolve,Fileconstructors, or similar APIs without strict directory-bound checks. - Searching for patterns where user-controlled archive entry names or filenames are written directly to disk, especially near plugin or configuration paths.
- Enforcing organizational coding standards that require path normalization and base-directory checks for all extraction and unpack routines.
- Using automated review tools or SAST configurations to flag potential directory traversal issues around ZIP/TAR handling and plugin loading flows.

