CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-86046

CVE-2026-86046: Arbitrary File Write via Path Traversal in termux-sync Restore Workflow

Amit Schendel
Amit Schendel
Senior Security Researcher

Nov 17, 2026·11 min read·1 visit

Executive Summary (TL;DR)

termux-sync versions prior to 1.2.4 are vulnerable to path traversal (CVE-2026-86046) during archive restoration. By manipulating manifest.json source paths or embedding traversal sequences inside tar archives, an attacker can achieve arbitrary file write and subsequent code execution when a user restores an untrusted backup. Users must upgrade to version 1.2.4.

A path traversal vulnerability (CWE-22) in termux-sync prior to version 1.2.4 allows an attacker to overwrite arbitrary files within the Termux environment during the backup restoration process. The flaw stems from the application trusting attacker-controlled extraction paths defined in the backup's manifest.json file, failing to validate archive members against directory traversal sequences during tar extraction, and using unsanitized backup names when constructing temporary directories. If a user restores a malicious backup archive from local storage, shared folders, GitHub, or Google Drive, an attacker can overwrite sensitive configuration files such as shell startup scripts or local binaries, resulting in arbitrary code execution under the privileges of the Termux user.

Vulnerability Overview

termux-sync is an open-source, Python-based command-line utility developed to back up and restore Termux environments, configurations, and package states across Android devices. The tool operates by packaging designated directories and configuration files into compressed tar archives alongside a metadata file named manifest.json. Users can export these backups to or import them from local disk storage, shared device directories, remote GitHub repositories, or Google Drive.

In versions prior to 1.2.4, the restoration mechanism implemented in termux-sync contains multiple path traversal weaknesses classified under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory). When executing the termux-sync restore command, the utility parses the untrusted manifest.json file contained within the backup archive and extracts the accompanying .tar member archives without validating destination boundaries or sanitizing file paths.

The primary attack surface is exposed when a user imports and restores a backup archive originating from an external or untrusted source, such as a shared community dotfiles repository on GitHub or a public cloud storage link. Because the restoration routine implicitly trusts both the structural metadata in manifest.json and the member headers within the .tar archives, an attacker can direct file extraction to arbitrary locations on the filesystem.

While the process runs within the Android application sandbox assigned to Termux, successful exploitation grants the attacker arbitrary file write capabilities across any directory writable by the Termux user. By overwriting shell initialization files (such as ~/.bashrc or ~/.zshrc) or replacing executable binaries in $PREFIX/bin, an attacker can transition from arbitrary file overwrite to persistent code execution upon the next shell invocation.

Root Cause Analysis

The vulnerability in termux-sync prior to version 1.2.4 is the result of three distinct but compounding input validation failures across the cmd_restore() and extract_archive() functions. Each flaw independently allows an archive to escape its intended extraction directory.

The first flaw resides in how cmd_restore() determines the target extraction directory for each sub-archive listed in manifest.json. As the function iterates through the dictionary returned by manifest.get("files", {}).items(), it reads the source property directly from the untrusted JSON object and assigns Path(info.get("source", str(TERMUX_FILES))).parent as the destination root (src_dir). Furthermore, the application fails to verify whether the dictionary key corresponds to a legitimate, predefined backup category in BACKUP_ITEMS. Consequently, an attacker can define arbitrary keys in manifest.json and set the source attribute to any path on the filesystem, instructing termux-sync to extract the payload archive directly into the parent directory of that path.

The second flaw occurs inside extract_archive(), which handles the unpacking of tar archives using Python's standard tarfile module. The function iterates over tf.getmembers() and passes each TarInfo object directly to tf.extract(member, dest_path) without verifying that the resolved target path remains within dest_path. In Python versions prior to 3.12, or when the PEP 706 filter="data" parameter is omitted, tarfile.extract() honors absolute paths, relative .. traversal sequences, and symbolic or hard links pointing outside the extraction root. An attacker can embed member names such as ../../../../home/.bashrc or include symlinks pointing to sensitive directories followed by regular files writing through those links.

The third flaw involves the construction of the temporary working directory at the start of cmd_restore(). The application constructs the temporary path using string interpolation: Path(os.environ.get("TMPDIR", ...)) / f"restore_{backup_name}". Because backup_name is not sanitized to strip path separators or parent directory references (..), supplying a crafted backup_name allows directory creation and initial archive unpacking to traverse outside the designated temporary directory structure.

Code Analysis

