RustSec logo

History ⋅ Edit ⋅ JSON (OSV)

RUSTSEC-2026-0547

Legacy Shrink, Reduce and Implode decoders preallocate the declared uncompressed size

Reported
Issued
Package
zip (crates.io)
Type
Vulnerability
Categories
Keywords
#panic #allocation #legacy-zip
Aliases
References
CVSS Score
7.5 HIGH
CVSS Details
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality Impact
None
Integrity Impact
None
Availability Impact
High
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Patched
  • >=9.0.0
Unaffected
  • <5.1.0

Description

With 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.

An attacker who can supply an archive can stop a process that reads it, for example through ZipArchive::extract.

Only builds with the legacy-zip feature are affected; it is not enabled by default.

The fix caps the preallocation at 1 MiB, and such an entry now returns an error.

Advisory available under CC0-1.0 license.