High impactSecurityPatch available

node-tar CVE-2026-140239: Parser linkpath flaw, fix only in 8.0.0

A node-tar flaw lets a global PAX header plant an attacker-chosen linkpath on every entry read through tar.Parser or tar.list, and the only fix is a breaking major release that drops Node below 22.

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

node-tar (npm package tar) before 8.0.0 is affected by CVE-2026-140239. Version 8.0.0 is the only fixed version named, and no 7.x patch is listed. Only code that reads entry.linkpath from tar.Parser or tar.list() is exposed, while tar.x and tar.extract are not. Inventory direct Parser and list consumers now, add your own linkpath containment checks immediately, and plan the 8.0.0 migration, which requires Node 22 or later and a rewritten Parser API.

What happened

node-tar, the npm package tar, has a flaw tracked as CVE-2026-140239 and GHSA-ffhw-4r4q-5cwv. All versions before 8.0.0 are affected. The fix is in 8.0.0, released on 28 November 2026.

The bug. A PAX Global Extended Header that contains linkpath fills entry.linkpath on every entry returned by tar.Parser, and strict mode raises no warning. Code that calls tar.Parser or tar.list directly and trusts that value can create paths or symlinks outside the intended directory. The result can be arbitrary file read or write.

What is not affected. node-tar's own extraction is safe. tar.x and tar.extract are not affected because Unpack separately rejects a linkpath that escapes the target directory.

Named examples. The advisory gives three examples of affected software:

  • archive inspection tools
  • CI/CD tarball scanners
  • custom extraction logic built on the Parser API

The advisory also says the flaw defeats strict: true, which is supposed to throw on dangerous archive contents.

Severity. The CVE record scores it CVSS 4.0 7.2 (High), with vector CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N. The NVD status is Deferred.

The fixed release. The fix shipped inside a large set of changes. The 8.0.0 release notes list this advisory among a batch of security fixes for reading archives "in the same way as other tar programs". The same release is a breaking major:

  • It drops support for Node versions below 22.
  • Parser is no longer a stream. It is a state machine with push() and next().
  • Version 7 read entries after a single null block. 8.0.0 treats the first null block as the end of the archive, which changes how concatenated archives are read.

Why it matters

The exposed population is narrow, but it sits in the wrong place.

Applications that only extract with tar.x()/tar.extract() are not affected, according to the advisory. The affected code is code written to look at archives before trusting them. Beyond the advisory's three examples, the desk's inference is that likely candidates include:

  • upload validators
  • artifact and package scanners
  • SBOM or licence tooling
  • hand-rolled extractors that need more control than tar.x offers

That kind of code is usually treated as a security boundary. Teams that enabled strict: true reasonably assumed malformed headers would fail loudly. Here they did not.

The impact depends on what the consumer does with entry.linkpath:

  • If it only logs or displays the value, the effect is misleading output.
  • If it creates symlinks or builds filesystem paths from the value, the advisory's arbitrary read/write outcome applies.

The CVSS figure describes the library flaw. Your real severity depends on whether your code acts on linkpath without checking it.

The overlooked part is the cost of the fix. The advisory suggests a one-line filter. What actually shipped is a major release with a new API, a new minimum runtime and changed archive semantics.

Engineering assessment

Our assessment: treat this as high if you have a direct Parser or list consumer that processes archives from outside the organisation. Treat it as low priority if your applications only call tar.x/tar.extract.

The attack preconditions in the CVSS vector are low: a crafted archive, no privileges and passive user interaction. If your scanner ingests user uploads or third-party packages, assume it can be fed such an archive.

The harder problem is remediation:

  • Parser consumers must rewrite. Moving to 8.0.0 means replacing stream-based on('entry') handling with the push()/next() state machine.
  • Older runtimes are blocked. Services still on Node below 22 cannot take the fix without a runtime upgrade.
  • Concatenated archives change behaviour. Pipelines that relied on version 7 reading archives joined end to end will lose entries after the first null block. The release notes say this data is dropped with no warning.

For many teams this is a migration project, not a dependency bump. Do not let it sit in the normal major-upgrade queue while vulnerable inspection code stays in production.

The immediate control is therefore in your own code. Never trust entry.linkpath without resolving it and checking that it stays inside the intended root. That was always good practice, and this flaw shows the library's own validation cannot be the only check.

The broader lesson concerns layering. node-tar's Unpack layer caught this, but the Parser layer did not. Any tool that reimplements extraction on top of a lower-level parser gives up the guards in the higher-level layer. Re-examine any custom extractor for that reason, whichever library it uses.

One point needs caution. The OSV record lists two fix commits. The commit message for f351e5b describes the parser still reading entries after a lone null block, with a warning, whereas the 8.0.0 release notes describe dropping them. It is unclear whether that commit will ship in any release other than 8.0.0. No released version other than 8.0.0 is named as fixed.

Is this you?

You are exposed if all four of these are true:

  • npm ls tar shows any tar version below 8.0.0 in your dependency tree.
  • Your code, or a dependency's code, calls tar.Parser, new Parser or tar.list() directly.
  • That code reads entry.linkpath to build paths, create symlinks or make routing decisions.
  • The archives it processes can come from users, customers, package registries or other untrusted sources.

Two further points:

  • If you only extract with tar.x()/tar.extract(), the advisory says you are not affected by this specific issue.
  • If you relied on strict: true to reject dangerous archives in a Parser-based tool, it did not protect you here.

What to do

  1. Inventory today.

    • Run npm ls tar --all in each service and CI image.
    • Run node -v to record runtime versions.
    • Search your code for direct Parser use, for example grep -rn "Parser\|tar.list\|\.linkpath" --include=*.js --include=*.ts src/.
  2. Harden exposed code now (Not vendor guidance). Where a Parser or list consumer reads entry.linkpath:

    • Ignore linkpath on entries whose type is not SymbolicLink or Link.
    • Resolve the value against the entry's directory.
    • Reject anything that leaves the intended root.
    • Where the workflow allows, route actual extraction through tar.x(), which the advisory states blocks an escaping linkpath.
  3. Upgrade to 8.0.0. This is the only fixed version named. Before rolling it out:

    • Move affected services to Node 22 or later.
    • Port Parser code to the push()/next() model.
    • Replace callbacks and sync options with the new promise-based commands and *Sync commands.
    • Update imports, because subpath exports such as tar/parse are removed.
  4. Test archive semantics. Add regression fixtures for:

    • concatenated archives, which 8.0.0 now truncates at the first null block
    • strip behaviour
    • strict-mode extraction, which now stops at the first error

    If you process joined archives, split them before reading, as the release notes advise.

  5. Check transitive users. tar may arrive through another package that itself calls Parser. Your own code cannot fix that, so track that package's upgrade to 8.0.0.

  6. Plan for leads. Budget 8.0.0 as a scoped migration with an owner, especially where it is coupled to a Node 22 runtime upgrade. Migrate inspection and scanning tools first.

What we don't know yet

  • A 7.x backport. The evidence names no backport, and teams on Node below 22 have no vendor-named workaround.
  • Downstream consumers. The evidence does not enumerate which widely used packages call tar.Parser or tar.list directly.
  • Real-world preconditions. No deployment-specific guidance explains how the passive user-interaction requirement maps to real deployments.
  • Exploitation status. Whether any exploitation is known: the evidence contains no exploitation statement and no CISA KEV entry.
  • NVD data. NVD analysis is Deferred, so enrichment and affected-configuration data are not final.

The desk will watch for a 7.x release, downstream advisories from packages that wrap tar.Parser, and updates to the NVD record.

Sources

Latest engineering analysis