HIGH · CVSS 3.1 7.1 EPSS 0.2% · 5th percentile CWE-22

CVE-2026-86046: termux-sync: Arbitrary file write during restore via attacker-controlled manifest source path

Published 2026-11-16 · Updated 2026-11-16 · Also known as GHSA-259w-wmqg-fp76

Summary

The termux-sync package is vulnerable to arbitrary file writes during the restore process because it fails to validate source paths provided in untrusted manifest files. Users of termux-sync should update to version 1.2.4 or later to mitigate this risk.

Who is affected

An attacker can provide a malicious backup containing crafted manifest files and archive entries to write files anywhere the Termux user has write permissions. This can be leveraged to overwrite shell configuration files or scripts, potentially leading to local code execution when the user later executes those files.

Exploitability

The vulnerability is rated as High severity with a CVSS 3.1 score of 7.1. Exploitation requires local access and user interaction to initiate a restore from an untrusted source, as indicated by the AV:L and UI:R vector components. There is no evidence of active exploitation in the wild via CISA KEV.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-18. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
PyPI termux-sync >= 0, < 1.2.4 1.2.4 python -m pip install 'termux-sync>=1.2.4'

CVSS 3.1 vector

CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H

Attack vectorLocal
Attack complexityLow
Privileges requiredNone
User interactionRequired
ScopeUnchanged
ConfidentialityNone
IntegrityHigh
AvailabilityHigh

FAQ

What specifically allows this arbitrary file write?

The application blindly trusts the 'source' field in the backup manifest to define the extraction destination and uses the tarfile.extract method without a path jail or filtering.

Can an attacker overwrite system files?

The impact is limited to paths where the Termux user has write permissions; it does not necessarily grant root-level write access unless the Termux user context itself has those permissions.

Is there a known exploit currently being used in the wild?

No. The CISA Known Exploited Vulnerabilities catalog lists this as 'no'.

Original advisory description
termux-sync restore trusts fields inside an untrusted backup manifest and uses them as the extraction destination without validation. During restore, each archive entry is handled as: src_dir = Path(info.get("source", ...)).parent extract_archive(archive, src_dir, ...) extract_archive opens the archive and runs tarfile.extract for every member with no path jail and no filter: with tarfile.open(archive_path, "r:*") as tf: for member in tf.getmembers(): tf.extract(member, dest_path, set_attrs=True) There is no check that manifest "source" stays under an expected restore root, that tar members stay inside dest_path, or that backup_name used in temporary paths cannot contain ".." or separators. Impact: A victim who restores a malicious backup (local, shared, or from a compromised GitHub/Google Drive storage backend) can have arbitrary files written anywhere the Termux user can write. Overwriting shell startup files or executable scripts leads to local code execution on later use. Reproduction (benign markers only): 1. Build a backup directory with home.tar.gz (members: proof filename + optional config names) and manifest.json. 2. Set files.home.source to any path whose parent is the desired write directory (e.g. $HOME/dummy_for_parent so parent is $HOME). 3. Run the same extract path the tool uses: src_dir = Path(source).parent; tarfile.extract each member into src_dir. 4. Observe attacker-controlled files created under $HOME and under other chosen roots (config / shell-rc style overwrite). Expected: restore only writes under fixed, validated roots; reject unsafe source values and members that resolve outside dest. Actual: write destination is fully controlled by manifest.source; proof files and overwrites appear outside any intended jail. Fix direction: - Do not trust manifest "source" for extract roots; use fixed app-defined destinations - Sanitize backup_name (basename; reject ".." and separators) - Extract with tarfile filter="data" (or equivalent boundary checks) and refuse escape - Treat backups as untrusted input Actual result (local marker-only reproduction): PROOF path: /data/data/com.termux/files/home/PWNED_BY_TERMUX_SYNC_RESTORE.txt PROOF exists? True PROOF content: PWNED This file was written by a malicious termux-sync backup restore path. Root cause: manifest files.*.source controls extract destination. *** VULN CONFIRMED: arbitrary write to $HOME *** important.conf => secret=ATTACKER_CONTROLLED *** VULN CONFIRMED: overwrite under attacker-chosen root *** .bashrc_sim shows injected: export ATTACKER=1 *** VULN CONFIRMED: startup-file style overwrite *** Extract roots used: home -> parent($HOME/dummy_for_parent) = $HOME config -> parent(.../victim_sim/nested_dummy) = .../victim_sim Reported and credited to Niranj R Mahaswar ( GitHub: @NiranjMahaswar )

References

Source records: GHSA-259w-wmqg-fp76 (OSV.dev) · EPSS by FIRST, 2026-11-26.