Exploited now
Vulnerability WatchVulnerabilities, exploits & advisories — updated every 15 minutes
Alerts

Home › CVE › JavaScript

CVE-2026-140252 — node-tar UnpackSync never completes sync-stream extraction after any failing entry (PEND/UNPEND imbalance)

High · CVSS 7.1 First seen December 01, 2026
JavaScriptWebVulnerabilities

Severity breakdown

High · 7.1 CVSS 4.0 base score from the CNA (github.com)

An attacker without an account can exploit this over the network if a user views or visits something.

Attack from
the network (remotely)
Attack complexity
low (no special conditions)
Special conditions
none
Login needed
no
User action needed
yes, a user must view or visit something
Impact
high on availability, none on confidentiality and integrity
Impact on other systems
none

Vector CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X · CVSS 4.0 7.1 from GitHub: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Weakness

  • CWE-667: Improper Locking
  • CWE-696: Incorrect Behavior Order
  • CWE-911: Improper Update of Reference Count

Affected and fixed versions

ProductAffected versionsFixed in
tar (npm)≥ 7.5.22, < 8.0.08.0.0
isaacs node-tar>= 7.5.22, < 8.0.0—

From the GitHub Advisory Database and the vendor's CVE record; confirm with the vendor advisory before relying on a version number.

References by type

Vendor advisories

Patches and fixed releases

Other references

Details from NVD (public domain), the GitHub Advisory Database (CC BY 4.0).

Details

Summary

When node-tar's synchronous stream extraction (tar.x({ sync: true }) without the file option, or a directly-constructed UnpackSync stream) processes any archive entry that fails, the stream never emits end, finish, or close. A single failing entry, for example a hardlink whose target does not exist (one 512-byte entry), emits a TAR_ENTRY_ERROR warning and then hangs the stream. Consumers that await stream completion hang indefinitely on hostile or merely damaged input, with no error to catch because the warning is non-fatal by design.

Details

Unpack (async) brackets each entry's filesystem work with [PEND]() / [UNPEND]() to hold the stream open until every entry settles; [MAYBECLOSE] emits completion only when PENDING === 0:

// src/unpack.ts:244-246
[MAYBECLOSE]() { if (this[ENDED] && this[PENDING] === 0) { /* emit prefinish/finish/end */ } }
// src/unpack.ts:436-447  (inherited by UnpackSync)
[ONERROR](er, entry) {
  if (er.name === 'CwdError') this.emit('error', er)
  else { this.warn('TAR_ENTRY_ERROR', er, { entry }); this[UNPEND](); entry.resume() }   // PENDING--
}
// src/unpack.ts:728-729  async CHECKFS pends...
[CHECKFS](entry) { this[PEND](); ... }

UnpackSync[CHECKFS] (src/unpack.ts:901) performs the same work but never calls [PEND](), yet UnpackSync does not override [ONERROR], so it inherits the async handler that unconditionally calls [UNPEND]() on any non-CwdError entry failure. A single failing entry therefore drives PENDING to -1. Because [MAYBECLOSE] requires exactly 0, the negative counter permanently suppresses end / finish / close. (A separate fall-through in the same method, a missing return after the rmdir branch at src/unpack.ts:953-954, double-invokes MAKEFS on a directory-replacement entry, producing two warnings and PENDING = -2.)

PoC

Validated on source main @ 2a22bfc and against the published npm package tar@7.5.22, Node v24.19.0.

// npm i tar@7.5.22 ; node poc.cjs
const { Header, x } = require('tar'); const fs = require('fs')
const dir = '/tmp/sync-hang'; fs.rmSync(dir,{recursive:true,force:true}); fs.mkdirSync(dir,{recursive:true})
const b = Buffer.alloc(512)
new Header({ path:'ln', type:'Link', linkpath:'nonexistent', size:0, mode:0o644 }).encode(b,0)
const u = x({ sync: true, cwd: dir })          // the UnpackSync stream
let ended = false; const warns = []
u.on('end', ()=>ended=true); u.on('finish', ()=>ended=true); u.on('warn', c=>warns.push(c))
u.end(Buffer.concat([b, Buffer.alloc(1024)]))
setTimeout(()=>{ console.log(ended ? 'ENDED' : '*** HANG: end/finish never emitted', 'warnings=', warns); process.exit(0) }, 1500)

Observed:

*** HANG: end/finish never emitted   warnings= [ 'TAR_ENTRY_ERROR' ]

Controls in the same harness: the identical archive through the async file API (x({ cwd, file })) resolves with a single TAR_ENTRY_ERROR; an all-success archive through the sync-stream API ends normally and extracts its file. Disk state is fail-closed (the failing entry is simply not created).

Impact

Availability denial of service (permanent stream hang after a warning). No confidentiality or integrity effect and no incorrect data is written. The affected surface is narrow: only consumers that pipe into new UnpackSync() or the stream returned by x({ sync: true }) (without file) and await end / finish / close. The default asynchronous API and the common file-based synchronous API (x({ sync: true, file }), which returns void) are unaffected. A single 512-byte crafted or damaged entry is enough to wedge an affected consumer.

Source: GHSA-25mm-r35j-6hgm / CVE-2026-140252, GitHub Advisory Database, licensed CC BY 4.0.

Affected

  • npm:tar
  • isaacs node-tar

What to do

  • Check whether you run an affected product or version and apply the vendor's update or mitigation.
  • Follow the vendor advisory and the references below for fixed versions and workarounds.

Frequently asked questions

What is CVE-2026-140252?

When node-tar's synchronous stream extraction (tar.x({ sync: true }) without the file option, or a directly-constructed UnpackSync stream) processes any archive entry that fails, the stream never emits end, finish, or close. A single failing entry, for example a hardlink whose target does not exist (one 512-byte entry), emits a TARENTRYERROR warning and then hangs the stream. Weakness type: Improper Locking (CWE-667).

How severe is CVE-2026-140252?

CVE-2026-140252 has a CVSS 4.0 base score of 7.1 (high), from the CNA (github.com). An attacker without an account can exploit this over the network if a user views or visits something.

Is CVE-2026-140252 being exploited?

Not as far as is known: CVE-2026-140252 is not in CISA's Known Exploited Vulnerabilities catalog as of December 1, 2026.

Which versions are affected by CVE-2026-140252?

tar (npm) ≥ 7.5.22, < 8.0.0 (fixed in 8.0.0); isaacs node-tar >= 7.5.22, < 8.0.0.

How do I fix CVE-2026-140252?

Update to a fixed release: tar (npm) 8.0.0.

Timeline & sources

References

Related vulnerabilities & news