---
id: "CVE-2026-86046"
page: "https://infrastack.ai/live/CVE-2026-86046"
kind: "vulnerability"
aliases: ["CVE-2026-86046", "GHSA-259w-wmqg-fp76"]
title: "termux-sync: Arbitrary file write during restore via attacker-controlled manifest source path"
severity: "high"
cvss: 7.1
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "termux-sync", "fixed": [], "affected": "", "ecosystem": "vendor"}, {"name": "termux-sync", "fixed": ["1.2.4"], "affected": "<= 1.2.3", "ecosystem": "pypi"}]
ecosystems: ["pypi", "vendor"]
tags: ["android", "cwe-22", "package", "python", "shell", "termux", "termux-sync"]
not_affected_if: ["no-untrusted-restore", "version-1.2.4-or-later"]
published_at: "2026-11-16T17:17:35+00:00"
first_seen_at: "2026-11-16T17:37:58+00:00"
updated_at: "2026-11-16T22:13:27+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-86046", "first_seen_at": "2026-11-16T17:37:58+00:00"}, {"source": "ghsa", "url": "https://github.com/advisories/GHSA-259w-wmqg-fp76", "first_seen_at": "2026-11-16T22:12:15+00:00"}]
exploit_sources: []
---

# termux-sync: Arbitrary file write during restore via attacker-controlled manifest source path

Link for people: https://infrastack.ai/live/CVE-2026-86046 (this .md is for agents)

termux-sync trusts the source path in a backup's manifest when restoring, so the extraction destination is chosen by the backup file. A crafted backup can make restore write or overwrite arbitrary files the Termux user can modify, such as shell startup files, which can lead to code running later.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- vendor:termux-sync affected range not listed fixed no fixed version listed
- pypi:termux-sync affected <= 1.2.3 fixed 1.2.4

## How to check

- Check the installed version with `pip show termux-sync`; versions up to `1.2.3` are affected.
- Look for `termux-sync` in any Termux setup scripts or Python environments that run restore.
- Only restore backups from trusted sources until the package is updated.

## Fix

- `termux-sync` `1.2.4`
- Vendor fixed version: unknown

## Timeline

- 2026-11-16T17:37:58+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-86046
- 2026-11-16T22:12:15+00:00 ghsa https://github.com/advisories/GHSA-259w-wmqg-fp76

## Documents

- [advisory] Vendor advisory: github.com https://github.com/djunekz/termux-sync/security/advisories/GHSA-259w-wmqg-fp76
- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/djunekz/termux-sync/security-advisories/GHSA-259w-wmqg-fp76
- [fix] Patch: github.com https://github.com/djunekz/termux-sync/commit/9c8637b280ee3e126885def5ff5b326c289ee7cf
- [fix] Release notes: github.com https://github.com/djunekz/termux-sync/releases/tag/v1.2.4

## From the sources

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 )

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
