node-tar: Decompression within the ratio limit is buffered in memory without backpressure, and zero-size entries queue without bound
Published 2 Dec 2026 · Updated 2 Dec 2026
Affected package
- Affected
- <8.0.0
- Fixed in
- 8.0.0
npm install tar@8.0.0Which tar does your project really install?
Works for private projects: the file is read in memory to run the scan and then dropped. Also reads yarn.lock, pnpm-lock.yaml or package.json.
Public repo?
Look after several JavaScript apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Details
Summary
The GHSA-23hp-3jrh-7fp fix (7.5.19, commit 2812e93) aborts when the total decompressed size exceeds maxDecompressionRatio times the compressed size. That limits total work, not how much is held in memory at once. When reading from a file, each read chunk is inflated synchronously and its output is buffered in a paused ReadEntry, so memory use isn't bounded while staying under the ratio. In the same write, zero-size entries are queued without any limit.
Details
| # | Location | Default options |
|---|---|---|
| VULN-008 | src/parse.ts:576-577, 551-555, 343 → src/read-entry.ts:131 | Yes (x({file}), t({file})) |
| VULN-011 | src/parse.ts:268-273 (same root cause) | Yes |
Proof of concept
exploit_tests/test_vuln_008_* and _011_ measure memory for a control archive and an attack archive against the unmodified 7.5.22 build. Output is in exploit_tests/evidence/. The tests were run on macOS.
Impact
A service that extracts or lists untrusted compressed archives can be made to use much more memory than the archive size suggests, without hitting the ratio limit.
Suggested fix
Queue compressed input and inflate in small slices only while consumers aren't paused, and stop accepting zero-size entries while the queue is non-empty. One patch covering both was validated on a copy of the source (fixes/VULN-008.diff).
Versions: tested on 7.5.22 (main @ 2a22bfc). 7.5.23 changes only the publishing workflow (no src/ changes), so it is affected too.
Reproduction bundle
A bundle with the tests, recorded evidence and proposed fix diffs for this report is ready. This form takes no attachments, so I'll add it to the temporary private fork, or send it however you prefer.
Is GHSA-9hmx-4f52-v64x in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected tar, and gives you the command that fixes it.
More advisories for tar
- HighCVE-2026-140230node-tar PathReservations.getDirs() quadratic memory amplification via unbounded symlink linkpath depth — uncatchable OOM process kill · 2 Dec 2026
- HighCVE-2026-140234node-tar: Incomplete NUL-byte truncation in ustar, GNU, and PAX names causes name differentials and async crashes · 2 Dec 2026
- HighCVE-2026-140235node-tar parses PAX extended headers by newline-splitting instead of length-delimiting, causing record dropping and forged-field injection · 2 Dec 2026
- HighCVE-2026-140236node-tar: Archive framing differential from PAX size still being applied to GNU/PAX meta entries via ReadEntry and related size/precedence inconsistencies · 2 Dec 2026
- MediumCVE-2026-140237node-tar: ReadEntry pending PAX size reapplication permits metadata-body file smuggling · 2 Dec 2026
- HighCVE-2026-140238node-tar: Newline injection in PAX extended-header records enables entry-attribute forgery (path overwrite → npm postinstall RCE on Windows) · 2 Dec 2026
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.