github-actions[bot] opened issue #15338:
ZipStreamReaderextracts entries under local-header names that can differ from the central directory
Details Package zipVersion 0.6.6URL https://github.com/zip-rs/zip2/commit/8068ab480ccf8daa7411424e365fcdbe6d09443e Date 2026-10-17 Patched versions >=9.0.5A 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.
ZipArchivelists and opens entries by their central-directory names.ZipStreamReader::visitandZipStreamReader::extract, likeread_zipfile_from_stream, read the local headers in order and use the local-header names without comparing them with the central directory.An archive can therefore show one set of file names to code that inspects it with
ZipArchiveand write files under other names when it is extracted withZipStreamReader. 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.The 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)andZipArchive::validate_header_consistency()do the same forZipArchive. The check is off by default, so upgrading alone does not change whatZipStreamReader::new(...)extracts: applications that extract untrusted archives withZipStreamReaderneed to turn it on.See advisory page for additional details.
pchickey commented on issue #15338:
Needs https://github.com/bytecodealliance/wasmtime/issues/14937 resolved in order to close
Last updated: Nov 19 2026 at 20:05 UTC