CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-39973

CVE-2026-39973: Arbitrary File Write via Path Traversal in Apktool

Alon Barad
Alon Barad
Software Engineer

Apr 24, 2026·6 min read·77 visits

Executive Summary (TL;DR)

A security regression in Apktool 3.0.0/3.0.1 allows attackers to craft malicious APKs that perform arbitrary file writes during decoding, potentially leading to RCE on the host system.

Apktool versions 3.0.0 and 3.0.1 contain a high-severity path traversal vulnerability due to a security regression in resource decoding. By crafting a malicious APK with a modified resources.arsc file, an attacker can escape the intended output directory, leading to arbitrary file write and potential remote code execution on the analyst's machine.

Vulnerability Overview

Apktool is an industry-standard utility used by security researchers and developers to reverse engineer Android applications. The tool decodes binary APK files into human-readable project directories for analysis. CVE-2026-39973 is a path traversal vulnerability identified as CWE-22 that affects Apktool versions 3.0.0 and 3.0.1. The flaw triggers specifically during the apktool d decoding phase when the application processes the resources.arsc file.

The vulnerability originates from a security regression introduced during a major codebase refactor in December 2025. Developers inadvertently removed critical path sanitization functions that previously protected the file extraction logic. This removal exposed the application to directory traversal attacks via maliciously crafted resource type names.

By leveraging this vulnerability, an attacker can escape the intended output directory during the decoding process. The vulnerability enables arbitrary file writes on the host system executing the tool. This condition escalates to unauthenticated remote code execution, granting the attacker the privileges of the user running Apktool.

Root Cause Analysis

During the APK extraction process, Apktool parses the resources.arsc binary file to reconstruct the original resource directory structure. This structure relies heavily on the Type String Pool, an internal mapping that defines names for standard Android resource categories. Legitimate categories include types such as drawable, layout, or string.

In affected versions, the application reads the typeName from the string pool and concatenates it directly to the base project output directory string. Prior to the vulnerability introduction, Apktool mitigated path traversal by routing this concatenated string through BrutIO.sanitizePath() and BrutIO.detectPossibleDirectoryTraversal(). These functions validated the resulting path against the sandbox boundaries.

Commit e10a0450c7afcd9462c0b76bcbff0e7428b92bdd unintentionally removed these security checks from the ResFileDecoder.java component. The application consequently trusts the attacker-controlled typeName entirely. The unvalidated path is passed directly to file-writing sinks without any normalization checks.

The resulting extraction path follows the format [typeName][qualifiers]/[name].[ext]. If an attacker supplies a sequence such as ../../../../.ssh/ as the typeName, the system evaluates the relative path from the working directory. The File object resolves this relative sequence to a location completely outside the intended project sandbox.

Code Analysis

The vulnerability resides within the path construction logic of the resource file decoder. Without sanitization wrappers, the variables extracted from the parsed ARSC file flow directly into the File object initialization. The code snippet below demonstrates the vulnerable state prior to the patch.

// Vulnerable path construction in ResFileDecoder.java
String outResPath = entry.getTypeName() + entry.getConfig().getQualifiers() + "/" + entry.getName();
outResPath += "." + ext;
// File object created without BrutIO.sanitizePath()
File outFile = new File(outDir, outResPath);

The remediation in version 3.0.2 applies a strict defense-in-depth approach. Commit 65dd8480dfcb63068562ffaa527f71bb0a9f772c implements resource type whitelisting within ResTypeSpec.java. The application now verifies that the extracted typeName matches a hardcoded list of legitimate Android resource categories.

// Whitelisting fix in ResTypeSpec.java
public static final Set<String> ALLOWED_TYPES = new HashSet<>(Arrays.asList(
    "anim", "animator", "color", "drawable", "layout", "menu", "raw", "string", "xml"
));
 
public ResTypeSpec(...) {
    if (!ALLOWED_TYPES.contains(name)) {
        this.name = String.format("invalid%02X", id);
    } else {
        this.name = name;
    }
}

