CVE-2026-140252: CVE-2026-140252: Denial of Service via Reference Count Underflow in node-tar UnpackSync
CVE-2026-140252: Denial of Service via Reference Count Underflow in node-tar UnpackSync Vulnerability ID: CVE-2026-140252 CVSS Score: 7.1 Published: 2026-12-01 A high-severity denial-of-service vulnerability exists
CVE-2026-140252: Denial of Service via Reference Count Underflow in node-tar UnpackSync
Vulnerability ID: CVE-2026-140252
CVSS Score: 7.1
Published: 2026-12-01
A high-severity denial-of-service vulnerability exists in node-tar versions 7.5.22 prior to 8.0.0 within the synchronous stream extraction implementation (UnpackSync). Due to an asymmetrical reference-counting design between the asynchronous base class Unpack and its synchronous subclass UnpackSync, handling any non-fatal entry error or skipped entry causes the internal pending operation counter to decrement below zero. Because the stream termination logic strictly checks for a counter value equal to zero, the extraction stream enters an unrecoverable state where lifecycle completion events (prefinish, finish, end) are never emitted, permanently blocking downstream stream consumers.
TL;DR
An improper reference count decrement (CWE-911) in node-tar (versions >= 7.5.22, < 8.0.0) allows remote attackers to trigger an indefinite stream hang and application denial of service by supplying a crafted tar archive containing a broken link or skippable entry to an application performing synchronous stream extraction.
⚠️ Exploit Status: POC
Technical Details
- CVE / Advisory ID: CVE-2026-140252 / GHSA-25mm-r35j-6hgm
- Weakness Class: CWE-911 (Improper Update of Reference Count)
- CVSS v4.0 Score: 7.1 High (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 Component: node-tar UnpackSync (versions >= 7.5.22, < 8.0.0)
- Patched Version: 8.0.0 (Commit 73b352e0010d6c99794ea7374800816a46d3bdb2)
- Impact: Indefinite Stream Hang / Application Denial of Service
- Exploit Status: Proof-of-Concept (Regression Test Suite)
- CISA KEV Status: Not Listed
Affected Systems
- node-tar (npm package 'tar') >= 7.5.22, < 8.0.0
-
node-tar (tar): >= 7.5.22, < 8.0.0 (Fixed in:
8.0.0)
Code Analysis
Commit: 73b352e
Override UNPEND as a no-op in UnpackSync so non-fatal entry errors and skipped entries do not decrement [PENDING] below zero and wedge the stream.
File: src/unpack.ts
@@ -903,6 +934,10 @@ const callSync = <T>(
export class UnpackSync extends Unpack {
sync: true = true;
+ // All work is done when the parser ends, so nothing is pending.
+ // This class never calls PEND, so UNPEND must not count.
+ [UNPEND]() {}
+
[MAKEFS](er: null | Error | undefined, entry: ReadEntry) {
return super[MAKEFS](er, entry, () => {})
}
Mitigation Strategies
- Upgrade node-tar to version 8.0.0 or later, which resolves the reference count underflow and migrates to native Web Streams and dedicated synchronous extractors.
- Refactor archive extraction workflows in legacy v7.x environments to use asynchronous stream extraction (tar.x without sync: true) or file-backed synchronous extraction (tar.x with both file and sync: true).
- Apply a runtime prototype override on tar.UnpackSync.prototype[Symbol(unpend)] to make it a no-op function if upgrading from node-tar 7.5.22 - 7.5.24 is blocked by Node.js engine constraints.
Remediation Steps:
- Audit project dependencies using 'npm ls tar' to identify whether node-tar versions >= 7.5.22 and < 8.0.0 are installed.
- Inspect application source code for usage of 'new tar.UnpackSync()' or 'tar.x({ sync: true })' / 'tar.extract({ sync: true })' where the 'file' option is omitted.
- Upgrade to 'tar@^8.0.0' via npm, yarn, or pnpm, and update extraction calls to conform to the v8 API (or apply the asynchronous stream / prototype patch workaround if remaining on v7.x).
- Verify stream termination behavior using a regression test with a tar fixture containing a broken link entry followed by a regular file.
References
- CVE-2026-140252 Record
- GitHub Security Advisory GHSA-25mm-r35j-6hgm
- Official Fix Commit in isaacs/node-tar
- node-tar v8.0.0 Release Notes
- NVD Vulnerability Detail: CVE-2026-140252
- CVEProject cvelistV5 Record for CVE-2026-140252
Read the full report for CVE-2026-140252 on our website for more details including interactive diagrams and full exploit analysis.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.