VulnWatch by ve1ve2
high 7.4 EPSS 0.58%

GHSA-hjqx-j4rw-g7xv: zip: Arbitrary file write outside the extraction directory, because ZipArchive::extract validates symlink targets lexically.

Source:
OSV.dev
Published:
Fetched:
Updated:
Affects:
zip

https://osv.dev/vulnerability/GHSA-hjqx-j4rw-g7xv ↗

osvcrates.iofix-available

zip: Arbitrary file write outside the extraction directory, because ZipArchive::extract validates symlink targets lexically. ### Summary - **Verified version:** zip `9.0.0-pre3` - **Affected versions:** `7.2.0` and later - **Precondition:** The attacker knows (or can guess) the absolute path of the extraction destination The validation applied to symlinks is purely lexical. As a result, an attacker can write arbitrary files outside the extraction directory through a symlink. Exploitation requires the attacker to know (or guess) the absolute path of the destination, but this is realistic in practice: CI workspaces, `/opt/app`, a fixed Downloads path, and so on. > **Impact extends further on Windows (verified on real hardware for both the separate-drive and UNC-share cases)**: > Because `simplified_components` discards the `Prefix` component, paths like `D:\ ` or a UNC path `\\attacker\share\ ` pass the `starts_with` check. > As a result, `outpath.push` gets replaced onto a different drive/remote share, so **a single symlink is enough — no intermediate symlink chain is required**. > That said, creating a symlink on Windows requires `SeCreateSymbolicLinkPrivilege` (administrator rights or Developer Mode enabled). > **Real-hardware verification (Windows 10 VM (19045.2604), `tests/poc_win.rs`)**: > With the extraction target set to a temporary directory under `C:`, both of the following paths returned `Ok(())` from `extract()` and successfully wrote outside the extraction target. > In both cases `extract()` returned no error (`Ok(())`), and it was confirmed that the contents of `pwned.txt` matched the attacker-specified value. ### Relationship to CVE-2025-29787 This is **not a duplicate** of the existing [CVE-2025-29787](https://github.com/zip-rs/zip2/security/advisories/GHSA-94vh-gphv-8pm8) (2025-03); rather, **the protection introduced for that CVE was subsequently lost**. #### Timeline (git history, UTC) | commit | Date | Description | | ---------- | ---------- | ---------------------------------------------------------------------------------------------------------------- | | `d4539d6b` | 2025-02-28 | Initial fix for CVE-2025-29787. Canonicalizes output paths and symlink targets and verifies they descend from the destination | | `0199ac2c` | 2025-03-15 | **Before the v2.3.0 release**, the above is replaced with a lexical check based on `simplified_components` | | `v2.3.0` | 2025-03-16 | Released as the CVE fix. **What actually shipped is the lexical check** | | `d5cf4b55` | 2026-01-18 | Changes how `simplified_components` handles absolute paths, **from rejecting them to silently stripping them** (released in `v7.2.0`) | #### Why v2.3.0 was not affected, and how the protection was lost The `safe_prepare_path` in v2.3.0 performs essentially the same lexical check as the current code. However, `simplified_components` at that time **rejected any path containing an ab Affected: crates.io:zip Fixed in: 9.0.0 References: https://github.com/zip-rs/zip2/security/advisories/GHSA-hjqx-j4rw-g7xv https://nvd.nist.gov/vuln/detail/CVE-2026-115908 https://github.com/zip-rs/zip2/commit/09c030eab56e8db8fb3c1c33f554407b30bad8fa https://github.com/zip-rs/zip2 https://github.com/zip-rs/zip2/releases/tag/v9.0.0

Linked vulnerabilities (4)

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:H

zip: Arbitrary file write outside the extraction directory, because ZipArchive::extract validates symlink targets lexically.

CWE: CWE-22, CWE-59, CWE-61Aliases: CVE-2026-115908, CVE-2025-29787, GHSA-94vh-gphv-8pm8
CVE-2026-115908 high 7.4 EPSS 0.49% (p43) NVDCVE.orgGHSAGHSA
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:H

zip: Arbitrary file write outside the extraction directory, because ZipArchive::extract validates symlink targets lexically.

CWE: CWE-22, CWE-59, CWE-61Aliases: GHSA-hjqx-j4rw-g7xv, CVE-2025-29787, GHSA-94vh-gphv-8pm8
CVE-2025-29787 high 7.3 EPSS 0.58% (p49) NVDCVE.org
CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:L/VI:H/VA:N/SC:H/SI:H/SA:H/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

`zip` is a zip library for rust which supports reading and writing of simple ZIP files. In the archive extraction routine of affected versions of the `zip` crate starting with version 1.3.0 and prior to version 2.3.0, 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. Users who extract untrusted archive files using the following high-level API method may be affected and critical files on the system...

CWE: CWE-22, CWE-61, CWE-180NVD: Deferred