Comparing the vulnerable implementation in termux-sync 1.2.3 against the patch introduced in commit 9c8637b280ee3e126885def5ff5b326c289ee7cf (v1.2.4) illustrates the exact mechanics of the flaw and the defense-in-depth measures applied to resolve it.

Vulnerable Implementation (<= 1.2.3)

In versions up to 1.2.3, cmd_restore() and extract_archive() operated without path normalization, boundary verification, or manifest key whitelisting:

# Vulnerable temporary directory creation in cmd_restore()
tmp_dir = Path(os.environ.get("TMPDIR", "/data/data/com.termux/files/usr/tmp")) / f"restore_{backup_name}"
tmp_dir.mkdir(parents=True, exist_ok=True)
 
# Vulnerable manifest processing in cmd_restore()
for key, info in manifest.get("files", {}).items():
    archive = tmp_dir / info["archive"]
    # BUG 1: Directly trusts the 'source' path from untrusted manifest.json
    src_dir = Path(info.get("source", str(TERMUX_FILES))).parent
    try:
        extract_archive(archive, src_dir, info["archive"], progress)
 
# Vulnerable extraction routine in extract_archive()
with tarfile.open(archive_path, "r:*") as tf:
    for member in tf.getmembers():
        try:
            # BUG 2: No traversal check, symlink validation, or PEP 706 filter
            tf.extract(member, dest_path, set_attrs=True)
        except Exception:
            try:
                member.uid = os.getuid()
                member.gid = os.getgid()
                tf.extract(member, dest_path, set_attrs=False)

Patched Implementation (1.2.4)

Commit 9c8637b280ee3e126885def5ff5b326c289ee7cf modifies both src/termux_sync/__init__.py and termux-sync.py to enforce strict input validation across four layers.

First, backup_name is sanitized using os.path.basename() after normalizing backslashes, and explicitly rejected if it resolves to ., .., or contains path separators:

# FIX 1: Sanitize backup_name before constructing tmp_dir
safe_backup_name = os.path.basename(str(backup_name).replace("\\", "/")).strip()
if not safe_backup_name or safe_backup_name in (".", "..") or "/" in safe_backup_name:
    console.print(f"  [red]✗ Invalid backup name: {backup_name!r}[/red]")
    return
backup_name = safe_backup_name

Second, cmd_restore() eliminates reliance on the source field inside manifest.json. Instead, it builds an allowed_roots dictionary mapped exclusively from the hardcoded BACKUP_ITEMS configuration. If a manifest key does not exist in allowed_roots, extraction for that entry is aborted:

# FIX 2: Derive destination roots strictly from internal BACKUP_ITEMS whitelist
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
 
for key, info in manifest.get("files", {}).items():
    archive = tmp_dir / info["archive"]
 
    src_dir = allowed_roots.get(key)
    if src_dir is None:
        console.print(f"  [red]✗ Refusing unknown/untrusted restore target for {key!r}[/red]")
        log("WARNING", f"Refused restore for unknown manifest key: {key!r}")
        continue

Third, the patch introduces _safe_extract_member() to validate every TarInfo entry prior to extraction, alongside enabling Python's data_filter (PEP 706) when supported by the runtime:

# FIX 3: Comprehensive member validation before extraction
def _safe_extract_member(member: tarfile.TarInfo, dest_path: Path):
    dest_root = dest_path.resolve()
 
    member_name = member.name
    # Reject absolute paths
    if member_name.startswith("/") or member_name.startswith("\\"):
        raise ValueError(f"Unsafe absolute path in archive: {member_name!r}")
    # Reject explicit parent traversal segments
    if any(part == ".." for part in Path(member_name).parts):
        raise ValueError(f"Path traversal attempt in archive: {member_name!r}")
 
    # Verify canonicalized target path resides within canonicalized dest_root
    target = (dest_path / member_name).resolve()
    try:
        target.relative_to(dest_root)
    except ValueError:
        raise ValueError(f"Archive member escapes destination: {member_name!r} -> {target}")
 
    # Validate symbolic and hard link targets stay within dest_root
    if member.issym() or member.islnk():
        link_target = member.linkname
        if os.path.isabs(link_target):
            raise ValueError(f"Unsafe absolute link target in archive: {member_name!r} -> {link_target!r}")
        resolved_link = (target.parent / link_target).resolve()
        try:
            resolved_link.relative_to(dest_root)
        except ValueError:
            raise ValueError(f"Archive link escapes destination: {member_name!r} -> {link_target!r}")
 
    # Block special device nodes and FIFOs
    if member.ischr() or member.isblk() or member.isfifo():
        raise ValueError(f"Refusing device/fifo entry in archive: {member_name!r}")

