CVE-2025-29787: zip Incorrectly Canonicalizes Paths during Archive Extraction Leading to Arbitrary File Write
Summary In the archive extraction routine of affected versions of the zip crate, symbolic links earlier in the archive are allowed to be used for later files in the archive without validation of the final canonicalized path, allowing maliciously crafted archives to overwrite arbitrary files in the file system when extracted.
Published Mar 17, 2025 · Updated Mar 19, 2025
Affected packages
zip
- Ecosystem
- Rust (crates.io)
- Affected
- >= 1.3.0, < 2.3.0
- Fixed in
- 2.3.0
- Check
cargo tree -i zip
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
In the archive extraction routine of affected versions of the zip crate, symbolic links earlier in the archive are allowed to be used for later files in the archive without validation of the final canonicalized path, allowing maliciously crafted archives to overwrite arbitrary files in the file system when extracted.
Details
This is a variant of the zip-slip vulnerability, we can make the extraction logic step outside of the target directory by creating a symlink to the parent directory and then extracting further files through that symlink.
The documentation of the [::zip::read::ZipArchive::extract] method is in my opinion implying this should not happen:
"Paths are sanitized with ZipFile::enclosed_name." ... > [::zip::read::FileOptions::enclosed_name] ... is resistant to path-based exploits ... can’t resolve to a path outside the current directory.
Most archive software either decline to extract symlinks that traverse out of the directory or defer creation of symlinks after all files have been created to prevent unexpected behavior when later entries depend on earlier symbolic link entries.
PoC
https://gist.github.com/eternal-flame-AD/bf71ef4f6828e741eb12ce7fd47b7b85
Impact
Users who extract untrusted archive files using the following high-level API method may be affected and critical files on the system may be overwritten with arbitrary file permissions, which can potentially lead to code execution.
- zip::unstable::stream::ZipStreamReader::extract
- zip::read::ZipArchive::extract
Credited to eternal-flame-AD, Pr0methean.
References
- https://github.com/zip-rs/zip2/security/advisories/GHSA-94vh-gphv-8pm8
- https://nvd.nist.gov/vuln/detail/CVE-2025-29787
- https://github.com/zip-rs/zip2/commit/a2e062f37066c3b12860a32eb1cb44856cfb7afe
- https://gist.github.com/eternal-flame-AD/bf71ef4f6828e741eb12ce7fd47b7b85
- https://github.com/zip-rs/zip2/releases/tag/v2.3.0
- https://github.com/advisories/GHSA-94vh-gphv-8pm8
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Rust (crates.io) vulnerabilities
All Rust (crates.io) entriesCVE-2026-115906
zip: AES Entry HMAC Authentication Bypass on Premature EOF
medium6.5Oct 29, 2026CVE-2026-115907
zip: legacy Shrink/Reduce/Implode decoder: denial of service from attacker-controlled ZIP64 uncompressed size
high7.5Oct 29, 2026CVE-2026-115908
zip: Arbitrary file write outside the extraction directory, because ZipArchive::extract validates symlink targets lexically.
high7.4Oct 29, 2026CVE-2026-115909
zip: Unbounded Symlink-Target Handling Can Abort Or Exhaust Memory During Extraction
high7.5Oct 29, 2026CVE-2026-115905
zip: Critical Parser Differential & Security Control Bypass via Dual-Header Inconsistencies (Zip Cloaking) Leading to Arbitrary File Overwrite & RCE
critical9.4Oct 28, 2026
