Home/Research/Post

GHSA-x9x8-xcv7-5x5g: termux-sync: Restore extracts archive members outside the backed-up directory because the extraction jail is the parent of each backup root

  • Severity: MEDIUM
  • CVE: CVE-2026-141553
  • Ecosystems: pip
  • Packages: termux-sync

## Summary

`termux-sync restore` extracts each archive into the parent of the directory that archive is supposed to hold. The containment check then compares members against that wider directory, so an archive declared as `usr_etc` or `usr_lib` can write anywhere under `$PREFIX`, including `$PREFIX/bin`.

This is a residual gap in the fix for GHSA-259w-wmqg-fp76 / CVE-2026-86046. The guards that advisory added all work. What survives is the choice of destination they are checked against.

## Affected versions

Tested on:

– Package version: `termux-sync` 1.3.6 installed from PyPI (`termux_sync-1.3.6-py3-none-any.whl`)
– Repository commit: `054e6d88acf16c7d9b025846bcc2652b2975c68a` on main
– Python: 3.12.16, where `tarfile.data_filter` is available
– Dependencies: `rich==15.0.0`, `markdown-it-py==4.3.0`, `mdurl==0.1.2`, `Pygments==2.21.0`
– OS: Debian in a container, non-root, no network during the restore

Only 1.3.6 was tested. The primitive looks present in earlier releases, but unchecked. Releases before `9c8637b` are already covered by CVE-2026-86046.

Main and the release differ only inside `cmd_daemon`. Lines 1 to 700, which hold all the archive and extraction code, are identical, so main has the same behaviour. `termux-sync.py` is a byte-identical copy of `src/termux_sync/__init__.py`, so the line numbers below apply to both.

## Impact

An attacker who controls the content of a backup that a victim restores can write files anywhere under `$PREFIX`, overwriting existi…

Source: GitHub Security Advisories · 2026-12-03