Dev.to Security 🔐 Cybersecurity 👁 2 📖 3 min read

CVE-2026-140229: CVE-2026-140229: Unbounded Memory Allocation via Delayed Decompression Ratio Evaluation in node-tar

CVE-2026-140229: Unbounded Memory Allocation via Delayed Decompression Ratio Evaluation in node-tar Vulnerability ID: CVE-2026-140229 CVSS Score: 7.1 Published: 2026-12-05 CVE-2026-140229 (GHSA-9239-v992-p74f) is a

CVE-2026-140229: Unbounded Memory Allocation via Delayed Decompression Ratio Evaluation in node-tar

Vulnerability ID: CVE-2026-140229
CVSS Score: 7.1
Published: 2026-12-05

CVE-2026-140229 (GHSA-9239-v992-p74f) is a denial-of-service vulnerability in the node-tar archive extraction library prior to version 8.0.0. The vulnerability occurs because the maxDecompressionRatio check is performed after the underlying zlib decompression stream has already inflated and materialized input chunks into memory. An attacker supplying a crafted, highly compressed archive can force the Node.js runtime to allocate unbounded memory buffers before the ratio limit is evaluated, terminating the process via an Out of Memory (OOM) crash.

TL;DR

In node-tar versions prior to 8.0.0, decompression bomb protections evaluate the compression ratio only after native zlib streams allocate memory for inflated chunks, enabling denial-of-service via memory exhaustion.

⚠️ Exploit Status: POC

Technical Details

  • CVE ID: CVE-2026-140229 (GHSA-9239-v992-p74f)
  • Weakness Class: CWE-770: Allocation of Resources Without Limits or Throttling
  • CVSS v4.0 Score: 7.1 HIGH (AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N)
  • EPSS Score: 0.008 (57.90th percentile)
  • Impact: Denial of Service via V8 / Native Heap Out of Memory (OOM) Crash
  • Affected Versions: tar (node-tar) < 8.0.0
  • Patched Version: tar (node-tar) 8.0.0
  • CISA KEV Status: Not Listed

Affected Systems

  • node-tar (npm package: tar) < 8.0.0
  • tar (node-tar): < 8.0.0 (Fixed in: 8.0.0)

Code Analysis

Commit: da66090

next: add the node entry point, zlib codecs, replace, and update

const limit = (max: number) =>
  max >= constants.MAX_LENGTH ?
    {}
  : { maxOutputLength: Math.max(1, Math.floor(max)) }

decompressSync: (data, { maxOutputLength }) => {
  try {
    return decompressSync(data, limit(maxOutputLength))
  } catch (er) {
    if ((er as { code?: string })?.code !== 'ERR_BUFFER_TOO_LARGE') {
      throw er
    }
    throw new Error(
      `max decompression ratio exceeded: the output is larger than ${maxOutputLength} bytes`,
    )
  }
}

Commit: 73b352e

limit the work that a small archive can cause

[CONSUMECHUNK](chunk?: Buffer) {
  if (this[SAW_EOF]) {
    this[BUFFER] = undefined
    chunk = undefined
  }

Mitigation Strategies

  • Upgrade node-tar (npm package 'tar') to version 8.0.0 or higher to enforce 64 KiB pull-based decompression chunking and native maxOutputLength boundaries.
  • Pre-decompress untrusted archives using native node:zlib streams configured with explicit maxOutputLength and bounded chunkSize options before passing the raw tar stream to node-tar.
  • Isolate archive extraction operations into separate worker threads with V8 resourceLimits or sandboxed sub-processes with cgroup memory caps.
  • Enforce strict file upload size ceilings at the ingress or API gateway layer before buffering or streaming archives to backend workers.

Remediation Steps:

  1. Audit project dependencies using 'npm ls tar' to identify direct and transitive usage of the tar package below version 8.0.0.
  2. Verify that the target runtime environment runs Node.js 22 or newer, which is required by [email protected].
  3. Update package.json to specify 'tar': '^8.0.0' and run 'npm install'.
  4. Refactor any legacy stream event handlers or callback patterns to align with the v8.0.0 Web Streams and Promise-based API changes.
  5. If locked to tar v7.x, wrap incoming compressed streams with a custom transform stream that enforces node:zlib maxOutputLength prior to invoking tar.extract().

References

Read the full report for CVE-2026-140229 on our website for more details including interactive diagrams and full exploit analysis.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.