{"id":"CVE-2026-86046","kind":"vulnerability","aliases":["CVE-2026-86046","GHSA-259w-wmqg-fp76"],"related":[],"title":"termux-sync: Arbitrary file write during restore via attacker-controlled manifest source path","description":"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 => 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 )","summary":"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.","severity":"high","cvss":7.1,"epss":null,"exploited":false,"exploited_at":null,"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"],"how_to_check":"- Check the installed version with `pip show termux-sync`; versions up to `1.2.3` are affected.\n- Look for `termux-sync` in any Termux setup scripts or Python environments that run restore.\n- Only restore backups from trusted sources until the package is updated.","fix":"- `termux-sync` `1.2.4`\n- Vendor fixed version: unknown","status":"open","published_at":"2026-11-16T17:17:35+00:00","first_seen_at":"2026-11-16T17:37:58+00:00","triaged_at":"2026-11-16T22:13:27+00:00","updated_at":"2026-11-16T22:13:27+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-11-16T22:13:27Z","model":"claude-haiku-5-5","output":{"fix":"- `termux-sync` `1.2.4`\n- Vendor fixed version: unknown","reach":"local","title":"termux-sync: malicious backup restore writes files anywhere on Android","impact":"high","summary":"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.","audience":"developers","category":"package","nicknames":[],"who_cares":["termux","android","python","termux-sync"],"confidence":0.8,"fix_status":"available","needs_auth":"no","worst_case":"Attacker-chosen files overwritten in the Termux home, enabling code execution","analyst_note":"","how_to_check":"- Check the installed version with `pip show termux-sync`; versions up to `1.2.3` are affected.\n- Look for `termux-sync` in any Termux setup scripts or Python environments that run restore.\n- Only restore backups from trusted sources until the package is updated.","plain_action":"","product_name":"","needs_analyst":false,"not_affected_if":["no-untrusted-restore","version-1.2.4-or-later"],"who_is_affected":"Anyone who runs termux-sync restore on a backup they did not create, including backups from shared folders or from a compromised cloud storage account. Users who only create backups or never restore untrusted ones are much less exposed. unknown for the exact vendor build range.","user_interaction":"yes","product_ecosystem":"","needs_special_setup":"no","severity_if_unknown":"high"},"cost_usd":0.000852,"input_tokens":5692,"output_tokens":565,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-2026':17A,25A '-22':35B '-86046':18A,26A '/data/data/com.termux/files/home/pwned_by_termux_sync_restore.txt':408C '/victim_sim':478C '/victim_sim/nested_dummy':477C '1':250C,460C '2':265C '259w':21A '3':284C '4':304C 'actual':342C,399C 'android':33B 'anywher':225C 'app':372C 'app-defin':371C 'appear':354C 'arbitrari':4A,76B,222C,438C 'archiv':118C,130C,131C,135C,138C,154C 'attack':11A,307C,444C,451C,459C 'attacker-chosen':450C 'attacker-control':10A,306C 'attr':168C 'backend':219C 'backup':52B,65B,69B,104C,192C,209C,253C,376C,395C,425C 'basenam':378C 'bashrc':454C 'benign':247C 'boundari':389C 'build':251C 'cannot':198C 'caus':429C 'check':173C,390C 'chosen':62B,316C,452C 'code':92B,241C 'compromis':215C 'config':261C,318C,475C 'confirm':437C,447C,462C 'contain':199C 'content':413C 'control':12A,308C,347C,433C,445C 'craft':68B 'creat':310C 'credit':481C 'cve':16A,24A 'cwe':34B 'data':386C 'defin':373C 'desir':275C 'dest':165C,188C,341C 'destin':60B,112C,344C,374C,435C 'dir':124C,133C,294C,303C 'direct':360C 'directori':254C,277C 'drive':217C 'e.g':278C 'entri':119C 'equival':388C 'escap':393C 'everi':143C 'execut':236C,242C 'exist':410C 'expect':180C,324C 'export':458C 'extract':59B,111C,129C,134C,288C,367C,382C,434C,468C 'field':100C 'file':5A,66B,77B,87B,223C,234C,309C,351C,416C,431C,465C 'filenam':259C 'files.home.source':267C 'filter':151C,385C 'fix':329C,359C,370C 'fp76':23A 'fulli':346C 'ghsa':20A 'ghsa-259w-wmqg-fp76':19A 'github':486C 'github/google':216C 'handl':121C 'home':283C,312C,441C,471C,474C 'home.tar.gz':256C 'home/dummy_for_parent':279C,473C 'impact':202C 'important.conf':442C 'info.get':126C 'inject':457C 'input':398C 'insid':101C,187C 'intend':357C 'jail':148C,358C 'later':94B,244C 'lead':90B,238C 'local':210C,240C,401C 'mahaswar':485C 'make':71B 'malici':208C,421C 'manifest':13A,54B,105C,175C,364C,430C 'manifest.json':264C 'manifest.source':349C 'marker':248C,403C 'marker-on':402C 'member':144C,160C,164C,185C,257C,300C,337C 'modifi':82B 'name':193C,262C,377C 'niranj':483C 'niranjmahaswar':487C 'observ':305C 'open':136C 'option':260C 'outsid':340C,355C 'overwrit':75B,231C,323C,353C,448C,467C 'packag':36B 'parent':128C,272C,281C,297C,472C,476C 'path':15A,49B,125C,147C,155C,166C,189C,197C,270C,289C,295C,407C,427C 'proof':258C,350C,406C,409C,412C 'pwned':414C 'python':37B 'r':156C,484C 'rc':321C 'refus':392C 'reject':332C,379C 'report':479C 'reproduct':246C,405C 'resolv':339C 'restor':8A,56B,72B,98C,116C,181C,206C,325C,426C 'result':400C 'root':182C,317C,331C,368C,428C,453C,469C 'run':93B,140C,285C 'sanit':375C 'script':237C 'secret':443C 'separ':201C,381C 'set':167C,266C 'share':211C 'shell':38B,85B,232C,320C 'shell-rc':319C 'show':456C 'sim':455C 'sourc':14A,48B,127C,176C,296C,334C,365C,432C 'src':123C,132C,293C,302C 'startup':86B,233C,464C 'startup-fil':463C 'stay':177C,186C 'storag':218C 'style':322C,466C 'sync':3A,29A,32A,42B,45B,97C,424C 'tar':184C 'tarfil':384C 'tarfile.extract':141C,298C 'tarfile.open':153C 'temporari':196C 'termux':2A,28A,31A,39B,41B,44B,79B,96C,227C,423C 'termux-sync':1A,27A,30A,40B,43B,95C,422C 'tf':158C 'tf.extract':163C 'tf.getmembers':162C 'tool':291C 'treat':394C 'true':169C,411C 'trust':46B,99C,363C 'unsaf':333C 'untrust':103C,397C 'use':107C,194C,245C,292C,369C,470C 'user':80B,228C 'valid':114C,330C 'valu':335C 'via':9A 'victim':204C 'vuln':436C,446C,461C 'whose':271C 'without':113C 'wmqg':22A 'write':6A,73B,230C,276C,327C,343C,439C 'written':224C,418C","nicknames":[],"mitigations":[],"who_affected":"Anyone who runs termux-sync restore on a backup they did not create, including backups from shared folders or from a compromised cloud storage account. Users who only create backups or never restore untrusted ones are much less exposed. unknown for the exact vendor build range.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":["termuxsync"],"ptokens":["sync","termux"],"labels":["android","cwe22","high","package","pypi","python","shell","termux","termuxsync","vendor"],"campaign_type":null,"search_a":"'-2026':17A,25A '-86046':18A,26A '259w':21A 'arbitrari':4A 'attack':11A 'attacker-control':10A 'control':12A 'cve':16A,24A 'file':5A 'fp76':23A 'ghsa':20A 'ghsa-259w-wmqg-fp76':19A 'manifest':13A 'path':15A 'restor':8A 'sourc':14A 'sync':3A,29A,32A 'termux':2A,28A,31A 'termux-sync':1A,27A,30A 'via':9A 'wmqg':22A 'write':6A","search_b":"'-22':35B 'android':33B 'arbitrari':76B 'backup':52B,65B,69B 'chosen':62B 'code':92B 'craft':68B 'cwe':34B 'destin':60B 'extract':59B 'file':66B,77B,87B 'later':94B 'lead':90B 'make':71B 'manifest':54B 'modifi':82B 'overwrit':75B 'packag':36B 'path':49B 'python':37B 'restor':56B,72B 'run':93B 'shell':38B,85B 'sourc':48B 'startup':86B 'sync':42B,45B 'termux':39B,41B,44B,79B 'termux-sync':40B,43B 'trust':46B 'user':80B 'write':73B","search_c":"'/data/data/com.termux/files/home/pwned_by_termux_sync_restore.txt':408C '/victim_sim':478C '/victim_sim/nested_dummy':477C '1':250C,460C '2':265C '3':284C '4':304C 'actual':342C,399C 'anywher':225C 'app':372C 'app-defin':371C 'appear':354C 'arbitrari':222C,438C 'archiv':118C,130C,131C,135C,138C,154C 'attack':307C,444C,451C,459C 'attacker-chosen':450C 'attacker-control':306C 'attr':168C 'backend':219C 'backup':104C,192C,209C,253C,376C,395C,425C 'basenam':378C 'bashrc':454C 'benign':247C 'boundari':389C 'build':251C 'cannot':198C 'caus':429C 'check':173C,390C 'chosen':316C,452C 'code':241C 'compromis':215C 'config':261C,318C,475C 'confirm':437C,447C,462C 'contain':199C 'content':413C 'control':308C,347C,433C,445C 'creat':310C 'credit':481C 'data':386C 'defin':373C 'desir':275C 'dest':165C,188C,341C 'destin':112C,344C,374C,435C 'dir':124C,133C,294C,303C 'direct':360C 'directori':254C,277C 'drive':217C 'e.g':278C 'entri':119C 'equival':388C 'escap':393C 'everi':143C 'execut':236C,242C 'exist':410C 'expect':180C,324C 'export':458C 'extract':111C,129C,134C,288C,367C,382C,434C,468C 'field':100C 'file':223C,234C,309C,351C,416C,431C,465C 'filenam':259C 'files.home.source':267C 'filter':151C,385C 'fix':329C,359C,370C 'fulli':346C 'github':486C 'github/google':216C 'handl':121C 'home':283C,312C,441C,471C,474C 'home.tar.gz':256C 'home/dummy_for_parent':279C,473C 'impact':202C 'important.conf':442C 'info.get':126C 'inject':457C 'input':398C 'insid':101C,187C 'intend':357C 'jail':148C,358C 'later':244C 'lead':238C 'local':210C,240C,401C 'mahaswar':485C 'malici':208C,421C 'manifest':105C,175C,364C,430C 'manifest.json':264C 'manifest.source':349C 'marker':248C,403C 'marker-on':402C 'member':144C,160C,164C,185C,257C,300C,337C 'name':193C,262C,377C 'niranj':483C 'niranjmahaswar':487C 'observ':305C 'open':136C 'option':260C 'outsid':340C,355C 'overwrit':231C,323C,353C,448C,467C 'parent':128C,272C,281C,297C,472C,476C 'path':125C,147C,155C,166C,189C,197C,270C,289C,295C,407C,427C 'proof':258C,350C,406C,409C,412C 'pwned':414C 'r':156C,484C 'rc':321C 'refus':392C 'reject':332C,379C 'report':479C 'reproduct':246C,405C 'resolv':339C 'restor':98C,116C,181C,206C,325C,426C 'result':400C 'root':182C,317C,331C,368C,428C,453C,469C 'run':140C,285C 'sanit':375C 'script':237C 'secret':443C 'separ':201C,381C 'set':167C,266C 'share':211C 'shell':232C,320C 'shell-rc':319C 'show':456C 'sim':455C 'sourc':127C,176C,296C,334C,365C,432C 'src':123C,132C,293C,302C 'startup':233C,464C 'startup-fil':463C 'stay':177C,186C 'storag':218C 'style':322C,466C 'sync':97C,424C 'tar':184C 'tarfil':384C 'tarfile.extract':141C,298C 'tarfile.open':153C 'temporari':196C 'termux':96C,227C,423C 'termux-sync':95C,422C 'tf':158C 'tf.extract':163C 'tf.getmembers':162C 'tool':291C 'treat':394C 'true':169C,411C 'trust':99C,363C 'unsaf':333C 'untrust':103C,397C 'use':107C,194C,245C,292C,369C,470C 'user':228C 'valid':114C,330C 'valu':335C 'victim':204C 'vuln':436C,446C,461C 'whose':271C 'without':113C 'write':230C,276C,327C,343C,439C 'written':224C,418C","cause_entry":null,"cause_path":null,"disclosures_checked_at":null,"first_public_at":"2026-07-28T10:33:19+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-86046","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-86046","severity":null,"published_at":"2026-11-16T17:17:35+00:00","modified_at":"2026-11-16T17:17:35+00:00","first_seen_at":"2026-11-16T17:37:58+00:00","fetched_at":"2026-11-16T17:37:58+00:00","note":null},{"source":"ghsa","external_id":"GHSA-259w-wmqg-fp76","url":"https://github.com/advisories/GHSA-259w-wmqg-fp76","severity":"high","published_at":"2026-11-16T22:09:24+00:00","modified_at":"2026-11-16T22:09:25+00:00","first_seen_at":"2026-11-16T22:12:15+00:00","fetched_at":"2026-11-16T22:12:15+00:00","note":null}],"documents":[{"id":171517,"url":"https://github.com/djunekz/termux-sync/commit/9c8637b280ee3e126885def5ff5b326c289ee7cf","title":"Patch: github.com","kind":"other","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":171518,"url":"https://github.com/djunekz/termux-sync/releases/tag/v1.2.4","title":"Release notes: github.com","kind":"release","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release notes: github.com"},{"id":171519,"url":"https://github.com/djunekz/termux-sync/security/advisories/GHSA-259w-wmqg-fp76","title":"Vendor advisory: github.com","kind":"vendor","source":"nvd","publisher":"vendor","text":null,"published_at":"2026-07-28T10:33:19+00:00","relation":"advisory","confidence":null,"note":"Vendor advisory: github.com"},{"id":172694,"url":"https://api.github.com/repos/djunekz/termux-sync/security-advisories/GHSA-259w-wmqg-fp76","title":"Maintainer's advisory: api.github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Maintainer's advisory: api.github.com"}],"disclosures":[],"exploit_sources":[],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}