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.
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.
Exploitation Demonstration:
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.
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.
https://www.securityweek.com/tarmageddon-flaw-in-popular-rust-library-leads-to-rce/