CVE-2026-141553
termux- sync: Restore extracts archive members outside the backed- up directory because the extraction jail is the parent of each backup root (PyPI)
- Severity
- 5.5MediumLocal attack, no privileges, needs user interactionCVSS 3.1, CVE List
- Exploitation
- UnknownNo source reports exploitation yet.
- Exploit chance
- 0.33% in 30 daysPercentile27thEPSS, scored
- Listed fix
1.3.8for termux-sync From GitHub Advisories and OSV
Overview
termux-sync is an open source tool for backing up and restoring a Termux environment across devices. Prior to 1.3.8, termux-sync checks restored archive members against the parent of each backed-up directory instead of the directory itself. An attacker who controls a backup that a user restores can write files to other locations under the Termux installation prefix, including replacing executables. This can result in arbitrary code execution with the privileges of the Termux user when a replaced executable is run. This issue is fixed in version 1.3.8.
CVSS 3.1 vector
Exploitability
- Attack vector
- Local
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Required
Impact
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- High
- Availability
- None
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:NExploit chance over time
Affected
Packages 1
| Package | Affected | Fixed |
|---|---|---|
termux-syncPyPI | through 1.3.7 | 1.3.8 |
| before 1.3.8, plus listed versions 1.1.01.1.11.1.21.2.01.2.1 Show 9 more versionsShow less1.2.21.2.31.2.41.2.61.2.81.3.01.3.51.3.61.3.7 | 1.3.8 |
Products 1
Sources
CVE List Score usedCVSS 3.15.5
termux-sync: Restore extracts archive members outside the backed-up directory because the extraction jail is the parent of each backup root
termux-sync is an open source tool for backing up and restoring a Termux environment across devices. Prior to 1.3.8, termux-sync checks restored archive members against the parent of each backed-up directory instead of the directory itself. An attacker who controls a backup that a user restores can write files to other locations under the Termux installation prefix, including replacing executables. This can result in arbitrary code execution with the privileges of the Termux user when a replaced executable is run. This issue is fixed in version 1.3.8.
- Record
CVE-2026-141553- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N - Weakness
- CWE-22
- Updated
- 2026-12-03
EUVDEUVD-2026-141822CVSS 3.15.5
termux-sync is an open source tool for backing up and restoring a Termux environment across devices. Prior to 1.3.8, termux-sync checks restored archive members against the parent of each backed-up directory instead of the directory itself. An attacker who controls a backup that a user restores can write files to other locations under the Termux installation prefix, including replacing executables. This can result in arbitrary code execution with the privileges of the Termux user when a replaced executable is run. This issue is fixed in version 1.3.8.
- Record
EUVD-2026-141822- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N - Updated
- 2026-12-03
GitHub AdvisoriesGHSA-x9x8-xcv7-5x5gCVSS 3.15.5
termux-sync: Restore extracts archive members outside the backed-up directory because the extraction jail is the parent of each backup root
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-sync1.3.6 installed from PyPI (termux_sync-1.3.6-py3-none-any.whl) - Repository commit:
054e6d88acf16c7d9b025846bcc2652b2975c68aon main - Python: 3.12.16, where
tarfile.data_filteris 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 existing ones. Replacing an executable such as $PREFIX/bin/sh gives code execution as the Termux user the next time anything invokes it, and it leaves dpkg's record of $PREFIX disagreeing with what is on disk.
Attacker requirements:
- Write access to the backup the victim restores. Nothing on the victim's device. This is the same position GHSA-259w-wmqg-fp76 described: "a victim who restores a malicious backup (local, shared, or from a compromised GitHub/Google Drive storage backend)". A backup shared between people moving to a new device is the use the README describes, and
SECURITY.md:41already contemplates a GitHub storage repo being public. - The victim runs
termux-sync restoreand answersyat the prompt (__init__.py:1599). - No authentication, no root, and no non-default configuration.
$PREFIXis writable by the Termux user by design, which is howpkg installworks, so no privilege escalation is involved.
The restore preview (__init__.py:1587-1596) shows the backup name, date, package count and archive count. It does not list member paths, so a victim who inspects it cannot see bin/sh in a config archive.
Root cause
cmd_restore builds the destination for each manifest key by taking the parent of the backup root (src/termux_sync/__init__.py:1611-1614):
allowed_roots = {}
for item_key, _label, item_root in BACKUP_ITEMS:
if item_root is not None:
allowed_roots[item_key] = Path(item_root).resolve().parent
With BACKUP_ITEMS at :69-74 and TERMUX_HOME = $PREFIX, TERMUX_FILES = $HOME (:66-67):
| manifest key | backup root | resulting jail | what that jail holds |
|---|---|---|---|
| home | $HOME | …/files | all of $PREFIX |
| usr_etc | $PREFIX/etc | $PREFIX | bin/, lib/, libexec/, etc/ |
| usr_lib | $PREFIX/lib | $PREFIX | same |
The extraction then passes that jail to extract_archive at :1631, and _safe_extract_member (:555-582) checks members against it:
target = (dest_path / member_name).resolve()
try:
target.relative_to(dest_root)
That check is written correctly. Both sides are resolved, .. and absolute members are rejected, link targets are checked, device and FIFO entries are refused, and extract runs with filter="data" at :601 and :609. A member named bin/sh in a usr_etc archive simply is inside $PREFIX, so it passes and gets written.
The comment three lines above…
- Record
GHSA-x9x8-xcv7-5x5g- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N - Weakness
- CWE-22
- Updated
- 2026-12-03
NVDCVSS 3.15.5
termux-sync is an open source tool for backing up and restoring a Termux environment across devices. Prior to 1.3.8, termux-sync checks restored archive members against the parent of each backed-up directory instead of the directory itself. An attacker who controls a backup that a user restores can write files to other locations under the Termux installation prefix, including replacing executables. This can result in arbitrary code execution with the privileges of the Termux user when a replaced executable is run. This issue is fixed in version 1.3.8.
- Record
CVE-2026-141553- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N - Weakness
- CWE-22
- Updated
- 2026-12-03
OSVCVSS 3.15.5
termux-sync: Restore extracts archive members outside the backed-up directory because the extraction jail is the parent of each backup root
termux-sync is an open source tool for backing up and restoring a Termux environment across devices. Prior to 1.3.8, termux-sync checks restored archive members against the parent of each backed-up directory instead of the directory itself. An attacker who controls a backup that a user restores can write files to other locations under the Termux installation prefix, including replacing executables. This can result in arbitrary code execution with the privileges of the Termux user when a replaced executable is run. This issue is fixed in version 1.3.8.
- Record
CVE-2026-141553- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N - Weakness
- CWE-22
- Updated
- 2026-12-03
OSVGHSA-x9x8-xcv7-5x5gCVSS 3.15.5
termux-sync: Restore extracts archive members outside the backed-up directory because the extraction jail is the parent of each backup root
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-sync1.3.6 installed from PyPI (termux_sync-1.3.6-py3-none-any.whl) - Repository commit:
054e6d88acf16c7d9b025846bcc2652b2975c68aon main - Python: 3.12.16, where
tarfile.data_filteris 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 existing ones. Replacing an executable such as $PREFIX/bin/sh gives code execution as the Termux user the next time anything invokes it, and it leaves dpkg's record of $PREFIX disagreeing with what is on disk.
Attacker requirements:
- Write access to the backup the victim restores. Nothing on the victim's device. This is the same position GHSA-259w-wmqg-fp76 described: "a victim who restores a malicious backup (local, shared, or from a compromised GitHub/Google Drive storage backend)". A backup shared between people moving to a new device is the use the README describes, and
SECURITY.md:41already contemplates a GitHub storage repo being public. - The victim runs
termux-sync restoreand answersyat the prompt (__init__.py:1599). - No authentication, no root, and no non-default configuration.
$PREFIXis writable by the Termux user by design, which is howpkg installworks, so no privilege escalation is involved.
The restore preview (__init__.py:1587-1596) shows the backup name, date, package count and archive count. It does not list member paths, so a victim who inspects it cannot see bin/sh in a config archive.
Root cause
cmd_restore builds the destination for each manifest key by taking the parent of the backup root (src/termux_sync/__init__.py:1611-1614):
allowed_roots = {}
for item_key, _label, item_root in BACKUP_ITEMS:
if item_root is not None:
allowed_roots[item_key] = Path(item_root).resolve().parent
With BACKUP_ITEMS at :69-74 and TERMUX_HOME = $PREFIX, TERMUX_FILES = $HOME (:66-67):
| manifest key | backup root | resulting jail | what that jail holds |
|---|---|---|---|
| home | $HOME | …/files | all of $PREFIX |
| usr_etc | $PREFIX/etc | $PREFIX | bin/, lib/, libexec/, etc/ |
| usr_lib | $PREFIX/lib | $PREFIX | same |
The extraction then passes that jail to extract_archive at :1631, and _safe_extract_member (:555-582) checks members against it:
target = (dest_path / member_name).resolve()
try:
target.relative_to(dest_root)
That check is written correctly. Both sides are resolved, .. and absolute members are rejected, link targets are checked, device and FIFO entries are refused, and extract runs with filter="data" at :601 and :609. A member named bin/sh in a usr_etc archive simply is inside $PREFIX, so it passes and gets written.
The comment three lines above…
- Record
GHSA-x9x8-xcv7-5x5g- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N - Weakness
- CWE-22
- Updated
- 2026-12-03
The JSON record also has the rest of 2 source descriptions.
History
Recorded by Every CVE
| Day | Changed | Sources |
|---|---|---|
| Published date | CVE List, EUVD, NVD | |
| Published date | EUVD | |
| Affected packages, references | OSV | |
| Affected packages, key facts, references | GitHub Advisories | |
| Other IDs, references | OSV | |
| Other IDs, published date | EUVD, NVD | |
| First indexed | CVE List |
Upstream dates may differ.
References
github.com/djunekz/termux-sync/security/advisories/GHSA-x9x8-xcv7-5x5g
github.com/djunekz/termux-sync/commit/3dd44a266cc9fba816c684164067616c7c0ef61d
github.com/djunekz/termux-sync/commit/40a016331662c2c161f6045657b374fd00c05811
github.com/djunekz/termux-sync/releases/tag/v1.3.8
nvd.nist.gov/vuln/detail/CVE-2026-141553
github.com/advisories/GHSA-x9x8-xcv7-5x5g
github.com/CVEProject/cvelistV5/tree/main/cves/2026/141xxx/CVE-2026-141553.json
github.com/djunekz/termux-sync