
Cloud Vulnerability DB
A community-led vulnerabilities database
When reading an AES-encrypted entry using ZipFileReader::read_exact, the authentication code (HMAC-SHA1-80) at the end of the encrypted stream is never verified. An attacker capable of modifying the encrypted archive can tamper with the ciphertext without causing an authentication error when the consumer reads data with read_exact.
In src/read/readers.rs, methods read, read_to_end, and read_to_string on ZipFileReader invoke self.finish_aes()? upon reaching EOF to consume trailing ciphertext and authenticate the HMAC code (implemented to address GHSA-c9rm-qm35-rhqf):
// src/read/readers.rs:192-198
ZipFileReader::CompressedAes(r) => {
let n = r.read(buf)?;
if n == 0 && !buf.is_empty() {
self.finish_aes()?;
}
Ok(n)
}However, read_exact directly delegates to the underlying decompressor without invoking finish_aes():
// src/read/readers.rs:230-238
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
match self {
ZipFileReader::NoReader => invalid_state!(),
ZipFileReader::Raw(r) => r.read_exact(buf),
ZipFileReader::Stored(r) => r.read_exact(buf),
ZipFileReader::Compressed(r) => r.read_exact(buf),
ZipFileReader::CompressedAes(r) => r.read_exact(buf), // <--- Bug: finish_aes() never called!
}
}When a caller allocates a buffer sized to entry.size() (uncompressed size) and calls reader.read_exact(&mut buf), the method returns Ok(()) successfully. The trailing HMAC-SHA1 authentication code is never read or verified.
In AE-2 mode, standard ZIP CRC-32 verification is omitted (set to 0); thus, bypassing the HMAC verification leaves the stream with zero integrity checks, allowing silent bit-flipping / ciphertext tampering attacks.
ZipArchive, resolve the file via by_name_decrypt(..., password).reader.read_exact(&mut buffer).read_exact succeeds with Ok(()), returning tampered plaintext without checking the auth code.read_exact should return an InvalidData error indicating HMAC authentication failure.Integrity bypass / Tampering. Consumers using read_exact to read predictable-length secrets or configurations from AES-encrypted archives will process untrusted or maliciously manipulated data without detection.
Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."