High impactSecurityPatch available

node-tar PAX flaws: the only fix is the breaking 8.0.0 release

node-tar's newline-injection and PAX size-smuggling flaws are fixed only in 8.0.0, a breaking major release, so remediation is a migration rather than a routine patch bump.

Khalid Aboubakr Engineering DeskPublished

Automated engineering analysis by the Khalid Aboubakr Engineering Desk, from the primary sources listed below. Not reviewed by a person before publication. About the desk

Bottom line

Both advisories are fixed in node-tar 8.0.0, and the evidence names no patched 7.x release. 8.0.0 drops Node below 22 and replaces the callback and stream API, so code that calls tar directly on untrusted archives needs a planned migration. The npm install code-execution chain is stated to need Windows plus strip:1; POSIX npm installs are stated as unaffected by that chain.

What happened

Two node-tar (tar on npm) advisories were published on 28 November 2026 in the isaacs/node-tar repository. Both are fixed only in version 8.0.0, released the same day.

  • GHSA-mpg7-vg3p-wc3m / CVE-2026-140238 (GitHub severity high, CVSS v4 7.2). node-tar splits PAX extended-header records on newlines instead of framing them by their declared length. A newline inside a value can therefore forge records such as path, linkpath, size or uid. The advisory states that all versions up to and including 7.5.22 are affected; the registry range is < 8.0.0.
  • GHSA-p96f-8xj2-g85p / CVE-2026-140237 (moderate, CVSS v4 6.9, CWE-436). ReadEntry reapplies a pending PAX size to a following PAX header. This makes node-tar treat a block inside a metadata body as a real entry, which can create or truncate a file inside the extraction directory. Affected versions are >= 7.0.0, < 8.0.0. It is a residual path around the fix shipped in 7.5.16 for GHSA-vmf3-w455-68vh (CVE-2026-53655).

On the same smuggling archive, the other tools behave differently from node-tar:

  • GNU tar lists no members.
  • libarchive/bsdtar rejects the archive as damaged.
  • Python tarfile rejects it as not a tar archive.

The 8.0.0 release lists both GHSAs among its fixes. It states that "PAX records are read by their length" and that PAX fields are applied once, only to the entry they describe.

NVD shows CVE-2026-140237 as "Deferred". The CISA ADP SSVC entry for it records Exploitation "poc" and Automatable "no".

Two earlier node-tar fixes are relevant context:

  • GHSA-gvwx-54wh-qm9j (CVE-2026-59875), a NUL-byte-in-PAX crash, was fixed in 7.5.17.
  • GHSA-8x88-c5mf-7j5w (CVE-2026-59874), a tar.replace() infinite loop, was fixed in 7.5.18.

Why it matters

The newline-injection advisory separates two impact paths.

  • Direct node-tar use without strip, on POSIX and Windows. Extracted files can land at paths the archive structure did not declare. This includes escaping an intended prefix or subdirectory and overwriting files under the extraction target.
  • npm install on Windows. npm's strip: 1, combined with Windows path normalisation, lets a crafted package overwrite its own package.json and run an injected postinstall script. The CVE text states that POSIX npm processing with strip:1 is not affected by that chain.

The advisory also notes a creation-side problem. node-tar writes newline-containing filenames into PAX records verbatim. An archive that node-tar creates from a directory containing an attacker-planted filename can therefore carry forged records. This matters for CI artefact pipelines, repack services and publishing flows, where the attacker only needs to commit a filename.

The smuggling advisory is narrower. The demonstrated archive does not escape the extraction directory and does not give code execution on its own. Its value to an attacker is in pipelines that inspect with one parser and extract with node-tar. Because GNU tar, bsdtar and Python tarfile all handle the archive differently, member allowlists, malware scanners or policy checks built on them can be bypassed.

The headline phrase "npm postinstall RCE" overstates the reach for most teams: it is Windows-only and specific to npm's strip:1 path. The part that is easier to underrate is the fix itself. It ships only in a major release with a new API.

Engineering assessment

Our assessment: this is a high-priority remediation for a specific set of systems, but it is not an emergency for every Node project. The difficulty lies in the upgrade, not in understanding the bug.

Who carries real exposure. Any service that extracts untrusted or partially untrusted tarballs by calling node-tar directly is exposed, whatever the platform. Typical examples are upload handlers, artefact processors, plugin or theme installers, backup restore and build runners. Pipelines that scan or allowlist with GNU tar, bsdtar or Python tarfile and then extract with node-tar carry the smuggling risk on top. That is the pattern the 7.5.16 fix was meant to close, and these advisories show it still was not closed on 7.x.

Teams that run npm install on Linux or macOS and never call tar themselves are, on the stated facts, outside the code-execution chain. Windows developer machines and Windows CI runners that install third-party packages are inside it. The evidence does not say which tar version a given npm CLI bundles.

