Dev.to Security ๐Ÿ” Cybersecurity ๐Ÿ‘ 0 ๐Ÿ“– 3 min read

CVE-2026-140236: CVE-2026-140236: Archive Framing Differential and PAX Header Interpretation Conflict in node-tar

CVE-2026-140236: Archive Framing Differential and PAX Header Interpretation Conflict in node-tar Vulnerability ID: CVE-2026-140236 CVSS Score: 7.2 Published: 2026-12-02 node-tar prior to version 8.0.0 contains an in

CVE-2026-140236: Archive Framing Differential and PAX Header Interpretation Conflict in node-tar

Vulnerability ID: CVE-2026-140236
CVSS Score: 7.2
Published: 2026-12-02

node-tar prior to version 8.0.0 contains an interpretation conflict (CWE-436) in its ReadEntry and PAX header parsing implementations. The ReadEntry class improperly applies PAX size attributes to GNU and PAX metadata entries, reverses local-versus-global PAX precedence, and splits PAX records by newline characters rather than explicit byte length fields. These parsing inconsistencies cause node-tar to frame archive boundaries differently from standard tar implementations, enabling security scanner bypasses, maxMetaEntrySize memory cap evasion, and member injection during archive repacking operations.

TL;DR

An archive framing differential in node-tar prior to version 8.0.0 allows attackers to smuggle hidden archive members past upstream security filters or inject arbitrary members during archive repacking by exploiting improper application of PAX extended headers to meta entries.

โš ๏ธ Exploit Status: POC

Technical Details

  • Vulnerability ID: CVE-2026-140236 / GHSA-qv2w-fc3h-pm27
  • Weakness Type: CWE-436 (Interpretation Conflict)
  • CVSS v4.0 Score: 7.2 High (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N)
  • Affected Package: node-tar (tar on npm) < 8.0.0
  • Patched Version: 8.0.0
  • Primary Impact: Archive Framing Differential, Filter Bypass, and Repack Member Injection
  • Exploit Status: PoC Available (Upstream Regression Tests)
  • CISA KEV Status: Not Listed

Affected Systems

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

Code Analysis

Commit: f351e5b

Prevent PAX attributes from being applied to meta entries in ReadEntry, enforce global-then-local PAX precedence, frame PAX key-value records by byte length, and check maxMetaEntrySize against header.size.

--- a/src/read-entry.ts
+++ b/src/read-entry.ts
@@ -96,11 +96,15 @@ export class ReadEntry extends Minipass<Buffer, Buffer> {
     this.uname = header.uname
     this.gname = header.gname

-    if (ex) {
-      this.#slurp(ex)
-    }
-    if (gex) {
-      this.#slurp(gex, true)
+    // Pending extended headers describe the next file entry, not a
+    // meta entry. Apply global first, so that local values win.
+    if (!this.meta) {
+      if (gex) {
+        this.#slurp(gex, true)
+      }
+      if (ex) {
+        this.#slurp(ex)
+      }
     }
   }
@@ -136,7 +140,15 @@ export class ReadEntry extends Minipass<Buffer, Buffer> {
-          return !(v === null || v === undefined || (k === 'path' && gex))
+          // The Header already resolved size. It sets the body length.
+          return !(
+            v === null ||
+            v === undefined ||
+            k === 'size' ||
+            k === 'global' ||
+            (k === 'path' && gex) ||
+            (k === 'linkpath' && gex)
+          )
         }),
       ),
     )

Exploit Details

  • GitHub (Upstream Regression Test Suite): Functional proof-of-concept test cases in test/parse-differential.test.ts demonstrating PAX size=0 overrides against GNU @LongLink meta entries, filter bypasses during archive repacking, and maxMetaEntrySize bypasses.

Mitigation Strategies

  • Upgrade node-tar (tar on npm) to version 8.0.0 or later to enforce strict PAX length framing and eliminate meta entry attribute inheritance.
  • Eliminate the use of archive repacking surfaces (@archive syntax in tar.create/tar.replace and Pack.add(ReadEntry)) when handling untrusted archive inputs.
  • Normalize or pre-extract untrusted archives using compliant system utilities (such as bsdtar) in an isolated sandbox prior to processing with older versions of node-tar.

Remediation Steps:

  1. Audit project dependencies using 'npm ls tar' to identify all direct and transitive installations of node-tar prior to version 8.0.0.
  2. Verify that the execution environment is running Node.js >= 22, which is required by node-tar v8.0.0.
  3. Update direct dependencies by executing 'npm install tar@^8.0.0' and refactor any legacy callback-based API calls or Minipass stream consumers to use Promises and Web Streams.
  4. Apply package.json 'overrides' (or Yarn 'resolutions' / pnpm 'overrides') to force transitive dependencies onto tar@^8.0.0 where API-compatible.

References

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