CVE-2026-141553: CVE-2026-141553: Path Traversal and Arbitrary File Overwrite in termux-sync Restore Routine
CVE-2026-141553: Path Traversal and Arbitrary File Overwrite in termux-sync Restore Routine Vulnerability ID: CVE-2026-141553 CVSS Score: 5.5 Published: 2026-12-03 CVE-2026-141553 (GHSA-x9x8-xcv7-5x5g) is a medium-s
CVE-2026-141553: Path Traversal and Arbitrary File Overwrite in termux-sync Restore Routine
Vulnerability ID: CVE-2026-141553
CVSS Score: 5.5
Published: 2026-12-03
CVE-2026-141553 (GHSA-x9x8-xcv7-5x5g) is a medium-severity path traversal and arbitrary file overwrite vulnerability in termux-sync prior to version 1.3.8. During backup restoration, the cmd_restore function computes the extraction containment boundary as the parent directory of the target backup folder ($PREFIX or .../files) rather than the specific subdirectory itself. Consequently, a crafted backup archive (such as usr_etc.tar.gz) can extract files into sibling directories like $PREFIX/bin, overwriting system executables such as $PREFIX/bin/sh and achieving arbitrary code execution within the Termux user context.
TL;DR
An overly permissive extraction jail in termux-sync < 1.3.8 allows malicious backup archives to write files outside their designated subdirectories, enabling attackers to overwrite executables in $PREFIX/bin and achieve arbitrary code execution when a user restores an untrusted or tampered backup.
⚠️ Exploit Status: POC
Technical Details
- CVE / Advisory ID: CVE-2026-141553 / GHSA-x9x8-xcv7-5x5g
- Weakness Class: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
- CVSS v3.1 Score: 5.5 Medium (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N)
- Affected Component: termux-sync < 1.3.8 (cmd_restore / extract_archive / _safe_extract_member)
- Attack Vector: Local restoration of crafted backup archive containing sibling directory paths or outbound links
- Security Impact: Arbitrary file overwrite in $PREFIX (e.g., $PREFIX/bin/sh) leading to arbitrary code execution
- Exploit Status: Proof-of-Concept published in official GitHub Security Advisory (Not in CISA KEV)
- Patched Version: termux-sync 1.3.8
Affected Systems
- termux-sync (PyPI package / CLI tool for Termux Android environment)
-
termux-sync: < 1.3.8 (1.1.0 through 1.3.7) (Fixed in:
1.3.8)
Code Analysis
Commit: 3dd44a2
fix(restore): confine archive members to item root and validate package names (v1.3.7 partial fix)
@@ -343,12 +343,31 @@ def _safe_extract_member(
+def _check_member_root(member: tarfile.TarInfo, expected_top: str | None):
+ if expected_top is None:
+ return
+ parts = [p for p in Path(member.name).parts if p != "."]
+ if not parts or parts[0] != expected_top:
+ raise ValueError(
+ f"Archive member outside expected root {expected_top!r}: {member.name!r}"
+ )
Commit: 40a0163
fix(restore): prevent symlink/hardlink escape from expected_top jail (v1.3.8 complete fix)
@@ -343,14 +343,31 @@ def _safe_extract_member(
+def _within(path: Path, root: Path) -> bool:
+ return path == root or root in path.parents
+
+def _check_member_root(
+ member: tarfile.TarInfo, dest_path: Path, expected_top: str | None
+):
if expected_top is None:
return
parts = [p for p in Path(member.name).parts if p != "."]
if not parts or parts[0] != expected_top:
raise ValueError(
f"Archive member outside expected root {expected_top!r}: {member.name!r}"
)
+ jail = (dest_path / expected_top).resolve()
+ target = (dest_path / member.name).resolve()
+ if not _within(target, jail):
+ raise ValueError(f"Archive member escapes {expected_top!r}: {member.name!r}")
+ if member.issym() or member.islnk():
+ link_base = dest_path if member.islnk() else target.parent
+ resolved_link = (link_base / member.linkname).resolve()
+ if not _within(resolved_link, jail):
+ raise ValueError(
+ f"Archive link escapes {expected_top!r}: {member.name!r} -> {member.linkname!r}"
+ )
Exploit Details
- GitHub Security Advisory: Official GitHub Security Advisory containing a complete Python proof-of-concept script that generates a malicious usr_etc.tar.gz archive to overwrite $PREFIX/bin/sh.
Mitigation Strategies
- Upgrade termux-sync to version 1.3.8 or later to enforce canonical subdirectory containment and link target validation during archive restoration.
- Restrict restore operations exclusively to trusted backup archives generated locally or stored on access-controlled, integrity-verified storage backends.
- Pre-screen backup tarballs (usr_etc.tar.gz, usr_lib.tar.gz, home.tar.gz) for unexpected top-level path prefixes or outbound symbolic/hard links prior to running termux-sync restore.
- Monitor $HOME/.config/termux-sync/sync.log for 'Skipped unsafe archive member during restore' warning entries and run 'dpkg --verify' in Termux to detect altered system binaries in $PREFIX/bin.
Remediation Steps:
- Update termux-sync via pip: pip install --upgrade 'termux-sync>=1.3.8'
- Verify the installed version reports 1.3.8 or newer: termux-sync --version
- If an untrusted backup was previously restored on version <= 1.3.7, verify the integrity of installed Termux packages by executing: dpkg --verify
- Reinstall any packages reporting modified binaries in $PREFIX/bin or $PREFIX/lib using: pkg reinstall
References
- GitHub Security Advisory GHSA-x9x8-xcv7-5x5g
- NVD - CVE-2026-141553 Detail
- CVE.org Record - CVE-2026-141553
- GitHub Commit 3dd44a266cc9fba816c684164067616c7c0ef61d (Initial Member Root Check)
- GitHub Commit 40a016331662c2c161f6045657b374fd00c05811 (Symlink/Hardlink Escape Fix)
- termux-sync Release v1.3.8
- CVEList V5 Record - CVE-2026-141553.json
Read the full report for CVE-2026-141553 on our website for more details including interactive diagrams and full exploit analysis.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.