{"vuln_id":"GHSA-259w-wmqg-fp76","aliases":["CVE-2026-86046"],"description":"termux-sync: Arbitrary file write during restore via attacker-controlled manifest source path","published_at":"2026-11-16T22:09:24Z","modified_at":"2026-11-16T22:09:25Z","first_seen_at":"2026-11-21T19:15:20.238597Z","severity":"high","severity_source":"ghsa","cvss_score":7.1,"cvss_vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H","cwe":["CWE-22"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-259w-wmqg-fp76"},"matched_alias":null,"items":[{"id":2484,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-259w-wmqg-fp76 / CVE-2026-86046: termux-sync: Arbitrary file write during restore via attacker-controlled manifest source path","summary":"termux-sync: Arbitrary file write during restore via attacker-controlled manifest source path\n\ntermux-sync restore trusts fields inside an untrusted backup manifest and uses them as the extraction destination without validation.\n\nDuring restore, each archive entry is handled as:\n\n  src_dir = Path(info.get(\"source\", ...)).parent\n  extract_archive(archive, src_dir, ...)\n\nextract_archive opens the archive and runs tarfile.extract for every member with no path jail and no filter:\n\n  with tarfile.open(archive_path, \"r:*\") as tf:\n      for member in tf.getmembers():\n          tf.extract(member, dest_path, set_attrs=True)\n\nThere 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.\n\nImpact:\nA 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.\n\nReproduction (benign markers only):\n\n1. Build a backup directory with home.tar.gz (members: proof filename + optional config names) and manifest.json.\n2. Set files.home.source to any path whose parent is the desired write directory (e.g. $HOME/dummy_for_parent so parent is $HOME).\n3. Run the same extract path the tool uses: src_dir = Path(source).parent; tarfile.extract each member into src_dir.\n4. Observe attacker-controlled files created under $HOME and under other chosen roots (config / shell-rc style overwrite).\n\nExpected: restore only writes under fixed, validated roots; reject unsafe source values and members that resolve outside dest.\nActual: write destination is fully controlled by manifest.source; proof files and overwrites appear outside any intended jail.\n\nFix direction:\n- Do not trust manifest \"source\" for extract roots; use fixed app-defined destinations\n- Sanitize backup_name (basename; reject \"..\" and separators)\n- Extract with tarfile filter=\"data\" (or equivalent boundary checks) and refuse escape\n- Treat backups as untrusted input\n\nActual result (local marker-only reproduction):\n\nPROOF path: /data/data/com.termux/files/home/PWNED_BY_TERMUX_SYNC_RESTORE.txt\nPROOF exists? True\nPROOF content:\nPWNED\nThis file was written by a malicious termux-sync backup restore path.\nRoot cause: manifest files.*.source controls extract destination.\n\n*** VULN CONFIRMED: arbitrary write to $HOME ***\n\nimportant.conf => secret=ATTACKER_CONTROLLED\n*** VULN CONFIRMED: overwrite under attacker-chosen root ***\n\n.bashrc_sim shows injected:\nexport ATTACKER=1\n*** VULN CONFIRMED: startup-file style overwrite ***\n\nExtract roots used:\n  home  -> parent($HOME/dummy_for_parent) = $HOME\n  config -> parent(.../victim_sim/nested_dummy) = .../victim_sim\n\nReported and credited to Niranj R Mahaswar ( GitHub: @NiranjMahaswar )\n\nAffected packages: pip:termux-sync\nPatched: termux-sync 1.2.4","url":"https://github.com/advisories/GHSA-259w-wmqg-fp76","published_at":"2026-11-16T22:09:24Z","updated_at":"2026-11-16T22:09:25Z","fetched_at":"2026-11-21T19:15:18.416874Z","severity":"high","cvss_score":7.1,"epss":0.00266,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"termux-sync","vuln_id":"CVE-2026-86046","vuln_ids":["CVE-2026-86046","GHSA-259W-WMQG-FP76"],"tags":["ghsa","pip","CWE-22"],"cluster_id":2407,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2484","html":"https://vulnwatch.ve1ve2.com/item/2484"}},{"id":6203,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-86046: termux-sync is an open source tool for backing up and restoring a Termux environment across devices. Prior to 1.2.4, termux-sync restore uses the parent direct…","summary":"termux-sync is an open source tool for backing up and restoring a Termux environment across devices. Prior to 1.2.4, termux-sync restore uses the parent directory of the untrusted manifest.json files.*.source value as an extraction destination, and extract_archive calls tarfile.extract on archive members without enforcing a destination boundary. A victim who restores a malicious or tampered backup from local, shared, GitHub, or Google Drive storage can have files written anywhere the Termux user can write, including shell startup files or executable scripts that can lead to code execution when later used. The restore path also accepts unsafe backup_name values for temporary paths, and archive members are not constrained to the intended destination. This issue is fixed in version 1.2.4.\n\nReferences:\nhttps://github.com/djunekz/termux-sync/commit/9c8637b280ee3e126885def5ff5b326c289ee7cf\nhttps://github.com/djunekz/termux-sync/releases/tag/v1.2.4\nhttps://github.com/djunekz/termux-sync/security/advisories/GHSA-259w-wmqg-fp76","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-86046","published_at":"2026-11-16T17:17:35.707000Z","updated_at":"2026-11-16T19:17:53.730000Z","fetched_at":"2026-11-21T19:15:31.481974Z","severity":"high","cvss_score":7.1,"epss":0.00266,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"google","product":null,"vuln_id":"CVE-2026-86046","vuln_ids":["CVE-2026-86046","GHSA-259W-WMQG-FP76"],"tags":["CWE-22"],"cluster_id":2408,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/6203","html":"https://vulnwatch.ve1ve2.com/item/6203"}}]}