CVE-2026-86046: Arbitrary File Write via Path Traversal in termux-sync Restore Workflow
Vulnerability ID: CVE-2026-86046
CVSS Score: 7.1
Published: 2026-11-16
A path traversal vulnerability (CWE-22) in termux-sync prior to version 1.2.4 allows an attacker to overwrite arbitrary files within the Termux environment during the backup restoration process. The flaw stems from the application trusting attacker-controlled extraction paths defined in the backup's manifest.json file, failing to validate archive members against directory traversal sequences during tar extraction, and using unsanitized backup names when constructing temporary directories. If a user restores a malicious backup archive from local storage, shared folders, GitHub, or Google Drive, an attacker can overwrite sensitive configuration files such as shell startup scripts or local binaries, resulting in arbitrary code execution under the privileges of the Termux user.
TL;DR
termux-sync versions prior to 1.2.4 are vulnerable to path traversal (CVE-2026-86046) during archive restoration. By manipulating manifest.json source paths or embedding traversal sequences inside tar archives, an attacker can achieve arbitrary file write and subsequent code execution when a user restores an untrusted backup. Users must upgrade to version 1.2.4.
Technical Details
- Vulnerability ID: CVE-2026-86046 / GHSA-259w-wmqg-fp76
- Weakness Class: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
- CVSS v3.1 Score: 7.1 High (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H)
- EPSS Score: 0.27% (18.70th Percentile)
- Affected Versions: termux-sync < 1.2.4
- Patched Version: termux-sync 1.2.4
- Primary Impact: Arbitrary File Write leading to Local Code Execution via Shell Startup Modification
- CISA KEV Status: Not Listed
Affected Systems
- djunekz/termux-sync
-
termux-sync: < 1.2.4 (Fixed in:
1.2.4)
Code Analysis
Commit: 9c8637b
Enforce whitelist of allowed extraction roots from BACKUP_ITEMS, add _safe_extract_member() boundary and symlink validation, enable PEP 706 tarfile data_filter, and sanitize backup_name in temporary directory construction.
--- a/src/termux_sync/__init__.py
+++ b/src/termux_sync/__init__.py
@@ -1,5 +1,45 @@
+def _safe_extract_member(member: tarfile.TarInfo, dest_path: Path):
+ dest_root = dest_path.resolve()
+
+ member_name = member.name
+ if member_name.startswith("/") or member_name.startswith("\\"):
+ raise ValueError(f"Unsafe absolute path in archive: {member_name!r}")
+ if any(part == ".." for part in Path(member_name).parts):
+ raise ValueError(f"Path traversal attempt in archive: {member_name!r}")
+
+ target = (dest_path / member_name).resolve()
+ try:
+ target.relative_to(dest_root)
+ except ValueError:
+ raise ValueError(f"Archive member escapes destination: {member_name!r} -> {target}")
+
+ if member.issym() or member.islnk():
+ link_target = member.linkname
+ if os.path.isabs(link_target):
+ raise ValueError(f"Unsafe absolute link target in archive: {member_name!r} -> {link_target!r}")
+ resolved_link = (target.parent / link_target).resolve()
+ try:
+ resolved_link.relative_to(dest_root)
+ except ValueError:
+ raise ValueError(f"Archive link escapes destination: {member_name!r} -> {link_target!r}")
+
+ if member.ischr() or member.isblk() or member.isfifo():
+ raise ValueError(f"Refusing device/fifo entry in archive: {member_name!r}")
Mitigation Strategies
- Upgrade termux-sync to version 1.2.4 or later to enforce manifest whitelist validation and safe tar member extraction.
- Avoid restoring Termux backup archives obtained from untrusted or unverified third-party sources, such as public GitHub repositories or shared Google Drive links.
- Use Python 3.12 or later where PEP 706 tarfile data_filter support provides native defense-in-depth against archive traversal.
- Audit shell initialization files and executable directories if an untrusted archive was previously restored on an unpatched version.
Remediation Steps:
- Run
pip install --upgrade "termux-sync>=1.2.4"inside Termux, or update the local Git repository checkout to tagv1.2.4(commit9c8637b280ee3e126885def5ff5b326c289ee7cf). - Verify the installed version by running
termux-sync --versionor checkingpip show termux-sync. - If untrusted backups were previously restored, inspect
~/.bashrc,~/.zshrc,~/.profile, and$PREFIX/bin/for unauthorized scripts or modified binaries.
References
- GitHub Security Advisory GHSA-259w-wmqg-fp76
- Fix Commit 9c8637b280ee3e126885def5ff5b326c289ee7cf
- termux-sync Release v1.2.4
- CVE.org Record: CVE-2026-86046
- NVD Vulnerability Detail: CVE-2026-86046
- CVEListV5 JSON Record for CVE-2026-86046
Read the full report for CVE-2026-86046 on our website for more details including interactive diagrams and full exploit analysis.
Top comments (0)