Fix Completeness Assessment

The remediation in v1.2.4 addresses the identified attack vectors by combining static target whitelisting, pre-extraction path canonicalization (Path.resolve() paired with relative_to()), link target boundary verification, and Python 3.12+ filter="data" enforcement. One subtle consideration in sequential tar extraction is symlink race or two-stage symlink traversal (where member A creates a valid internal symlink subdir/link -> . or similar, and member B traverses through it). However, because _safe_extract_member calls .resolve() on dest_path / member_name dynamically as each member is processed in sequence, any previously extracted symlink on disk is resolved by the operating system during the target = (dest_path / member_name).resolve() check, preventing two-stage symlink escapes outside dest_root.

Exploitation

Exploiting CVE-2026-86046 requires convincing a victim user to restore a crafted backup archive using termux-sync restore. Because termux-sync is specifically designed to synchronize environments across devices via GitHub repositories, Google Drive, or local files, distributing a weaponized backup archive disguised as a pre-configured Termux theme or development environment is a realistic delivery mechanism.

Attack Methodology

An attacker can achieve arbitrary file overwrite through two distinct techniques within the archive structure:

Method 1: Manifest source Path Manipulation

The attacker constructs a backup package containing a manifest.json file that specifies a target file inside the Termux home or binary directory as the source attribute. Because cmd_restore() uses Path(info.get("source")).parent as the extraction directory (src_dir), setting source to /data/data/com.termux/files/home/.bashrc causes src_dir to evaluate to /data/data/com.termux/files/home.

{
  "timestamp": "2026-07-28T12:00:00",
  "files": {
    "custom_stage": {
      "archive": "payload.tar.gz",
      "source": "/data/data/com.termux/files/home/.bashrc"
    }
  }
}

The attacker then packs a normal file named .bashrc (with no traversal characters required in the tar member header) inside payload.tar.gz. When extract_archive() unpacks payload.tar.gz into src_dir, it directly overwrites /data/data/com.termux/files/home/.bashrc.

Method 2: Tar Member Traversal (Zip-Slip Style)

Alternatively, the attacker leaves manifest.json pointing to a standard backup key and constructs payload.tar.gz using Python's tarfile module to insert relative traversal sequences (../../) or absolute paths directly into the TarInfo.name header:

import io
import tarfile
 
payload_content = b"#!/data/data/com.termux/files/usr/bin/sh\nid > /data/data/com.termux/files/home/pwned.txt\n"
 
with tarfile.open("payload.tar.gz", "w:gz") as tf:
    info = tarfile.TarInfo(name="../../../../data/data/com.termux/files/home/.bashrc")
    info.size = len(payload_content)
    info.mode = 0o755
    tf.addfile(info, io.BytesIO(payload_content))

Execution Flow

  1. The victim downloads or clones the malicious backup and runs termux-sync restore.
  2. termux-sync unpacks the outer container into $TMPDIR/restore_<backup_name> and reads manifest.json.
  3. During sub-archive extraction, .bashrc in the user's home directory (or a binary in /data/data/com.termux/files/usr/bin/) is overwritten with attacker-controlled shell commands.
  4. The next time the user opens a Termux session or invokes the compromised binary, the payload executes with the full permissions of the Termux environment.

Impact Assessment

The severity of CVE-2026-86046 is rated as High with a CVSS v3.1 base score of 7.1 (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H). The Attack Vector is Local (AV:L) and User Interaction is Required (UI:R) because exploitation depends on the user manually initiating the restoration of a malicious or tampered backup archive. Once triggered, Attack Complexity is Low (AC:L) and requires no additional privileges (PR:N).

The direct technical impact is High Integrity (I:H) and High Availability (A:H) within the scope of the Termux user context (S:U). An attacker can overwrite any file writable by the Termux UNIX user (u0_a* on Android). Overwriting critical shared libraries in $PREFIX/lib, package database metadata in $PREFIX/var/lib/dpkg, or core binaries in $PREFIX/bin can corrupt the environment and render the Termux installation inoperable.

Although the CVSS vector records Confidentiality Impact as None (C:N) because the archive extraction step itself only writes files and does not directly exfiltrate data, the practical secondary impact includes complete compromise of confidentiality. By overwriting shell startup scripts (~/.bashrc, ~/.profile, ~/.zshrc) or SSH configurations (~/.ssh/config, ~/.ssh/authorized_keys), an attacker achieves arbitrary code execution on subsequent shell startup. From that execution context, the attacker can read SSH private keys, cloud provider credentials, API tokens stored in environment variables, and any shared Android storage (~/storage/shared) mounted into Termux.