In addition to the whitelist, the developers reinstated the BrutIO.sanitizePath() wrapper in the file-writing sinks. This ensures that even if an attacker bypasses the ResTypeSpec validation, the resulting path undergoes strict boundary normalization before the system opens a file handle.

Exploitation

Exploitation requires the attacker to manipulate the binary structure of an Android APK. The attacker targets the resources.arsc file, specifically focusing on the entries stored within the Type String Pool. This file dictates how the Android OS, and subsequently Apktool, structures the application resources.

Using a hex editor or a custom resource compiler, the attacker overwrites a legitimate resource type name with a directory traversal payload. A payload such as ../../../../.ssh/ replaces a standard type entry like drawable. The attacker then distributes this modified APK to the target researcher or automated analysis sandbox.

The attack sequence initiates when the victim executes apktool d malicious.apk in their terminal environment. The application parses the manipulated resources.arsc file and extracts the traversal sequence. It formulates the output path using the injected directory traversal characters.

As the decoding process writes the extracted resource contents to disk, it places the file at the attacker-specified location. The attacker controls both the destination path via the string pool and the file contents via the corresponding resource data block. This grants a precise, arbitrary file write primitive on the host filesystem.

Impact Assessment

Successful exploitation results in arbitrary file writes on the host system running Apktool. This capability directly translates to unauthenticated remote code execution. The code executes under the privileges of the user running the Apktool process, which is typically a developer or security analyst.

An attacker can overwrite sensitive configuration files to gain persistence or execute commands upon the next shell initialization. Common targets include ~/.ssh/config for connection hijacking and ~/.ssh/authorized_keys for direct SSH access. Attackers frequently target shell profiles such as ~/.bashrc and ~/.zshrc to achieve silent code execution.

The vulnerability carries a CVSS v3.1 base score of 7.1, categorizing it as high severity. This score reflects the severe integrity and confidentiality impact combined with the requirement for user interaction. The attack vector is classified as local because the user must explicitly execute the tool against the malicious file.

The Exploit Prediction Scoring System (EPSS) score remains exceptionally low at 0.00014, placing it in the 2.78th percentile. This low score reflects the highly targeted nature of the attack. It is designed to compromise reverse engineers rather than serve as a vector for broad, automated internet scanning.

Remediation

Organizations and individual users must upgrade Apktool to version 3.0.2 or later to remediate the vulnerability entirely. Administrators can verify the currently installed version by executing apktool -version in their terminal environment. Package managers should be updated to pull the latest signed binary from the official repository.

If immediate patching is not feasible, users must isolate the execution environment. Security engineers should execute Apktool strictly within a dedicated virtual machine or an ephemeral container. This architectural containment restricts the blast radius of a successful arbitrary file write, preventing compromise of the primary host machine.

Detection teams can monitor endpoint file systems for unexpected writes to sensitive directories during Apktool execution. File Integrity Monitoring (FIM) solutions should flag unauthorized modifications to /etc/ or user home configuration directories. Processes spawned by the Java runtime executing Apktool should not possess write access outside of designated temporary directories.

Official Patches

iBotPeachesOfficial GitHub Security Advisory

Fix Analysis (2)

Technical Appendix

CVSS Score
7.1/ 10
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
EPSS Probability
0.01%
Top 97% most exploited

Affected Systems

Apktool 3.0.0Apktool 3.0.1

Affected Versions Detail

Product
Affected Versions
Fixed Version
Apktool
iBotPeaches
3.0.0 - 3.0.13.0.2
AttributeDetail
CWE IDCWE-22
Attack VectorLocal (Requires user interaction)
CVSS7.1
EPSS0.00014 (2.78%)
ImpactArbitrary File Write / RCE
Exploit StatusPoC-level
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1204.002User Execution: Malicious File
Execution
T1564.001Hidden Files and Directories
Defense Evasion
CWE-22
Path Traversal

