CVE-2026-140251: tar DoS

CVE-2026-140251

NVD

Vulnerability Summary

### Summary
An unauthenticated remote-input denial of service allows a crafted tar archive of about 1.5 KB to permanently and silently hang node-tar's default asynchronous extraction. When a `Link` or `SymbolicLink` entry has a `linkpath` that is an ancestor (or descendant) directory of the entry's own `path`, the internal path-reservation queue enters an unsatisfiable state. The promise returned by `tar.x()` / `tar.extract()` never resolves or rejects, the stream never emits `end` / `finish` / `close`, and no warning is raised. Every entry after the poison entry is silently skipped.

### Details
Async `Unpack` serialises filesystem work through `PathReservations` (`src/path-reservations.ts`). `reserve([entry.path, entry.linkpath], fn)` registers each reserved path as a plain function at that path's queue key, and every ancestor directory of each path as a `Set<Handler>` at that directory's queue key.

`check(fn)` (src/path-reservations.ts:114-120) only schedules `fn` when it is the head function of every path queue AND the head of every directory queue is a `Set` that contains `fn`:

```ts
check(fn) {
const { paths, dirs } = this.#getQueues(fn)
return (
paths.every(q => q && q[0] === fn) &&
dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))
)
}
```

When one of the two reserved strings is an ancestor directory of the other, the same queue key is written twice: once as a function head (the path reservation, src/path-reservations.ts:65-72) and once as a directory `Set` (the dir reservation, src/path-reservations.ts:73-85). For a hardlink `a/b` whose linkpath is `a`, key `a` first receives `[fn]` (function head), then the dir loop appends a `Set` behind it, giving `[fn, Set([fn])]`. `check()` then requires `q[0] instanceof Set` at key `a`, but `q[0]` is the function `fn`, so `check()` is permanently false. `#run(fn)` never fires, `[CHECKFS2]` never executes, the `[PENDING]` counter never drains, and `[MAYBECLOSE]` never completes the stream.

The collision can be introduced by three independent, attacker-controlled routes, all validated:
1. A literal `Link` / `SymbolicLink` header whose `linkpath` is a hierarchical relative of its `path`.
2. A PAX extended-header `linkpath` record attached to a plain `File` entry (the "linkpath forbidden" check runs on the raw header before PAX fields are applied, so a File can carry a linkpath). See advisory 03.
3. A GNU long-linkname (`K` / `NextFileHasLongLinkpath`) entry assigning a hierarchical linkpath to the following link entry.

Synchronous extraction bypasses reservations and is unaffected. Windows is unaffected because reservations are globally serialised there under a single key (`'win32 parallelization disabled'`, src/path-reservations.ts:53-55).

### PoC
Validated on `president-xd/node-tar` main @ 2a22bfc (version 7.5.22) and against the published npm package `tar@7.5.22`, on Linux, Node v24.19.0.

```js
// npm i tar@7.5.22 ; node poc.cjs
const { Header, x } = require('tar')
const fs = require('fs')
const dir = '/tmp/resv-hang'; fs.rmSync(dir, {recursive:true, force:true}); fs.mkdirSync(dir, {recursive:true})
const b = Buffer.alloc(512)
new Header({ path: 'a/b', type: 'Link', linkpath: 'a', size: 0, mode: 0o644 }).encode(b, 0) // linkpath 'a' is ancestor of 'a/b'
fs.writeFileSync(dir + '/poison.tar', Buffer.concat([b, Buffer.alloc(1024)]))
let settled = 'NEVER'
x({ cwd: dir, file: dir + '/poison.tar' }).then(() => settled='RESOLVED').catch(() => settled='REJECTED')
const keepalive = setInterval(() => {}, 100) // hold the loop open so an unsettled promise is a true hang
setTimeout(() => { clearInterval(keepalive); console.log('result:', settled); process.exit(0) }, 4000)
```

Observed output:
```
result: NEVER // no warning, no resolution, no rejection
```
Control archive with `linkpath: 'c'` (a sibling, not a hierarchical relative) resolves in the same harness with a single `TAR_ENTRY_ERROR` warning. The PAX-linkpath route (`14 linkpath=a\n` before a `File` at `a/b`) and the GNU `K` route both hang identically; their sibling controls both resolve.

### Impact
Availability-only denial of service (no confidentiality or integrity effect, no extraction outside the target directory). Any pipeline that uses node-tar's default asynchronous extraction on POSIX and awaits completion can be wedged forever by a small crafted archive: npm and CI package installation, artifact processing, bundlers, and any service that extracts third-party tarballs. Impact is a permanent silent hang, with all subsequent entries in the archive never extracted. Unauthenticated, remote, no user interaction.
Severity Level
HIGH(7.1)
Published Date
Dec 1, 2026
Last Modified
Dec 2, 2026
Exploitation Status
No confirmed exploitation yet
CVE Record Status
Published
EPSS Score (30-Day)
0.59%Probability
Root Weakness (CWE)
The product does not properly acquire or release a lock on a resource, leading to unexpected resource state changes and behaviors.
The product contains multiple threads or executable segments that are waiting for each other to release a necessary lock, resulting in deadlock.
CVSS v4.0 Base Metrics — Score 7.1
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
Attack VectorNetwork
Attack ComplexityLow
Attack RequirementsNone
Privileges RequiredNone
User InteractionPassive
Confidentiality (Vulnerable System)None
Integrity (Vulnerable System)None
Availability (Vulnerable System)High
Confidentiality (Subsequent System)None
Integrity (Subsequent System)None
Availability (Subsequent System)None

Affected & Patched Versions

Affected Versions
  • tar >= 7.5.22, < 8.0.0
Patched Versions
No patched version published yet
Until a fix ships, reduce exposure:
  • Restrict access to the affected service or interface to trusted networks.
  • Disable the affected feature if you do not need it.
  • Watch the vendor advisory for a firmware or software update.

What to do

Plan remediation soon. No exploitation is confirmed yet, but the severity is high.

  1. Check whether you run tar and which version.
  2. No patched version is listed yet. Limit access to the affected service to trusted networks, and disable the feature if you can.
  3. Subscribe to the vendor advisory so you learn when a fix ships.

Timeline

  • Dec 1, 2026Published
  • Dec 2, 2026Record last modified

Score, severity and exploitation changes are tracked from the day Watchtower started logging them.

Get notified about new tar CVEsYou are reading CVE-2026-140251. Get an email when KEV listings, exploits or new CVEs match your stack.
Set up CVE alerts

Data last checked: Dec 2, 2026 02:00 UTC