Why this is a migration, not a bump. The release notes for 8.0.0 list several breaking changes:

  • Node below 22 is no longer supported.
  • Callbacks and Node.js streams are removed. Commands return promises, and ReadEntry has a Response-like shape.
  • The sync option is replaced by *Sync functions.
  • Subpath exports such as tar/extract are removed.
  • onReadEntry becomes the awaited onEntry.
  • Strict mode stops at the first error.
  • strip now skips entries left with no path.
  • Invalid uid/gid values throw TypeError.
  • Buffer gives way to Uint8Array.

The quietest behaviour change is the most dangerous operationally. The first null block now ends the archive, and anything after it is "dropped with no warning". Systems that concatenate archives will lose data silently unless they split the archives first.

For teams still on Node 18 or 20, the real dependency is a runtime upgrade.

Transitive dependencies are the hard part. Most projects pull tar in through another package written against the 7.x API. Forcing 8.0.0 underneath such a package via overrides is likely to break it, given the API removals. Those teams depend on upstream maintainers moving to 8.x, and the evidence does not show any of them doing so yet.

What this changes in earlier advice. "Upgrade to the latest 7.5.x" is no longer a complete answer for untrusted input. It still matters for the earlier crash and loop fixes (7.5.17 and 7.5.18), but it does not address these two issues. The broader lesson stands: never validate an archive with one parser and extract it with another. Where both steps are needed, inspect what was actually written to disk.

Is this you?

  • npm ls tar shows a direct dependency on tar below 8.0.0, and your code extracts archives that users, partners, CI jobs or third-party registries can influence.
  • You extract with node-tar without strip (POSIX or Windows); this matches the path-overwrite case.
  • Any tar 7.x (7.0.0 to 7.5.22) is in your tree and you list or scan archives with GNU tar, bsdtar or Python tarfile before extracting with node-tar; this matches the smuggling case.
  • You build archives with node-tar from directory trees that contain externally contributed filenames.
  • You run npm install of third-party packages on Windows workstations or Windows CI runners.
  • You run Node below 22; you cannot take 8.0.0 without a runtime upgrade.
  • You concatenate tar archives end to end; 8.0.0 will silently drop everything after the first archive.

What to do

  1. Inventory today. Run node -v, npm ls tar and npm explain tar to separate direct from transitive use. In Python-based inspection services, list where tarfile validates archives that a Node service later extracts.
  2. Upgrade direct, untrusted-input callers to tar 8.0.0 first. This is the only fixed version named for CVE-2026-140238 and CVE-2026-140237. Upgrade the runtime to Node 22 or later beforehand if needed.
  3. Test the migration explicitly:
    • Callback and stream call sites, including piping into Parser/Unpack.
    • Deep imports from removed subpaths.
    • sync: true usages.
    • onReadEntry handlers, now awaited.
    • strip behaviour on directory entries.
    • Error handling under strict mode.
    • Any input that concatenates archives. The release notes say to split such files into separate archives before reading them.
  4. For transitive-only exposure, track the upstream packages for 8.x support, and make sure at least 7.5.18 is resolved so the earlier crash and loop fixes are in place. Not vendor guidance: avoid forcing 8.0.0 under a 7.x-API consumer via overrides without testing it, as the API removals make breakage likely.
  5. Windows npm users: watch npm CLI releases for a bundled tar of 8.0.0 or later; the evidence does not say when that will ship. Not vendor guidance: on Windows CI runners that install untrusted packages, consider --ignore-scripts where the build tolerates it, since the stated chain ends in a postinstall script.
  6. Interim hardening where 8.0.0 cannot land yet. Not vendor guidance:
    • Extract untrusted archives into a fresh, empty, low-privilege directory.
    • Run policy and malware checks on the extracted tree rather than on an archive listing from a different parser.
    • Reject archives your inspection tool flags as damaged or not tar, instead of passing them on.

What we don't know yet

  • Whether any 7.x backport will ship. The evidence names only 8.0.0 as fixed. OSV lists two fix commits, and the evidence does not show either one in a 7.x release.
  • Which tar version each npm CLI release bundles, and when npm will move to 8.0.0 or later.
  • Exploitation status. No KEV entry or vendor statement appears in the evidence; the CISA ADP record notes only a proof of concept. NVD analysis is deferred.
  • The severity and applicability of the many other GHSAs listed in the 8.0.0 release notes.
  • How much real-world code breaks on the 8.0.0 API changes, since only the release notes are available so far.

The desk will check for npm CLI releases bundling tar 8.x, any 7.x security release, and NVD analysis of both CVEs.

Sources

Latest engineering analysis