> [!NOTE] > As of the latest threat intelligence assessment, CVE-2026-86046 has an EPSS score of 0.00266 (18.70th percentile), indicating a low probability of widespread opportunistic exploitation. It is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, and no public weaponized exploits have been observed in the wild.

Remediation

To remediate CVE-2026-86046, users must update termux-sync to version 1.2.4 or later, which incorporates commit 9c8637b280ee3e126885def5ff5b326c289ee7cf.

Upgrading termux-sync

If installed via pip, upgrade the package directly within the Termux environment:

pip install --upgrade "termux-sync>=1.2.4"

If running termux-sync directly from a cloned Git repository, pull the latest release tag and verify the commit hash:

git fetch --all --tags
git checkout v1.2.4

Workarounds and Operational Mitigations

In environments where upgrading immediately is not feasible, apply the following operational controls:

  1. Restrict Backup Sources: Do not execute termux-sync restore on backup archives downloaded from untrusted third-party sources, public GitHub dotfiles repositories, or unverified cloud storage links.
  2. Pre-Restore Inspection: Before restoring any external backup on an unpatched version, manually inspect the contents of manifest.json and list the member paths of all internal .tar archives to verify the absence of .. segments, leading slashes, or unexpected symlink targets:
    # Inspect manifest.json for unexpected keys or modified 'source' paths
    cat manifest.json
     
    # List tar members and check for '../', leading '/', or '->' link targets
    tar -tvf archive_member.tar.gz | grep -E '(^/|\.\./|->)'

Post-Compromise Auditing

Users who have previously restored untrusted backups using termux-sync < 1.2.4 should audit their Termux installation for indicators of compromise. Specifically, inspect ~/.bashrc, ~/.bash_profile, ~/.zshrc, ~/.profile, and ~/.ssh/authorized_keys for unauthorized modifications, and verify the integrity of installed packages in $PREFIX/bin.

Official Patches

djunekzOfficial patch commit fixing path traversal in restore and archive extraction
djunekztermux-sync v1.2.4 release containing the security fix
GitHubGitHub Security Advisory GHSA-259w-wmqg-fp76

Fix Analysis (1)

Technical Appendix

CVSS Score
7.1/ 10
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H
EPSS Probability
0.27%
Top 81% most exploited

Affected Systems

djunekz/termux-sync

Affected Versions Detail

Product
Affected Versions
Fixed Version
termux-sync
djunekz
< 1.2.41.2.4
AttributeDetail
Vulnerability IDCVE-2026-86046 / GHSA-259w-wmqg-fp76
Weakness ClassCWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
CVSS v3.1 Score7.1 High (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H)
EPSS Score0.27% (18.70th Percentile)
Affected Versionstermux-sync < 1.2.4
Patched Versiontermux-sync 1.2.4
Primary ImpactArbitrary File Write leading to Local Code Execution via Shell Startup Modification
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1083File and Directory Discovery
Discovery
T1005Data from Local System
Collection
T1059.004Command and Scripting Interpreter: Unix Shell
Execution
T1546.004Event Triggered Execution: Unix Shell Configuration Modification
Persistence
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.

Vulnerability Timeline

Vulnerability privately disclosed to the maintainer by Niranj R Mahaswar.
2026-07-28
Maintainer committed patch 9c8637b280ee3e126885def5ff5b326c289ee7cf and released version 1.2.4.
2026-07-28
GitHub Security Advisory GHSA-259w-wmqg-fp76 published and CVE-2026-86046 assigned.
2026-11-16
CVE-2026-86046 published to CVE.org and the National Vulnerability Database (NVD).
2026-11-16
Initial EPSS score recorded at 0.00266 (18.70th percentile).
2026-11-17

References & Sources

  • [1]GitHub Security Advisory GHSA-259w-wmqg-fp76
  • [2]Fix Commit 9c8637b280ee3e126885def5ff5b326c289ee7cf
  • [3]termux-sync Release v1.2.4
  • [4]CVE.org Record: CVE-2026-86046
  • [5]NVD Vulnerability Detail: CVE-2026-86046
  • [6]CVEListV5 JSON Record for CVE-2026-86046

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 2 hours ago•CVE-2026-129296
6.5

CVE-2026-129296: Path Traversal in SpamScope mail-parser Attachment Extraction

