node-tar: Incomplete NUL-byte truncation in ustar, GNU, and PAX names causes name differentials and async crashes
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
Names are cut at the first NUL with .replace(/\0.*/, ''). Without the s flag, . doesn't match \n, \r, U+2028 or U+2029. If one of these follows the NUL, only part of the name is removed, and the NUL remains. The GHSA-gvwx-54wh-qm9j fix (7.5.17, commit 7a635c2) added this regex for PAX values on the assumption that PAX lines can't contain line terminators. The same regex is also used for ustar names and for GNU long-name/long-link data.
Details
| # | Location | Default options |
|---|---|---|
| VULN-006 | src/header.ts:358 (ustar names); src/parse.ts:390 (GNU L), :397 (GNU K, same regex, not tested separately) | Yes (crash in async x); strip for the differential |
| VULN-021 | src/pax.ts:179 (the GHSA-gvwx fix site): CR, U+2028 and U+2029 still end the match | Yes (crash); strip for the differential |
Proof of concept
exploit_tests/test_vuln_006_* and _021_. Each runs a control and an attack against the unmodified 7.5.22 build, with output recorded in exploit_tests/evidence/. All were run on macOS.
Impact
In async extraction, a name that still contains a NUL reaches fs and throws, which crashes a process that doesn't catch it (the outcome GHSA-gvwx-54wh-qm9j addressed). With strip, the surviving characters make node-tar's view of the name differ from other tools'.
Is GHSA-wpwg-r92p-fjjh 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-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
- HighCVE-2026-140240node-tar: A small archive exhausts memory or CPU through path-reservation bookkeeping · 2 Dec 2026
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.