termux-sync: Arbitrary file write during restore via attacker-controlled manifest source path
The termux-sync restore command 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 executes tarfile.extract for every member without a path jail and without any 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 the manifest's source remains under an expected restore root, that tar members stay inside dest_path, or that backup_name used in temporary paths cannot contain .. or path separators.
Impact
A victim who restores a malicious backup (local, shared, or fetched from a compromised GitHub/Google Drive storage backend) can have arbitrary files written anywhere the Termux user has write permissions. Overwriting shell startup files or executable scripts leads to local code execution upon later use.
Reproduction (benign markers only)
- Build a backup directory with
home.tar.gz(members: proof filename + optional config names) andmanifest.json. - Set
files.home.sourceto any path whose parent is the desired write directory (e.g.,$HOME/dummy_for_parentso parent is$HOME). - Run the same extract path the tool uses:
src_dir = Path(source).parent;tarfile.extracteach member intosrc_dir. - Observe attacker-controlled files created under
$HOMEand 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.
Actual Result (local marker-only reproduction)
PROOF path: /data/data/com.termux/files/home/PWNED_BY_TERMUX_SYNC_RESTORE.txtPROOF exists? TruePROOF content:PWNED This file was written by a malicious termux-sync backup restore path. Root cause: manifest files.*.source controls extract destination.- Confirmed: arbitrary write to
$HOME important.conf => secret=ATTACKER_CONTROLLED(overwrite under attacker-chosen root confirmed).bashrc_simshows injected:export ATTACKER=1(startup-file style overwrite confirmed)
Extract roots used:
home -> parent($HOME/dummy_for_parent) = $HOMEconfig -> parent(.../victim_sim/nested_dummy) = .../victim_sim
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
Credits
Reported and credited to Niranj R Mahaswar (GitHub: @NiranjMahaswar).
What to do
Upgrade termux-sync to version 1.2.4 or later.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| Python (PyPI) | termux-sync | < 1.2.4 | 1.2.4 |
References
- https://github.com/djunekz/termux-sync/security/advisories/GHSA-259w-wmqg-fp76
- https://nvd.nist.gov/vuln/detail/CVE-2026-86046
- https://github.com/djunekz/termux-sync/commit/9c8637b280ee3e126885def5ff5b326c289ee7cf
- https://github.com/djunekz/termux-sync
- https://github.com/djunekz/termux-sync/releases/tag/v1.2.4
- CVSS vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H- Weakness (CWE)
CWE-22- Platform
- Python (PyPI)
- Package
termux-sync- Disclosed
- 16.11.2026
- Updated
- 17.11.2026 10:00
Sources and licenses · Edited or translated by DockRay; source rights and applicable licenses are retained.
OSV / GitHub Advisory Database - GHSA-259w-wmqg-fp76 - CC BY 4.0
Vulnerability history: termux-sync
All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.
This is the only known vulnerability of this package.
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.