{"vuln_id":"GHSA-m665-v7pm-7grj","aliases":["CVE-2026-115905"],"description":"zip: Critical Parser Differential & Security Control Bypass via Dual-Header Inconsistencies (Zip Cloaking) Leading to Arbitrary File Overwrite & RCE","published_at":"2026-10-17T12:00:00Z","modified_at":"2026-11-17T10:26:05.424821Z","first_seen_at":"2026-11-21T19:15:56.743676Z","severity":"critical","severity_source":"native","cvss_score":null,"cvss_vector":"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","cwe":["CWE-20","CWE-436"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-m665-v7pm-7grj"},"matched_alias":null,"items":[{"id":11054,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-m665-v7pm-7grj: zip: Critical Parser Differential & Security Control Bypass via Dual-Header Inconsistencies (Zip Cloaking) Leading to Arbitrary File Overwrite & RCE","summary":"zip: Critical Parser Differential & Security Control Bypass via Dual-Header Inconsistencies (Zip Cloaking) Leading to Arbitrary File Overwrite & RCE\n\n## Summary\nA 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.\n\nThis discrepancy enables ZIP archives to appear to have different file paths and contents according to which tool is reading them.\n\n---\n\n## Details\n\n### Architectural Root Cause\nIn the PKWARE ZIP archive format, every file entry is defined in two distinct locations:\n1. **Local File Header (LFH):** Precedes the compressed payload of each file in the body of the archive.\n2. **Central Directory File Header (CDFH):** Stored in a contiguous index at the end of the archive.\n\nIn `zip2`:\n- `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.\n- `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:\n```rust\n// src/read/stream.rs\nfn visit_file\n(&mut self, file: &mut ZipFile<'_, R>) -> ZipResult<()> {\nfile.safe_prepare_path(&self.outpath, &mut outpath, None::<&(_, fn(&Path) -> bool)>)?;\nlet mut outfile = fs::File::create(&outpath)?;\nio::copy(file, &mut outfile)?;\nOk(())\n}\n```\n- `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.\n\n### Threat Scenario & Severity Justification (10.0 / 9.9 Critical)\n1. **Security Control Evasion:** An adversary crafts a ZIP archive where:\n- Central Directory Header declares: `doc_report.pdf` (Clean document)\n- Local File Header declares: `cron_worker.sh` (Malicious root backdoor)\n2. 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.\n3. 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`.\n4. **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\n\nAffected: crates.io:zip\n\nFixed in: 9.0.5\n\nReferences:\nhttps://github.com/zip-rs/zip2/security/advisories/GHSA-m665-v7pm-7grj\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-115905\nhttps://github.com/zip-rs/zip2/commit/8068ab480ccf8daa7411424e365fcdbe6d09443e\nhttps://github.com/zip-rs/zip2\nhttps://github.com/zip-rs/zip2/releases/tag/v9.0.5","url":"https://osv.dev/vulnerability/GHSA-m665-v7pm-7grj","published_at":"2026-10-28T21:09:50Z","updated_at":"2026-11-17T10:26:05.424821Z","fetched_at":"2026-11-21T19:15:55.946397Z","severity":"critical","cvss_score":10.0,"epss":0.00591,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"zip","vuln_id":"CVE-2026-115905","vuln_ids":["CVE-2026-115905","GHSA-M665-V7PM-7GRJ","RUSTSEC-2026-0548"],"tags":["osv","crates.io","fix-available"],"cluster_id":10786,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/11054","html":"https://vulnwatch.ve1ve2.com/item/11054"}},{"id":11062,"source":{"id":"osv","name":"OSV.dev"},"title":"RUSTSEC-2026-0548: `ZipStreamReader` extracts entries under local-header names that can differ from the central directory","summary":"`ZipStreamReader` extracts entries under local-header names that can differ from the central directory\n\nA ZIP archive names each entry twice: in the local file header in front of the entry's data, and in the central directory at the end of the archive. `ZipArchive` lists and opens entries by their central-directory names. `ZipStreamReader::visit` and `ZipStreamReader::extract`, like `read_zipfile_from_stream`, read the local headers in order and use the local-header names without comparing them with the central directory.\n\nAn archive can therefore show one set of file names to code that inspects it with `ZipArchive` and write files under other names when it is extracted with `ZipStreamReader`. If an application checks an archive one way and extracts it the other way, an attacker can get files written or overwritten inside the destination directory that the check never saw.\n\nThe fix adds an opt-in check. `ZipStreamReader::enforce_header_consistency(true)` compares each local header with its central-directory entry (name, sizes, CRC-32, compression method, flags and modification time) and fails extraction on a mismatch; `ZipReadOptions::enforce_header_consistency(true)` and `ZipArchive::validate_header_consistency()` do the same for `ZipArchive`. The check is off by default, so upgrading alone does not change what `ZipStreamReader::new(...)` extracts: applications that extract untrusted archives with `ZipStreamReader` need to turn it on.\n\nAffected: crates.io:zip\n\nFixed in: 9.0.5\n\nReferences:\nhttps://crates.io/crates/zip\nhttps://rustsec.org/advisories/RUSTSEC-2026-0548.html\nhttps://github.com/zip-rs/zip2/commit/8068ab480ccf8daa7411424e365fcdbe6d09443e","url":"https://osv.dev/vulnerability/RUSTSEC-2026-0548","published_at":"2026-10-17T12:00:00Z","updated_at":"2026-11-17T10:15:03.072952Z","fetched_at":"2026-11-21T19:15:55.946403Z","severity":"critical","cvss_score":10.0,"epss":0.00591,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"zip","vuln_id":"CVE-2026-115905","vuln_ids":["CVE-2026-115905","GHSA-M665-V7PM-7GRJ","RUSTSEC-2026-0548"],"tags":["osv","crates.io","fix-available"],"cluster_id":10787,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/11062","html":"https://vulnwatch.ve1ve2.com/item/11062"}}]}