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

CVE-2026-140240: CVE-2026-140240: Resource Exhaustion and Algorithmic Complexity Denial of Service in node-tar

CVE-2026-140240: Resource Exhaustion and Algorithmic Complexity Denial of Service in node-tar Vulnerability ID: CVE-2026-140240 CVSS Score: 7.1 Published: 2026-12-02 CVE-2026-140240 (GHSA-7c32-79xj-j3jp) is a resour

CVE-2026-140240: Resource Exhaustion and Algorithmic Complexity Denial of Service in node-tar

Vulnerability ID: CVE-2026-140240
CVSS Score: 7.1
Published: 2026-12-02

CVE-2026-140240 (GHSA-7c32-79xj-j3jp) is a resource exhaustion and algorithmic complexity vulnerability in node-tar, the archive manipulation library for Node.js. In versions prior to 8.0.2, processing a small, crafted tar archive (approximately 20 KB) causes severe CPU degradation or triggers an Out-of-Memory (OOM) crash in the V8 JavaScript heap. The vulnerability stems from quadratic string allocation in asynchronous path reservation bookkeeping, unbounded depth and length validation on linkpath headers, memory retention leaks in reservation maps, and unbounded string caching in the Unicode normalization subsystem.

TL;DR

A flaw in node-tar versions prior to 8.0.2 allows unauthenticated attackers to crash Node.js applications via Out-of-Memory (OOM) errors or CPU exhaustion using a 20 KB crafted tar archive. Upgrading to [email protected] resolves the issue by refactoring path reservations into a Trie structure and enforcing strict path length and depth bounds.

⚠️ Exploit Status: POC

Technical Details

  • CVE ID: CVE-2026-140240 (GHSA-7c32-79xj-j3jp)
  • Weakness Class: CWE-407 / CWE-401 / CWE-770 (Algorithmic Complexity & Memory Exhaustion)
  • 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)
  • Attack Vector: Network (Untrusted Tar Archive Processing)
  • Impact: Denial of Service via V8 Out-of-Memory (OOM) Crash or Lock Deadlock
  • Exploit Status: Proof-of-Concept (Regression PoC in Official Repository)
  • Affected Versions: node-tar (npm: tar) < 8.0.2
  • Patched Version: 8.0.2

Affected Systems

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

Code Analysis

Commit: 73b352e

limit the work that a small archive can cause

Commit: de87900

limit the memory that long paths use in an async extraction

Exploit Details

  • GitHub: Official regression tests demonstrating deep linkpath and file filtering exhaustion vectors.
  • GitHub: Official regression tests demonstrating 16-entry quadratic prefix allocation OOM crash in PathReservations.

Mitigation Strategies

  • Upgrade the npm package 'tar' (node-tar) to version 8.0.2 or later across all direct and transitive dependencies.
  • Isolate untrusted archive parsing and extraction tasks within dedicated, memory-bounded worker processes or ephemeral containers so that OOM crashes do not terminate the primary application server.
  • Use synchronous extraction modes (sync: true) when processing archives in environments where upgrading to 8.0.2 is temporarily blocked, bypassing the asynchronous PathReservations queue.
  • Enforce strict execution timeouts on archive ingestion workers to recover from potential relative linkpath deadlocks.

Remediation Steps:

  1. Run 'npm ls tar' to identify all direct and transitive installations of node-tar in the project.
  2. Execute 'npm install tar@>=8.0.2' to update direct dependencies to the patched release.
  3. If transitive dependencies require older versions of tar, configure 'overrides' in package.json to enforce 'tar': '>=8.0.2' and run 'npm install'.
  4. Redeploy affected Node.js services and verify in production lockfiles (package-lock.json) that no versions below 8.0.2 remain.

References

Read the full report for CVE-2026-140240 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.