Skip to main content
Vulnerability Database/CVE-2025-59825

CVE-2025-59825: astral-tokio-tar Path Traversal Vulnerability

CVE-2025-59825 is a path traversal vulnerability in astral-tokio-tar that enables attackers to write files outside intended directories and potentially execute code. This article covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2025-59825 Overview

CVE-2025-59825 is a path traversal vulnerability [CWE-22] in astral-tokio-tar, an asynchronous Rust library for reading and writing tar archives. Versions 0.5.3 and earlier allow tar archives to extract files outside the intended destination directory when callers use the Entry::unpack_in_raw API. The Entry::allow_external_symlinks control, which defaults to true, can also be bypassed through a pair of symbolic links that individually resolve inside the destination but combine to point outside of it. An attacker supplying a malicious tar archive can perform arbitrary file writes and potentially pivot to code execution. The maintainers patched the issue in version 0.5.4.

Critical Impact

Arbitrary file write through crafted tar archives enables attackers to overwrite sensitive files and escalate to code execution in applications that extract untrusted archives using astral-tokio-tar.

Affected Products

  • astral-tokio-tar versions 0.5.3 and earlier
  • Rust applications consuming the Entry::unpack_in_raw extraction API
  • Downstream tools built on astral-tokio-tar, including the Astral uv Python package manager

Discovery Timeline

  • 2025-09-23 - CVE-2025-59825 published to NVD
  • 2026-10-11 - Last updated in NVD database

Technical Details for CVE-2025-59825

Vulnerability Analysis

The vulnerability stems from incomplete path validation during tar archive extraction. The astral-tokio-tar crate exposes Entry::unpack_in_raw, which fails to normalize archive member paths against the destination directory before writing files. Attackers can embed relative path components such as ../ in archive entries to escape the intended extraction root.

A second flaw affects the Entry::allow_external_symlinks safeguard. The control inspects each symlink in isolation. An archive containing two symlinks, where each individually points inside the destination but their composition resolves outside of it, bypasses the check. Chained symlink resolution then redirects subsequent file writes to arbitrary locations on disk.

Both issues can be combined. An attacker extracting a malicious archive on a system running a vulnerable version of the library can overwrite configuration files, SSH keys, cron entries, or shell initialization scripts. On systems where the extraction process runs with elevated privileges, arbitrary file write translates directly into code execution.

Root Cause

The root cause is improper limitation of a pathname to a restricted directory [CWE-22]. The Entry::unpack_in_raw code path omits the canonical-path containment check performed by the safer unpack_in API. Symlink validation is also non-transitive, evaluating link targets individually rather than resolving the full chain against the destination boundary.

Attack Vector

Exploitation requires an application built on astral-tokio-tar to extract an attacker-controlled tar archive. The attack vector is local because the attacker must deliver the archive to a system invoking the vulnerable API. Typical delivery channels include package downloads, build artifacts, and user-supplied archive uploads. No authentication or user interaction with the library itself is required once the archive is processed.

The vulnerability is described in prose only. See the GitHub Security Advisory GHSA-3wgq-wrwc-vqmv and the upstream fix commit for the authoritative technical details.

Detection Methods for CVE-2025-59825

Indicators of Compromise

  • Files written outside the expected extraction directory shortly after archive processing by a Rust application
  • Unexpected modifications to sensitive paths such as ~/.ssh/authorized_keys, /etc/cron.d/, or shell profile files following tar extraction activity
  • Presence of symbolic links in archives whose combined resolution escapes the destination directory

Detection Strategies

  • Audit dependency manifests (Cargo.toml, Cargo.lock) for astral-tokio-tar versions <= 0.5.3
  • Instrument archive-handling code paths to log every file write with its resolved absolute path and compare against the intended extraction root
  • Perform supply-chain scans on build pipelines that use the Astral uv toolchain, which previously depended on vulnerable versions

Monitoring Recommendations

  • Monitor filesystem telemetry for writes originating from processes that invoke tar extraction routines but target paths outside sanctioned directories
  • Alert on creation of symlinks during archive extraction, particularly when target resolution crosses mount or user-home boundaries
  • Correlate process execution events for build tools and package managers with downstream modifications to privileged file paths

How to Mitigate CVE-2025-59825

Immediate Actions Required

  • Upgrade astral-tokio-tar to version 0.5.4 or later across all Rust projects and rebuild dependent binaries
  • Update downstream tools that embed the library, including Astral uv, to releases that pin the patched version
  • Review historical extractions of untrusted archives for evidence of files written outside intended directories

Patch Information

The fix is included in astral-tokio-tar version 0.5.4. The upstream commit 036fdecc85c52458ace92dc9e02e9cef90684e75 adds proper destination containment checks for Entry::unpack_in_raw and makes allow_external_symlinks enforcement transitive across symlink chains. See the GitHub commit notification and the related uv issue #12163 for context.

Workarounds

  • No functional workaround exists other than upgrading to 0.5.4
  • As a temporary compensating control, extract untrusted archives inside sandboxes such as containers or chroot environments with no sensitive files on writable paths
  • Avoid processing tar archives from untrusted sources until patched versions are deployed
bash
# Update Cargo manifest to the patched version
cargo update -p astral-tokio-tar --precise 0.5.4
cargo tree -i astral-tokio-tar

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.