CVE-2026-140240: node-tar A Small Archive Exhausts Memory Vulnerability

HIGH
Advisory Identifier: GHSA-7c32-79xj-j3jp
CWE-770 CWE-401 CWE-407
Published
Advisory Summary

CVE-2026-140240 is a HIGH a small archive exhausts memory vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting node-tar libraries in the npm ecosystem. The issue involves a small archive exhausts memory or cpu through path-reservation bookkeeping. Remediation is available by upgrading affected packages to version 8.0.2.

CVE-2026-140240 at a Glance

CVE Identifier CVE-2026-140240
GHSA Identifier GHSA-7c32-79xj-j3jp
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-140240

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.2
npm install tar@8.0.2
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-140240, 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.2), 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 GHSA-f5x3-32g6-xq36 fix bounded the depth (component count) of `entry.path` with `maxDepth`. The path-reservation code still computes every ancestor prefix of each reserved path, and its cost grows with the number of components multiplied by the path length. That bound doesn't apply to `linkpath`, nor to long components within the depth limit. Reservation state and some caches are also never released for the life of an extraction. ### Details | # | Issue | Location | Default options | |---|---|---|---| | VULN-002 | `linkpath` has no depth or length bound and is reserved for every entry type. `getDirs` cost is quadratic in its length, so an archive of a few hundred bytes compressed aborts the Node process | `src/path-reservations.ts:25-38`, via `src/unpack.ts:729-734` | Yes (async `x`/`Unpack`) | | VULN-023 | Within `maxDepth`, very long components make the same `getDirs` computation exhaust memory (the depth fix bounds count, not length) | `src/path-reservations.ts:25-38`, via `src/unpack.ts:734` | Yes (async) | | VULN-009 | `PathReservations.#reservations` entries are never deleted, so ancestor strings for every entry are kept until the `Unpack` ends | `src/path-reservations.ts:64` | Yes (async) | | VULN-012 | The `normalizeUnicode` cache is capped by entry count (10k), not bytes, so long names make it large | `src/normalize-unicode.ts:5-35` | Yes (async) | | VULN-024 | `filesFilter` memoises every path prefix; memory grows with depth × length. The GHSA-r292 fix bounded recursion depth, not the memo | `src/list.ts:35-52` | Needs a file list | Not the same as open PR #470, which fixes a reservation deadlock when a linkpath is a parent of the entry path. ### Proof of concept `exploit_tests/test_vuln_002_*`, `_023_`, `_009_`, `_012_` and `_024_`. Each test runs a control archive and an attack archive against the unmodified 7.5.22 build, with output recorded in `exploit_tests/evidence/`. All were run on macOS. ### Impact Any service that extracts untrusted archives with the default async API can be made to exhaust memory or CPU, and crash, by a very small upload (VULN-002, VULN-023). The others raise memory use in long-running or large extractions.

CVE-2026-140240 Affected node-tar Versions

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

References

Frequently Asked Questions

What is CVE-2026-140240?
CVE-2026-140240 is a security vulnerability in node-tar involving A small archive exhausts memory or CPU through path-reservation bookkeeping under CWE-770: Allocation of Resources Without Limits or Throttling.
Which node-tar versions are affected?
Affected versions include releases prior to 8.0.2 across affected packages: tar.
What version fixes CVE-2026-140240?
Upgrading to 8.0.2 (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.2. Upgrade your dependency to 8.0.2 or later.
What CWE is associated with CVE-2026-140240?
CVE-2026-140240 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-140240?
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-7c32-79xj-j3jp",
  "modified" : "2026-12-02T01:23:10Z",
  "published" : "2026-12-02T01:23:10Z",
  "aliases" : [ "CVE-2026-140240" ],
  "summary" : "node-tar: A small archive exhausts memory or CPU through path-reservation bookkeeping",
  "details" : "### Summary\n\nThe GHSA-f5x3-32g6-xq36 fix bounded the depth (component count) of `entry.path` with `maxDepth`. The path-reservation code still computes every ancestor prefix of each reserved path, and its cost grows with the number of components multiplied by the path length. That bound doesn't apply to `linkpath`, nor to long components within the depth limit. Reservation state and some caches are also never released for the life of an extraction.\n\n\n### Details\n\n| # | Issue | Location | Default options |\n|---|---|---|---|\n| VULN-002 | `linkpath` has no depth or length bound and is reserved for every entry type. `getDirs` cost is quadratic in its length, so an archive of a few hundred bytes compressed aborts the Node process | `src/path-reservations.ts:25-38`, via `src/unpack.ts:729-734` | Yes (async `x`/`Unpack`) |\n| VULN-023 | Within `maxDepth`, very long components make the same `getDirs` computation exhaust memory (the depth fix bounds count, not length) | `src/path-reservations.ts:25-38`, via `src/unpack.ts:734` | Yes (async) |\n| VULN-009 | `PathReservations.#reservations` entries are never deleted, so ancestor strings for every entry are kept until the `Unpack` ends | `src/path-reservations.ts:64` | Yes (async) |\n| VULN-012 | The `normalizeUnicode` cache is capped by entry count (10k), not bytes, so long names make it large | `src/normalize-unicode.ts:5-35` | Yes (async) |\n| VULN-024 | `filesFilter` memoises every path prefix; memory grows with depth × length. The GHSA-r292 fix bounded recursion depth, not the memo | `src/list.ts:35-52` | Needs a file list |\n\nNot the same as open PR #470, which fixes a reservation deadlock when a linkpath is a parent of the entry path.\n\n\n### Proof of concept\n\n`exploit_tests/test_vuln_002_*`, `_023_`, `_009_`, `_012_` and `_024_`. Each test runs a control archive and an attack archive against the unmodified 7.5.22 build, with output recorded in `exploit_tests/evidence/`. All were run on macOS.\n\n\n### Impact\n\nAny service that extracts untrusted archives with the default async API can be made to exhaust memory or CPU, and crash, by a very small upload (VULN-002, VULN-023). The others raise memory use in long-running or large extractions.",
  "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.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/node-tar/security/advisories/GHSA-7c32-79xj-j3jp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-140240"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/node-tar/commit/73b352e0010d6c99794ea7374800816a46d3bdb2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/node-tar/commit/de87900752566867b422de0ebfe6592b30fa9786"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/isaacs/node-tar"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/isaacs/node-tar/releases/tag/v8.0.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-401", "CWE-407", "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-02T01:23:10Z",
    "nvd_published_at" : "2026-12-01T18:17:27Z"
  }
}