VulnWatch by ve1ve2
critical 10.0 EPSS 0.59%

GHSA-m665-v7pm-7grj: zip: Critical Parser Differential & Security Control Bypass via Dual-Header Inconsistencies (Zip Cloaking) Leading to Arbitrary File Overwrite & RCE

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

https://osv.dev/vulnerability/GHSA-m665-v7pm-7grj ↗

osvcrates.iofix-available

zip: Critical Parser Differential & Security Control Bypass via Dual-Header Inconsistencies (Zip Cloaking) Leading to Arbitrary File Overwrite & RCE ## Summary A critical architectural parser differential exists in the `zip` crate (`<= 9.0.4`) between random-access archive readers (`ZipArchive`) and streaming readers (`ZipStreamReader`). `ZipArchive` considers the Central Directory File Header (CDFH) authoritative and ignores the filename declared in the Local File Header (LFH). In contrast, `ZipStreamReader` relies exclusively on the Local File Header (LFH) when extracting files to the filesystem. This discrepancy enables ZIP archives to appear to have different file paths and contents according to which tool is reading them. --- ## Details ### Architectural Root Cause In the PKWARE ZIP archive format, every file entry is defined in two distinct locations: 1. **Local File Header (LFH):** Precedes the compressed payload of each file in the body of the archive. 2. **Central Directory File Header (CDFH):** Stored in a contiguous index at the end of the archive. In `zip2`: - `src/read/zip_archive.rs`: `ZipArchive` parses the central directory into `SharedBuilder.files`. All file lookups by index or name read exclusively from the CDFH table, completely ignoring the filename present in the LFH. - `src/read/stream.rs:L86-L141`: `ZipStreamReader::visit` and `ZipStreamReader::extract` read sequentially from the stream without verifying the central directory index. Each entry is parsed via `read_zipfile_from_stream` and written to disk using the unverified filename declared in the LFH: ```rust // src/read/stream.rs fn visit_file (&mut self, file: &mut ZipFile<'_, R>) -> ZipResult<()> { file.safe_prepare_path(&self.outpath, &mut outpath, None::<&(_, fn(&Path) -> bool)>)?; let mut outfile = fs::File::create(&outpath)?; io::copy(file, &mut outfile)?; Ok(()) } ``` - `src/write.rs:L1552`: The crate explicitly exposes `shallow_copy_file`, an API that constructs dual-header desynchronizations by adding a new CDFH entry with an alias name pointing to an existing file without updating the original LFH. ### Threat Scenario & Severity Justification (10.0 / 9.9 Critical) 1. **Security Control Evasion:** An adversary crafts a ZIP archive where: - Central Directory Header declares: `doc_report.pdf` (Clean document) - Local File Header declares: `cron_worker.sh` (Malicious root backdoor) 2. The archive is uploaded through a web portal or API endpoint protected by security gateways (WAF, Anti-Virus, Content Disarm & Reconstruction). The security gateway inspects the archive using `ZipArchive` (or similar CDFH-first parsers), detects only `doc_report.pdf`, and approves the file. 3. The backend worker or cloud function receives the approved archive and extracts it using `ZipStreamReader::extract`. `ZipStreamReader` reads the LFH and overwrites `cron_worker.sh`. 4. **Full Compromise (CIA = High):** The legitimate production health checker / service script is destroyed (**Availability = High / DoS**), while the attacker's backdoor payload is implanted (**Integrity = H Affected: crates.io:zip Fixed in: 9.0.5 References: https://github.com/zip-rs/zip2/security/advisories/GHSA-m665-v7pm-7grj https://nvd.nist.gov/vuln/detail/CVE-2026-115905 https://github.com/zip-rs/zip2/commit/8068ab480ccf8daa7411424e365fcdbe6d09443e https://github.com/zip-rs/zip2 https://github.com/zip-rs/zip2/releases/tag/v9.0.5

Linked vulnerabilities (2)

CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:L

zip: Critical Parser Differential & Security Control Bypass via Dual-Header Inconsistencies (Zip Cloaking) Leading to Arbitrary File Overwrite & RCE

CWE: CWE-20, CWE-436Aliases: CVE-2026-115905
CVE-2026-115905 critical 10.0 EPSS 0.59% (p49) NVDCVE.orgGHSA
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:L/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: Critical Parser Differential & Security Control Bypass via Dual-Header Inconsistencies (Zip Cloaking) Leading to Arbitrary File Overwrite & RCE

CWE: CWE-20, CWE-436Aliases: GHSA-m665-v7pm-7grjNVD: Awaiting Analysis