REDHAT-BUG-2539017: Medium severity npm/adm-zip vulnerability
adm-zip is a JavaScript library for creating and extracting ZIP archives in Node.js. Prior to 0.6.1, getData() in zipEntry.js trusts an entry's central-directory uncompressed size and allocates output memory before validating that value against the actual compressed data and decompression result. A small crafted ZIP can declare a multi-gigabyte uncompressed size, causing Buffer.alloc and decompression handling to commit excessive resident memory before CRC validation reports an error. Applications that read entries from untrusted archives can therefore be terminated by the operating system or suffer service-wide memory exhaustion. This issue is fixed in version 0.6.1.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
adm-zipto a version that resolves this vulnerability.Fixed in 0.6.1
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications using affected adm-zip versions that call getData() on entries from untrusted ZIP archives are exposed. A crafted archive can cause excessive memory consumption, potentially terminating the process or exhausting memory across the service.
What does an attacker need to exploit it?
An attacker needs to supply a crafted ZIP archive that declares a very large uncompressed size in its central directory. The archive itself can be small, while triggering multi-gigabyte memory allocation during extraction.
Are archives rejected by CRC validation safe from impact?
No. Memory can be committed during allocation and decompression handling before CRC validation reports the archive as invalid, so a later validation failure does not prevent the denial-of-service condition.
What version fixes the issue?
The issue is fixed in adm-zip version 0.6.1.