TARmageddon: How a Rust Logic Flaw Opened the Door to Remote Code Execution

The popular Rust async-tar library and its forks, such as tokio-tar, have been found to have a major security flaw known as TARmageddon (CVE-2025-62518). Attackers can smuggle hostile nested archives that can rewrite files during extraction, possibly resulting in remote code execution (RCE). Due to this vulnerability, which arises from uneven processing of PAX and USTAR headers in TAR archives. In order to reduce the high-severity risk and safeguard vital systems from exploitation, users are advised to switch right away to the patched astral-tokio-tar version 0.5.6, as tokio-tar is no longer maintained.

Technical Description

The Rust async-tar library and its forks, including tokio-tar, are vulnerable to the TARmageddon vulnerability (CVE-2025-62518), which arises from incorrect treatment of PAX extended headers and USTAR headers during TAR archive parsing. In particular, the stream position is wrongly advanced by the parser using the USTAR header size, which can be zero, rather than the actual file size of the PAX header. As a result, nested TAR archives’ contents are misinterpreted by the parser as valid outer archive entries. The problem occurs when the parser fails to appropriately skip over nested archive material because the USTAR headers may wrongly suggest zero size, while the PAX headers give accurate file sizes.

Attackers can “smuggle” more archive entries into a TAR file due to this parsing error, which gives them the ability to overwrite files in extraction directories, such as important configuration files or build backends. During archive extraction, arbitrary code can be remotely executed by taking advantage of this file overwrite capabilities. The issue is made worse by the fact that a well-known fork called tokio-tar has turned into abandonware and is without a patch. The actively developed astral-tokio-tar version 0.5.6, which fixes the issue by appropriately handling boundary parsing for PAX and USTAR headers, is recommended for developers using tokio-tar.

CVE CVSS Vulnerability Type Affected Product Patch Version
CVE-2025-62518 8.1 Logic Flaw / Remote Code Execution async-tar, tokio-tar (Rust libraries) astral-tokio-tar 0.5.6

Exploitation Demonstration:

  • An attacker prepares a TAR archive that embeds a nested TAR and intentionally includes mismatched PAX vs USTAR metadata so the parser’s boundary logic will treat the nested headers as additional outer entries.
  • The malicious artifact is delivered where the target will accept and extract archives: e.g., a package repository, uploaded build artifact, or an external content feed consumed by CI/CD or an automated installer.
  • The archive is extracted by a process that uses an unpatched async-tar/tokio-tar variant in a context with permission to write sensitive files (build config, runtime config, or filesystem locations that influence execution).
  • Because of the parser’s PAX/USTAR boundary inconsistency, the nested archive’s headers are interpreted as outer entries, allowing the attacker’s hidden files to overwrite intended files during extraction—this overwrite is the pivot that can enable downstream compromise.
  • Once critical configuration or build backend files are replaced, the attacker can cause malicious code to be executed by normal workflows (e.g., a compromised build backend or altered config leading to execution), and defenders should monitor for these overwrite indicators and validate remediation.

Ease of Exploitation:

The concept of TARmageddon is relatively easier to exploit because of a number of common enabling conditions: the buggy parsing logic affects widely used crates, many CI/CD pipelines and package installers automatically extract archives without strict path or size validation; and attackers can use supply-chain channels (package repositories, artifact uploads) to deliver crafted archives that trigger the parser inconsistency. Collectively, these factors reduce the barrier to successful file-overwrite pivots that can result in RCE, making organizations that perform unattended archive extraction or rely on third-party packages especially vulnerable unless they patch, sandbox extraction, or enforce strict provenance checks.

Conclusion:

Even memory-safe languages can have logic flaws that have major security repercussions, as demonstrated by TARmageddon (CVE 2025 62518). For example, inconsistent PAX/USTAR parsing in async-tar and unmaintained forks might allow hidden archive entries to overwrite important files and result in RCE. As a high-priority supply-chain risk, organizations should immediately inventory usages of async-tar and tokio-tar, switch to patched astral-tokio-tar (≥0.5.6) or other vendor fixes, and implement compensating controls like strict path whitelists, sandboxed, least-privilege extraction, and artifact provenance checks. Enhance detection (file-integrity monitoring, extraction logging) and vendor communication to supplement patching; lastly, use non-destructive tests to confirm remediation and update incident response procedures to enable prompt containment and investigation of any suspect artifacts.

Impact

Attackers can use the TARmageddon vulnerability to smuggle hidden archive entries that can overwrite files during extraction. In practice, this can corrupt or replace important configuration and build artifacts, which can result in supply-chain compromise, remote code execution, CI/CD pipeline hijacking, and the unapproved deployment of malicious code. For organizations that perform unattended archive extraction or use unvetted third-party packages, the consequences can range from a localized compromise of services and loss of data integrity to widespread contagion across dependent projects, regulatory exposure, operational downtime, and substantial remediation and reputational costs.

IOC and Context Details

Topics Details
Tactic Name Initial Access, Execution
Technique Name Archive Extraction Abuse
Malicious File Overwrite
Sub Technique Name TAR Archive Header Manipulation (Nested Archive Smuggling)
Attack Type Vulnerability
Targeted Applications Rust libraries async-tar and unmaintained tokio-tar
Region Impacted Global
Industry Impacted Software Development
Cloud Services
DevOps & DevSecOps
Open-Source Ecosystems
Software Supply Chain
Containerization
IOC’s NA
CVE CVE-2025-62518

Recommended Actions

  • Immediately inventory all projects, CI/CD pipelines, containers, and dependencies for use of async-tar, tokio-tar, or related forks.
  • Migrate or upgrade from vulnerable versions to the patched astral-tokio-tar library version 0.5.6 or later.
  • Restrict archive extraction to isolated, sandboxed environments (containers, VMs) running with least privileges to minimize impact of any file overwrites.
  • Implement strict path validation and whitelisting during archive extraction to prevent unexpected file overwrites outside designated directories.
  • Enforce supply-chain security by verifying package signatures, hashes, and provenance before trusting or extracting archives from external sources.
  • Enable comprehensive logging and monitoring around archive extraction, including file integrity checks and alerts for unusual file modifications.
  • Engage with third-party vendors and partners to confirm they have patched or mitigated this vulnerability within their software or delivery pipelines.
  • Develop and test incident response plans that include detecting, containing, and remediating attacks involving malicious archive extraction.

References

https://www.securityweek.com/tarmageddon-flaw-in-popular-rust-library-leads-to-rce/