GHSA-rcw4-f5rp-g42v: High severity npm/adm-zip vulnerability

Published Sep 29, 2026
·
Updated

Affected package: adm-zip (npm) Affected version: 0.6.0

Summary

The fix shipped for CVE-2026-39244 (methods/inflater.js) caps zlib's decompression output via maxOutputLength: expectedLength, where expectedLength is read directly from the ZIP entry's attacker-controlled "uncompressed size" header field (CENLEN/LOCLEN). This cap is only applied when expectedLength > 0:

js const option = version >= 15 && expectedLength > 0 ? { maxOutputLength: expectedLength } : {}; return zlib.inflateRawSync(inbuf, option);

If an attacker sets the declared uncompressed-size field to exactly 0, this condition is false, option becomes {}, and no output cap is passed to zlib at all. Node then falls back to zlib's own internal default limit (several GB), so a small, highly-compressible payload can still be decompressed to a very large size in memory -- the same class of resource-exhaustion issue the original CVE addressed, just triggered differently.

Steps to Reproduce

1. Build a ZIP archive containing one DEFLATE-compressed entry whose real content is highly redundant (e.g. several MB of a repeated byte, achieving close to the ~1032:1 theoretical raw-DEFLATE compression ratio). 2. Patch the entry's declared uncompressed-size fields (both the local file header copy and the central directory copy, 4-byte little-endian values) to 0. The compressed bytes and CRC32 are left untouched -- CRC validation still passes because CRC is computed over the real decompressed output, not the declared size. 3. Load the archive with new AdmZip(buffer) and call .getEntries()[0].getData() (or readFile/readAsText/extractAllTo/etc. -- all share the same code path). 4. Observe: decompression succeeds and returns the full-size buffer with no size restriction applied, whereas the same real data with an honest (but undersized) declared value correctly throws Cannot create a Buffer larger than N bytes.

Proof of Concept

Attached script demonstrates a controlled A/B comparison using the identical real payload in both cases -- only the declared-size header field differs:

- Control (declared size = 1024 bytes, deliberately smaller than the true 4MB output): correctly throws, proving the cap mechanism works when expectedLength > 0. - Bypass (declared size = 0, identical real payload): succeeds and returns the full 4,194,304-byte buffer with zero restriction.

Verified reproducible across 3 independent runs.

Impact

Any application that calls adm-zip's read/extract methods on an untrusted ZIP file (upload handlers, CI artifact extraction, email attachment scanning, etc.) can be made to allocate an amount of memory bounded only by zlib's own internal default rather than any limit the application or adm-zip intends -- a small (tens-of-MB) upload can trigger multi-GB memory consumption, risking process crash/OOM.

Suggested Fix

Apply maxOutputLength unconditionally (e.g. defaulting to a sane absolute ceiling, or always passing the declared size regardless of whether it's 0), and/or add an independent compression-ratio check that doesn't rely solely on the attacker-supplied size field.

Affected Software

1 affected componentFixes available
npm/adm-zip<=0.6.0
0.6.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/adm-zip to a version that resolves this vulnerability.

    Fixed in 0.6.1
  2. Configuration

    Apply the zlib maxOutputLength cap unconditionally instead of only when expectedLength > 0; use a sane absolute ceiling when the attacker-controlled declared size is zero.

    adm-zip methods/inflater.js maxOutputLength = always enabled

Event History

Sep 29, 2026
Advisory Published
via GitHub·06:25 PM
Data Sourced
via GitHub·06:25 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are realistically exposed?

Deployments using adm-zip 0.6.0 to decompress ZIP archives from untrusted sources are exposed when an archive contains a DEFLATE-compressed entry with its declared uncompressed-size field set to zero. Processing such an entry can consume very large amounts of memory.

2

What does an attacker need to exploit this?

An attacker needs to supply a crafted ZIP archive for the application to process. The archive must use a highly compressible DEFLATE payload and set the entry's CENLEN or LOCLEN uncompressed-size header value to exactly 0.

3

How can I identify suspicious archives before processing them?

Inspect DEFLATE-compressed ZIP entries for an uncompressed-size value of zero in the central-directory or local-file header, particularly when the compressed data is unexpectedly small. That combination can bypass the output cap and expand to a very large amount of data in memory.

4

Is the affected behavior limited to a non-default configuration?

No special configuration is described as necessary. When the declared size is zero, adm-zip 0.6.0 does not pass a maxOutputLength option to zlib, causing Node to use zlib's internal default limit instead.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203