GHSA-259W-WMQG-FP76
Vulnerability from github – Published: 2026-11-16 22:09 – Updated: 2026-11-16 22:09termux-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):
- Build a backup directory with home.tar.gz (members: proof filename + optional config names) and manifest.json.
- Set files.home.source to any path whose parent is the desired write directory (e.g. $HOME/dummy_for_parent so parent is $HOME).
- Run the same extract path the tool uses: src_dir = Path(source).parent; tarfile.extract each member into src_dir.
- 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 )
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 1.2.3"
},
"package": {
"ecosystem": "PyPI",
"name": "termux-sync"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.2.4"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-86046"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": true,
"github_reviewed_at": "2026-11-16T22:09:24Z",
"nvd_published_at": "2026-11-16T17:17:35Z",
"severity": "HIGH"
},
"details": "termux-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 =\u003e 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 -\u003e parent($HOME/dummy_for_parent) = $HOME\n config -\u003e parent(.../victim_sim/nested_dummy) = .../victim_sim\n\nReported and credited to Niranj R Mahaswar ( GitHub: @NiranjMahaswar )",
"id": "GHSA-259w-wmqg-fp76",
"modified": "2026-11-16T22:09:24Z",
"published": "2026-11-16T22:09:24Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/djunekz/termux-sync/security/advisories/GHSA-259w-wmqg-fp76"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-86046"
},
{
"type": "WEB",
"url": "https://github.com/djunekz/termux-sync/commit/9c8637b280ee3e126885def5ff5b326c289ee7cf"
},
{
"type": "PACKAGE",
"url": "https://github.com/djunekz/termux-sync"
},
{
"type": "WEB",
"url": "https://github.com/djunekz/termux-sync/releases/tag/v1.2.4"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "termux-sync: Arbitrary file write during restore via attacker-controlled manifest source path"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.