SpamScope mail-parser versions 3.8.0 prior to 4.6.0 contain a path traversal vulnerability (CWE-22) within the write_attachments() and write_sample() functions. The library passes untrusted attachment filenames directly into os.path.join() without stripping directory components, validating path containment, or verifying symbolic links. An attacker can send a crafted email containing relative path traversal sequences or absolute filesystem paths in the Content-Disposition header to write or overwrite arbitrary files accessible to the parsing process.

Amit Schendel
Amit Schendel
2 views•9 min read
•about 3 hours ago•CVE-2026-129295
7.5

CVE-2026-129295: Polynomial Regular Expression Denial of Service (ReDoS) in SpamScope mail-parser

A Regular Expression Denial of Service (ReDoS) vulnerability exists in SpamScope mail-parser versions 4.2.0 prior to 4.6.1. Two separate regular expressions evaluated during standard email header parsing exhibit quadratic to cubic backtracking complexity when processing headers padded with whitespace or angle brackets. An unauthenticated remote attacker can exploit this flaw by sending a small, RFC-compliant email message, causing parsing worker threads or processes to stall at 100% CPU utilization for extended periods.

Amit Schendel
Amit Schendel
2 views•10 min read
•about 4 hours ago•CVE-2026-129297
7.5

CVE-2026-129297: Sender IP Address Spoofing in SpamScope mail-parser

CVE-2026-129297 is an origin validation vulnerability (CWE-345) in the Python library mail-parser prior to version 4.6.2. The MailParser.get_server_ipaddress() method fails to properly isolate MTA-recorded client IP addresses from sender-controlled text within email Received headers. Due to naive substring delimiter matching, appearance-based regular expression scanning, and fail-open header traversal, remote attackers can spoof their originating IP address to bypass email security controls, blocklists, and anti-spam attribution.

Amit Schendel
Amit Schendel
2 views•11 min read
•about 5 hours ago•CVE-2026-129299
6.5

CVE-2026-129299: Uncaught Exceptions and Silent Header Loss via Reflective Attribute Dispatch in SpamScope mail-parser

CVE-2026-129299 (GHSA-24mq-4vc6-2prf) is a parsing and serialization flaw in SpamScope mail-parser prior to version 4.6.2. The library uses reflective Python attribute resolution (getattr) over untrusted email header names and applies caller convenience transformations (such as underscore-to-hyphen folding and _json/_raw suffix stripping) directly to wire headers. An unauthenticated remote attacker can send crafted emails that trigger uncaught TypeError exceptions during JSON serialization or cause security-relevant headers and body content to be silently dropped without setting defect indicators.

Amit Schendel
Amit Schendel
3 views•11 min read
•about 6 hours ago•CVE-2026-129236
7.2

CVE-2026-129236: Command-Line Argument Injection in Kubeshark MCP Server

CVE-2026-129236 is a command-line argument injection vulnerability (CWE-88) in Kubeshark, an eBPF-based network observability tool for Kubernetes. Located within the Model Context Protocol (MCP) server implementation in cmd/mcpRunner.go, the flaw occurs when handling the start_kubeshark tool request. When the MCP server runs with the --allow-destructive flag, the callStartKubeshark function appends the caller-supplied pod_regex parameter directly to the kubeshark tap argument slice without an end-of-options (--) delimiter. Because Kubeshark uses the Cobra and pflag libraries for command-line parsing, any pod_regex value prefixed with a hyphen is interpreted as a CLI flag rather than a positional regular expression. An attacker capable of influencing MCP tool arguments, such as through indirect prompt injection against a connected Large Language Model (LLM) agent, can inject the --set flag to override Helm chart values like tap.docker.registry. Because Kubeshark deploys its worker DaemonSet with privileged security contexts and host networking enabled, redirecting the container image registry allows arbitrary code execution as root across all Kubernetes cluster nodes.

Alon Barad
Alon Barad
6 views•11 min read
•about 7 hours ago•CVE-2026-129235
5.3

CVE-2026-129235: Arbitrary File Write and Argument Injection in Kubeshark MCP Server

Kubeshark versions 53.1.0 prior to 53.4.0 contain an arbitrary file write and path traversal vulnerability (CWE-22) alongside an argument injection vulnerability (CWE-88) in the Model Context Protocol (MCP) server implementation (cmd/mcpRunner.go). The download_file tool fails to validate caller-supplied path and dest arguments, allowing an attacker who influences an AI agent driving kubeshark mcp to write Kubeshark Hub API responses to arbitrary locations writable by the local user. Additionally, the start_kubeshark tool appends the pod_regex argument without flag delimiters, allowing argument injection into the kubeshark tap subcommand.

Amit Schendel
Amit Schendel
5 views•10 min read