- Severity: HIGH
- CVE: CVE-2026-140229
- Ecosystems: npm
- Packages: tar
### Summary
The `maxDecompressionRatio` guard `tar` added for GHSA-23hp-3jrh-7fpw is evaluated *after* node zlib has already materialized the inflated output, so it observes an allocation rather than bounding one. A remote, unauthenticated party who can hand `tar.t()`/`tar.x()` an archive can deny service with 65,608 bytes, at stock settings.
### Details
The check runs from the decompressor’s `’data’` event, which fires once per call to node zlib’s *synchronous* `_processChunk` — by then that input chunk’s entire inflated output is resident:
“`ts
// src/parse.ts:550-555
this[UNZIP].on(‘data’, chunk => {
if (this[CHECKDECOMPRESSIONRATIO](chunk)) {
this[CONSUMECHUNK](chunk)
}
})
“`
Compressed bytes are credited per `write()`, so the guard’s resolution is the *caller’s write size*, not the codec’s output: a single large write front-loads the whole `inputSize × 1000` budget before the ratio is evaluated even once, and `tar`’s own file-reading helpers write up to 16 MB at a time. The decompressors are built with no `maxOutputLength`, so nothing else caps that chunk.
The single ratio constant of 1000 was calibrated to DEFLATE’s ~1032:1 ceiling. zstd reaches ~32,700:1 and brotli ~1,230,000:1, so on those codecs the expansion completes inside one chunk whatever the write size. zstd requires no caller opt-in — it is auto-sniffed by 4-byte magic whenever `this.zstd !== false`, the default.
A third path needs no decompression. Both parse loops stop at the tar EOF marker; the…
Source: GitHub Security Advisories · 2026-12-05