Improper Limitation of a Pathname to a Restricted Directory

Known Exploits & Detection

GitHub Security AdvisoryExploit maturity documented as PoC-level in technical advisory

Vulnerability Timeline

Regression introduced in commit e10a045 (PR #4041)
2025-12-12
Development of version 3.0.2 starts
2026-02-22
Commit 65dd848 whitelists resource type names
2026-04-01
Version 3.0.2 is officially tagged and released
2026-04-19
CVE-2026-39973 is published
2026-04-21

References & Sources

  • [1]GHSA-m8mh-x359-vm8m
  • [2]Regression Commit
  • [3]Fix Commit (Whitelisting)
  • [4]Pull Request #4041
  • [5]NVD Record CVE-2026-39973

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 12 hours ago•CVE-2026-75856
9.2

CVE-2026-75856: Server-Side Request Forgery (SSRF) Bypass via DNS Resolution TOCTOU in CodeWhale

A critical Server-Side Request Forgery (SSRF) bypass vulnerability exists in CodeWhale before version 0.8.64 (and version 0.8.41 in the 0.8.x branch) due to a Time-of-Check to Time-of-Use (TOCTOU) bug in its DNS pre-flight validation mechanism. By returning a temporary resolution failure during validation and subsequently resolving to restricted IPs during HTTP execution, attackers can bypass security rules.

Amit Schendel
Amit Schendel
3 views•6 min read
•about 13 hours ago•CVE-2026-75912
8.3

CVE-2026-75912: Argument Injection and Arbitrary File Disclosure in CodeWhale Git Tools

An argument injection vulnerability in CodeWhale (CVE-2026-75912 / GHSA-c6mw-8xh8-gpq6) allows unauthenticated remote attackers to execute arbitrary option commands on the git binary. By passing malicious command-line flags inside git_blame and git_show tool helper functions, an attacker can bypass typical access controls to read arbitrary local system files via the underlying git process.

Alon Barad
Alon Barad
6 views•5 min read
•about 14 hours ago•CVE-2026-63735
8.6

CVE-2026-63735: Cross-Tenant Authorization Bypass in SurrealDB Custom API Routing Handler

SurrealDB prior to version 3.2.0 is vulnerable to an authorization bypass where authenticated users can invoke custom API endpoints belonging to other tenants. This cross-tenant data access occurs because the system fails to validate authorization scope boundaries against request-supplied namespace and database identifiers before executing scripts with elevated definer's rights.

Amit Schendel
Amit Schendel
5 views•6 min read
•about 15 hours ago•CVE-2026-63733
4.3

CVE-2026-63733: Incorrect Authorization in SurrealDB Permissions Clause

An incorrect authorization vulnerability (CWE-863) in SurrealDB allows authenticated, low-privileged users to execute unauthorized state-modifying queries. This occurs because the database disabled permissions during evaluation of custom PERMISSIONS WHERE predicates to prevent infinite recursion.

Alon Barad
Alon Barad
3 views•7 min read
•about 16 hours ago•CVE-2026-72799
6.9

CVE-2026-72799: Missing Authorization in SiYuan Filetree Path-Resolution API

SiYuan before v3.7.4 fails to enforce publish-access filters on five filetree path-resolution endpoints, allowing unauthenticated attackers to reconstruct private directory layouts and map document structures.

Alon Barad
Alon Barad
4 views•7 min read
•about 17 hours ago•CVE-2026-72798
9.2

CVE-2026-72798: Missing Authorization and Information Disclosure in SiYuan renderAttributeView

Prior to version v3.7.4, the SiYuan personal knowledge management system contained a critical logical authorization vulnerability within its database view rendering component. The flaws allowed unauthenticated remote attackers to bypass publish-access filters on databases, exposing sensitive Relation and Rollup cell contents belonging to private or password-protected repositories.

Amit Schendel
Amit Schendel
4 views•5 min read