node-tar: A small archive exhausts memory or CPU through path-reservation bookkeeping
Published 2 Dec 2026 · Updated 2 Dec 2026
Affected package
- Affected
- <8.0.2
- Fixed in
- 8.0.2
npm install tar@8.0.2Which 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-f5x3-32g6-xq36 fix bounded the depth (component count) of entry.path with maxDepth. The path-reservation code still computes every ancestor prefix of each reserved path, and its cost grows with the number of components multiplied by the path length. That bound doesn't apply to linkpath, nor to long components within the depth limit. Reservation state and some caches are also never released for the life of an extraction.
Details
| # | Issue | Location | Default options |
|---|---|---|---|
| VULN-002 | linkpath has no depth or length bound and is reserved for every entry type. getDirs cost is quadratic in its length, so an archive of a few hundred bytes compressed aborts the Node process | src/path-reservations.ts:25-38, via src/unpack.ts:729-734 | Yes (async x/Unpack) |
| VULN-023 | Within maxDepth, very long components make the same getDirs computation exhaust memory (the depth fix bounds count, not length) | src/path-reservations.ts:25-38, via src/unpack.ts:734 | Yes (async) |
| VULN-009 | PathReservations.#reservations entries are never deleted, so ancestor strings for every entry are kept until the Unpack ends | src/path-reservations.ts:64 | Yes (async) |
| VULN-012 | The normalizeUnicode cache is capped by entry count (10k), not bytes, so long names make it large | src/normalize-unicode.ts:5-35 | Yes (async) |
| VULN-024 | filesFilter memoises every path prefix; memory grows with depth × length. The GHSA-r292 fix bounded recursion depth, not the memo | src/list.ts:35-52 | Needs a file list |
Not the same as open PR #470, which fixes a reservation deadlock when a linkpath is a parent of the entry path.
Proof of concept
exploit_tests/test_vuln_002_*, _023_, _009_, _012_ and _024_. Each test runs a control archive and an attack archive against the unmodified 7.5.22 build, with output recorded in exploit_tests/evidence/. All were run on macOS.
Impact
Any service that extracts untrusted archives with the default async API can be made to exhaust memory or CPU, and crash, by a very small upload (VULN-002, VULN-023). The others raise memory use in long-running or large extractions.
Is GHSA-7c32-79xj-j3jp 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-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
- HighCVE-2026-140239node-tar: Global PAX extended header injects attacker-controlled linkpath into tar.Parser entries, bypassing strict-mode validation · 2 Dec 2026
References
- Linkgithub.com/isaacs/node-tar/security/advisories/GHSA-7c32-79xj-j3jp
- Advisorynvd.nist.gov/vuln/detail/CVE-2026-140240
- Linkgithub.com/isaacs/node-tar/commit/73b352e0010d6c99794ea7374800816a46d3bdb2
- Linkgithub.com/isaacs/node-tar/commit/de87900752566867b422de0ebfe6592b30fa9786
- Packagegithub.com/isaacs/node-tar
- Linkgithub.com/isaacs/node-tar/releases/tag/v8.0.2
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.