{"vuln_id":"GHSA-8hxf-qr8p-62x4","aliases":["CVE-2026-115906"],"description":"zip: AES Entry HMAC Authentication Bypass on Premature EOF","published_at":"2026-10-22T12:00:00Z","modified_at":"2026-11-17T10:26:09.858808Z","first_seen_at":"2026-11-21T19:15:56.743673Z","severity":"medium","severity_source":"native","cvss_score":6.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","cwe":["CWE-1284","CWE-354"],"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-8hxf-qr8p-62x4"},"matched_alias":null,"items":[{"id":11053,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-8hxf-qr8p-62x4: zip: AES Entry HMAC Authentication Bypass on Premature EOF","summary":"zip: AES Entry HMAC Authentication Bypass on Premature EOF\n\n### Summary\n\nAn AES-encrypted (AE-x) entry's authentication code is verified only when the reader's byte counter lands exactly on zero. If the bounded entry reader reaches the archive's actual EOF before the attacker-controlled, header-declared `compressed_size`, the counter remains positive, the HMAC is never read or compared, and the truncated, unauthenticated plaintext is returned as a clean end of stream. A zero-payload entry also returns before authentication. An attacker who does not know the password can modify an archive so chosen or modified plaintext is accepted with no error.\n\n### Details\n\n[`src/aes.rs:246-292`](https://github.com/zip-rs/zip2/blob/6f09b3064ec87c3a69ea9f3413f9f9638b4aa446/src/aes.rs#L246-L292):\n\n```rust\nfn read(&mut self, buf: &mut [u8]) -> io::Result\n{\nif self.data_remaining == 0 { // @audit insufficient check\nreturn Ok(0);\n}\n\n// get the number of bytes to read, compare as u64 to make sure we can read more than\n// 2^32 bytes even on 32 bit systems.\nlet bytes_to_read = self.data_remaining.min(buf.len() as u64) as usize;\nlet read = self.reader.read(&mut buf[0..bytes_to_read])?;\nself.data_remaining -= read as u64;\n\n// Update the hmac with the encrypted data\nself.hmac.update(&buf[0..read]);\n\n// decrypt the data\nself.cipher.crypt_in_place(&mut buf[0..read]);\n\n// if there is no data left to read, check the integrity of the data\nif self.data_remaining == 0 {\ndebug_assert!(\n!self.finalized,\n\"Tried to use an already finalized HMAC. This is a bug!\"\n);\nif self.finalized {\nreturn Err(Error::new(\nErrorKind::InvalidData,\n\"Tried to use an already finalized HMAC\",\n));\n}\nself.finalized = true;\n\n// Zip uses HMAC-Sha1-80, which only uses the first half of the hash\n// see https://www.winzip.com/win/en/aes_info.html#auth-faq\nlet mut read_auth_code = [0; AUTH_CODE_LENGTH];\nself.reader.read_exact(&mut read_auth_code)?;\nlet computed_auth_code = &self.hmac.finalize_reset().into_bytes()[0..AUTH_CODE_LENGTH];\n\n// use constant time comparison to mitigate timing attacks\nif !constant_time_eq(computed_auth_code, &read_auth_code) {\nreturn Err(Error::new(\nErrorKind::InvalidData,\n\"Invalid authentication code, this could be due to an invalid password or errors in the data\",\n));\n}\n}\n\nOk(read)\n}\n```\n\n`data_remaining` starts at `compressed_size - (2 + 10 + salt_length)` ([`src/aes.rs:144-145`](https://github.com/zip-rs/zip2/blob/6f09b3064ec87c3a69ea9f3413f9f9638b4aa446/src/aes.rs#L144-L145)), where `compressed_size` comes straight from the attacker-controlled central directory. Nothing cross-checks the declared data span against the archive's structural boundaries: `ZipFileData::find_content()` is just `reader.take(self.compressed_size)` ([`src/ty\n\nAffected: crates.io:zip\n\nFixed in: 9.0.0\n\nReferences:\nhttps://github.com/zip-rs/zip2/security/advisories/GHSA-8hxf-qr8p-62x4\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-115906\nhttps://github.com/zip-rs/zip2/commit/ec265db0b0602f8ffb9479327397bddefb7e2216\nhttps://github.com/zip-rs/zip2\nhttps://github.com/zip-rs/zip2/releases/tag/v9.0.0","url":"https://osv.dev/vulnerability/GHSA-8hxf-qr8p-62x4","published_at":"2026-10-29T16:40:07Z","updated_at":"2026-11-17T10:26:09.858808Z","fetched_at":"2026-11-21T19:15:55.946396Z","severity":"medium","cvss_score":6.5,"epss":0.00198,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"zip","vuln_id":"CVE-2026-115906","vuln_ids":["CVE-2026-115906","GHSA-8HXF-QR8P-62X4","RUSTSEC-2026-0545"],"tags":["osv","crates.io","fix-available"],"cluster_id":10784,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/11053","html":"https://vulnwatch.ve1ve2.com/item/11053"}},{"id":11065,"source":{"id":"osv","name":"OSV.dev"},"title":"RUSTSEC-2026-0545: AES entries returned without checking their authentication code when the data ends early or is empty","summary":"AES entries returned without checking their authentication code when the data ends early or is empty\n\nFor WinZip AES (AE-1 and AE-2) entries, the 10-byte HMAC authentication code was read and checked only after the reader had consumed exactly the entry's declared compressed size. If the archive ended before that size was reached, the read returned end-of-stream and the truncated plaintext was accepted without the check. The authentication code of an entry with no encrypted data was never checked.\n\nAES-CTR ciphertext can be changed bit by bit without the password, and AE-2 entries carry no CRC-32, so an attacker who can modify an archive can alter the decrypted contents of such an entry without any error being reported.\n\nThis affects reading AES-encrypted entries with a password (for example `ZipArchive::by_name_decrypt`) with the `aes-crypto` feature.\n\nThe fix returns an error when the data ends before the declared size, and checks the authentication code of empty entries.\n\nAffected: crates.io:zip\n\nFixed in: 9.0.0\n\nReferences:\nhttps://crates.io/crates/zip\nhttps://rustsec.org/advisories/RUSTSEC-2026-0545.html\nhttps://github.com/zip-rs/zip2/commit/ec265db0b0602f8ffb9479327397bddefb7e2216","url":"https://osv.dev/vulnerability/RUSTSEC-2026-0545","published_at":"2026-10-22T12:00:00Z","updated_at":"2026-11-17T10:15:02.908131Z","fetched_at":"2026-11-21T19:15:55.946405Z","severity":"medium","cvss_score":6.5,"epss":0.00198,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"zip","vuln_id":"CVE-2026-115906","vuln_ids":["CVE-2026-115906","GHSA-8HXF-QR8P-62X4","RUSTSEC-2026-0545"],"tags":["osv","crates.io","fix-available"],"cluster_id":10785,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/11065","html":"https://vulnwatch.ve1ve2.com/item/11065"}}]}