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-140235

CVE-2026-140235: PAX Extended Header Forged-Field Injection and Record Dropping in node-tar

Amit Schendel
Amit Schendel
Senior Security Researcher

Dec 2, 2026·13 min read·3 visits

Executive Summary (TL;DR)

node-tar versions 7.5.0 to 7.5.24 improperly parse PAX extended headers by splitting on newline characters instead of using byte-length framing. Attackers can embed newlines within benign PAX attributes to drop records and inject forged path, size, or linkpath attributes, leading to arbitrary file overwrites and potential directory traversal.

A parsing vulnerability in the node-tar archive manipulation library for Node.js (versions 7.5.0 through 7.5.24) allows attackers to drop legitimate metadata fields and inject forged entry attributes into tar archives. By splitting POSIX.1-2001 PAX extended headers on newline characters rather than respecting explicit byte-length framing, the parser misinterprets embedded newlines inside attribute values as record delimiters. This enables arbitrary file overwrite within the extraction directory, metadata tampering, archive desynchronization, and arbitrary path traversal when non-default path preservation settings are enabled.

Vulnerability Overview

The node-tar package (published on npm as tar) is a widely deployed archive manipulation library for the Node.js ecosystem. It provides stream-based and file-based APIs for creating, listing, and extracting POSIX tar archives, serving as a foundational dependency for package managers, build pipelines, and automated deployment utilities.

In versions 7.5.0 through 7.5.24, node-tar contains a framing flaw in its POSIX.1-2001 PAX extended header parser (src/pax.ts). When processing PAX header blocks (identified by header typeflags 'x' for next-entry extended attributes or 'g' for global extended attributes), the library splits the raw payload string on newline characters (\n) prior to evaluating the decimal byte-length prefix defined by the specification.

This implementation violates the POSIX.1-2001 framing rules and introduces two distinct security weaknesses classified under CWE-20 (Improper Input Validation) and CWE-436 (Interpretation Conflict). An attacker who supplies a crafted tar archive containing a newline inside a PAX attribute value can cause the parser to silently discard the host attribute (Record Dropping) and treat the trailing substring following the newline as an independent, authoritative PAX record (Forged-Field Injection).

Through forged-field injection, an unauthenticated attacker can override critical archive entry attributes including path, linkpath, size, mode, uid, gid, and mtime. Under default extraction configurations, forging the path attribute allows arbitrary overwriting of files inside the target extraction root. When applications configure node-tar with preservePaths: true, forged paths containing parent-directory references (../) or leading slashes allow arbitrary file creation and overwrite across the host filesystem.

Root Cause Analysis

Under the POSIX.1-2001 (IEEE Std 1003.1-2001) standard, PAX extended headers overcome the legacy limits of the USTAR format—such as the 100-byte filename boundary and 8-GiB file size limit—by storing arbitrary key-value metadata inside a dedicated data block preceding the file entry. Each record within a PAX extended header block is strictly structured according to the following byte-level grammar:

"<length> <keyword>=<value>\n"

The <length> field is an ASCII decimal representation of the total byte length of the record, inclusive of the length digits themselves, the single separating space (0x20), the <keyword>=<value> body, and the terminating newline character (0x0A). Because <value> can legally contain arbitrary UTF-8 strings or binary data—including embedded 0x0A newline bytes—a specification-compliant parser must first parse the decimal <length> up to the space delimiter, advance the byte cursor by exactly <length> bytes, and verify that the final byte at offset + length - 1 is 0x0A.

The vulnerability in node-tar (introduced in commit dcb0287d7da925182aa8840ca1038bf44160ca5e) stems from inverting this parsing order in src/pax.ts. Rather than using the <length> prefix to slice records from a byte buffer, the parseKV helper stripped the final trailing newline from the decoded UTF-8 block and executed .split('\n') across the entire payload. Each resulting line segment was then passed to parseKVLine, which parsed the leading integer n via parseInt(line, 10) and checked whether n === Buffer.byteLength(line) + 1.

When a valid PAX record contains an internal newline, .split('\n') bifurcates the single record into multiple candidate lines. The first fragment retains the original record's total length prefix n, which no longer matches the shortened fragment's byte length plus one (n !== Buffer.byteLength(line) + 1). Consequently, parseKVLine aborts processing of the first fragment and silently drops the attribute. If an attacker crafts the bytes immediately following the embedded newline to match the format <len> <key>=<value>, the second fragment is passed to parseKVLine as a standalone record, satisfies the length check, and injects the forged attribute directly into the entry metadata object.

Because standard compliance tools and upstream archive inspection filters (such as antivirus scanners or content validation proxies that parse PAX records by byte length) view the payload after the embedded newline as inert data belonging to the preceding attribute (for example, a harmless comment field), this flaw also creates an interpretation conflict (CWE-436). A security filter validating entry filenames against a blocklist will read the outer USTAR header or genuine PAX path, while node-tar extracts the payload to the attacker's forged path hidden inside the secondary PAX attribute.

Code Analysis

In node-tar versions 7.5.0 through 7.5.24, the PAX key-value parser in src/pax.ts was implemented using string splitting and a line-by-line reducer. A source comment inside parseKVLine explicitly noted that values containing newline characters would fail validation, though the security implications of forged trailing fragments and null-byte truncation were not accounted for.

// VULNERABLE CODE: src/pax.ts (node-tar >= 7.5.0, < 8.0.0)
const parseKV = (str: string) =>
  str
    .replace(/\n$/, '')
    .split('\n')
    .reduce(parseKVLine, Object.create(null))
 
const parseKVLine = (
  set: Record<string, string | number | Date>,
  line: string,
) => {
  const n = parseInt(line, 10)
 
  // XXX Values with \n in them will fail this.
  // Refactor to not be a naive line-by-line parse.
  if (n !== Buffer.byteLength(line) + 1) {
    return set
  }
 
  line = line.slice((n + ' ').length)
  const kv = line.split('=')
  const r = kv.shift()
  if (!r) {
    return set
  }
 
  const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1')
  // Vulnerable regex: dot (.) without /s flag does not match \n after a null byte
  const v = kv.join('=').replace(/\0.*/, '')
  // ... switches on k to populate set[k]

In addition to the .split('\n') framing defect, the vulnerable implementation contained three secondary parsing flaws inside parseKVLine:

  1. Multi-line Null-Byte Truncation Bypass: The sanitization regex .replace(/\0.*/, '') omitted the s (dotAll) regular expression flag. When a value contained both a null byte (\0) and a subsequent newline character, the . metacharacter stopped matching at the newline, leaving trailing characters after the newline attached to the resulting attribute string.
  2. Unchecked Numeric Conversions: While the size attribute checked SIMPLE_NUMBER.test(v.trim()) and Number.isSafeInteger(s), other numeric fields (gid, uid, dev, ino, nlink, mode) performed an unvalidated unary coercion (set[k] = +v), allowing NaN, negative numbers, floating-point values, or hexadecimal literals to populate numeric metadata fields.
  3. Leading-Zero Decimal Rejection: The regular expression SIMPLE_NUMBER = /^(?:0|[1-9]\d*)$/ rejected decimal numbers padded with leading zeros, whereas numeric header strings or generated PAX sizes can contain leading zero digits.

Commit f351e5b4a8916bc8c8f821d0ad926a17d26ea237 (and follow-up commit 64456aa724e64cfc153840698090ec7c80811dcc for the v8.0.0 release) replaced the line-splitting parser with a byte-offset state machine operating over a Buffer (and later raw Uint8Array slices):

// PATCHED CODE: src/pax.ts (commit f351e5b4a8916bc8c8f821d0ad926a17d26ea237)
const SIMPLE_NUMBER = /^\d+$/
 
const parseKV = (str: string) => {
  const set: Record<string, string | number | Date> = Object.create(null)
  const buf = Buffer.from(str)
  let pos = 0
  while (pos < buf.length) {
    let sp = pos
    // Scan ASCII digits (0x30 '0' through 0x39 '9') for the length prefix
    while (
      sp < buf.length &&
      (buf[sp] as number) >= 0x30 &&
      (buf[sp] as number) <= 0x39
    ) {
      sp++
    }
    // Require at least one digit followed immediately by an ASCII space (0x20)
    if (sp === pos || buf[sp] !== 0x20) break
    const n = Number(buf.toString('ascii', pos, sp))
    const end = pos + n
    // Ensure record bounds are valid and the final byte is a newline (0x0a)
    if (end <= sp + 1 || end > buf.length || buf[end - 1] !== 0x0a) break
    // Decode only the exact byte slice between the space and terminating newline
    parseKVLine(set, buf.toString('utf8', sp + 1, end - 1))
    pos = end
  }
  return set
}

> [!NOTE] > Assessment of Fix Completeness: The patched parser in f351e5b4a8916bc8c8f821d0ad926a17d26ea237 and the subsequent Uint8Array refactoring in 8.0.0 completely eliminate the framing ambiguity. By halting parsing (break) at the first record with a non-digit length prefix, out-of-bounds length, or missing terminal 0x0a byte, the parser prevents recovery or resynchronization onto attacker-aligned substrings inside malformed PAX blocks. Furthermore, adding the /s flag to .replace(/\0.*/s, ''), validating Date objects via !isNaN(d.getTime()), and unifying all integer attribute parsing (size, gid, uid, dev, ino, nlink, mode) behind SIMPLE_NUMBER and Number.isSafeInteger() closes variant injection paths.

Exploitation

Exploiting CVE-2026-140235 requires an attacker to deliver a crafted tar archive to an application or user workflow that extracts or inspects archives using node-tar versions 7.5.0 through 7.5.24. No authentication or elevated privileges are required beyond the ability to submit an archive file (such as an npm tarball, a plugin upload, or a backup archive).

The attack methodology relies on constructing a standard tar archive containing at least one PAX extended header block (typeflag = 'x' or 'g') followed by a file entry. Inside the PAX block, the attacker creates a benign attribute—such as comment or a custom vendor attribute—whose value contains a newline character (0x0A) followed by a validly framed PAX record string.

Consider a target file entry named carrier.txt containing attacker-controlled file content (DATA). The attacker prepends a PAX extended header containing a comment attribute with the value "x\n24 path=forged-name.txt". When serialized according to the POSIX PAX specification, the complete record is 38 bytes long:

38 comment=x
24 path=forged-name.txt
 

When a vulnerable version of node-tar processes this 38-byte PAX block:

  1. parseKV strips the final newline and splits the string on \n, producing two elements: "38 comment=x" (12 bytes) and "24 path=forged-name.txt" (23 bytes).
  2. parseKVLine evaluates "38 comment=x". It parses n = 38 and compares it against Buffer.byteLength("38 comment=x") + 1, which is 13. Because 38 !== 13, the function returns the accumulator set without recording the comment attribute.
  3. parseKVLine next evaluates "24 path=forged-name.txt". It parses n = 24 and checks Buffer.byteLength("24 path=forged-name.txt") + 1, which equals 24. The validation check succeeds.
  4. The prefix "24 " is stripped, and path=forged-name.txt is assigned to set['path'].
  5. When node-tar reads the subsequent USTAR header for carrier.txt, it merges the PAX header attributes over the USTAR header, replacing carrier.txt with forged-name.txt.
// Proof of Concept based on official regression test (test/parse-differential.test.ts)
import { Pax } from 'tar/dist/esm/pax.js'
 
// Encode a legitimate PAX block where 'path' contains an embedded newline
// and a secondary forged record targeting 'package.json'
const maliciousPathValue = 'é\n21 path=package.json\n'
const rawPaxBody = new Pax({ path: maliciousPathValue }).encodeBody()
 
// In node-tar >= 7.5.0 < 8.0.0:
// 1. The initial fragment containing 'é' fails the byte-length check and is dropped.
// 2. The trailing fragment '21 path=package.json' matches its 21-byte prefix.
// 3. Pax.parse(rawPaxBody).path evaluates to 'package.json' instead of the full string.
const parsed = Pax.parse(rawPaxBody)
console.log('Resolved extraction path:', parsed.path)

In a secondary exploitation scenario (Archive Desynchronization via size injection), an attacker injects a forged size attribute (for example, \n12 size=512\n or \n10 size=0\n). Because node-tar relies on the PAX size attribute to determine how many 512-byte data blocks belong to the current file entry before expecting the next USTAR header, modifying size causes the parser cursor to misalign with the actual archive structure. By hiding a full 512-byte USTAR header block inside the data stream of carrier.txt and forging size=0, the attacker forces node-tar to interpret the body of carrier.txt as a completely new tar entry.

Impact Assessment

CVE-2026-140235 is rated 7.2 (High) under the CVSS v4.0 specification (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). The score reflects a network-accessible attack vector (AV:N) with low attack complexity (AC:L), no attack requirements (AT:N), no required privileges (PR:N), passive user or pipeline interaction (UI:P), and high integrity impact to the vulnerable system (VI:H).

The primary security consequence is high integrity impact (VI:H) resulting from three distinct capabilities:

  • Arbitrary Intra-Directory File Overwrite: Even when node-tar operates under its default security configuration (which strips leading slashes and rejects .. path segments), forging the path attribute allows an archive entry to overwrite arbitrary files inside the destination extraction folder (such as replacing package.json, .bashrc, or application source files during package installation).
  • Validation & Security Scanner Bypass (Interpretation Conflict): Applications commonly inspect tar archives prior to extraction by scanning entry filenames or rejecting sensitive paths. If the inspection routine uses a standards-compliant tar parser (such as Python's tarfile, Go's archive/tar, BSD libarchive, or GNU tar), it will see only the benign outer filename (carrier.txt) and a harmless comment field. When the same archive is passed to node-tar for extraction, node-tar writes the file to the forged path.
  • Arbitrary Filesystem Write / Directory Traversal: If the consuming application extracts archives with preservePaths: true, node-tar disables path confinement checks. An attacker can inject an absolute path (such as 28 path=/etc/cron.d/payload\n) or relative traversal sequences (../../) to overwrite sensitive files anywhere on the filesystem accessible to the Node.js process.

Beyond file path manipulation, attackers can forge the linkpath attribute to redirect symbolic or hard links, or forge mode, uid, and gid attributes to alter file permissions (such as setting executable or setuid bits). Forging the size attribute impacts availability (VA:L) and confidentiality (VC:L) by desynchronizing block boundaries, causing premature extraction termination or splicing adjacent header blocks into extracted file contents.

As of the publication date, CVE-2026-140235 is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, and no active in-the-wild exploitation campaigns have been recorded.

Remediation

The vulnerability is resolved in node-tar version 8.0.0. Development teams and system administrators should update their tar dependency to 8.0.0 or later immediately.

npm install tar@^8.0.0

For projects where node-tar is pulled in as a transitive dependency (for example, via build tools or custom CLI utilities), administrators can enforce version resolution using the overrides field in package.json (for npm) or resolutions (for Yarn):

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

> [!WARNING] > Note that node-tar v8.0.0 is a major version release that includes architectural updates to buffer handling (Uint8Array processing). Thoroughly test archive creation and extraction workflows after applying transitive dependency overrides.

In environments where an immediate upgrade to 8.0.0 is blocked by version compatibility constraints, organizations should implement the following compensating controls:

  1. Enforce Default Path Confinement: Audit all extraction calls (tar.x, tar.extract, new tar.Unpack) to ensure preservePaths is strictly set to false (or omitted, as false is the default). This prevents forged path attributes from escaping the designated extraction directory via ../ or absolute paths.
  2. Filter PAX Extended Header Entries: Use the filter or onReadEntry callback option in node-tar to inspect incoming entries or reject archives containing newline characters inside parsed metadata fields. Note, however, that onReadEntry executes after Pax.parse has already processed the extended header block.
  3. Pre-Validate Archives with a Compliant Parser: Before passing untrusted archives to node-tar 7.5.x, inspect the raw archive stream or re-pack the archive using system tar (GNU tar or bsdtar), stripping extended headers or rejecting archives whose PAX header blocks (typeflag 0x78 'x' or 0x67 'g') contain multiple newline characters within a single length-delimited record.

Official Patches

GitHub (isaacs/node-tar)Official GitHub Security Advisory GHSA-rgjp-p5j7-w36x
GitHub (isaacs/node-tar)Primary patch commit fixing PAX extended header byte-length framing
GitHub (isaacs/node-tar)node-tar v8.0.0 release notes and distribution

Fix Analysis (1)

Technical Appendix

CVSS Score
7.2/ 10
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 Systems

node-tar (npm package: tar) >= 7.5.0, < 8.0.0

Affected Versions Detail

Product
Affected Versions
Fixed Version
tar (node-tar)
isaacs
>= 7.5.0, < 8.0.0 (7.5.0 through 7.5.24)8.0.0
AttributeDetail
CVE / Advisory IDCVE-2026-140235 / GHSA-rgjp-p5j7-w36x
Affected Packagenpm:tar (node-tar) >= 7.5.0, < 8.0.0
Patched Version8.0.0
Weakness ClassCWE-20 (Improper Input Validation) / CWE-436 (Interpretation Conflict)
CVSS v4.0 Score7.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)
Attack VectorNetwork (Untrusted Tar Archive Ingestion)
Primary ImpactPAX Record Dropping, Forged Attribute Injection (path, size, linkpath, mode), Arbitrary File Overwrite
Exploit / KEV StatusPoC Available (Unit Test Fixtures) / Not in CISA KEV

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
CWE-20
Improper Input Validation

The product receives input or data, but does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.

Known Exploits & Detection

GitHubOfficial patch commit containing regression test cases demonstrating PAX record dropping and forged-field injection via embedded newlines.

Vulnerability Timeline

Fix commit f351e5b4a8916bc8c8f821d0ad926a17d26ea237 authored and committed to isaacs/node-tar
2026-11-27
GitHub Security Advisory GHSA-rgjp-p5j7-w36x and CVE-2026-140235 published
2026-12-01
National Vulnerability Database (NVD) published official analysis for CVE-2026-140235
2026-12-01

References & Sources

  • [1]GitHub Security Advisory GHSA-rgjp-p5j7-w36x
  • [2]GitHub Fix Commit f351e5b4a8916bc8c8f821d0ad926a17d26ea237
  • [3]node-tar v8.0.0 Release
  • [4]Official CVE.org Record for CVE-2026-140235
  • [5]National Vulnerability Database (NVD) - CVE-2026-140235
  • [6]CVEProject cvelistV5 Record: CVE-2026-140235.json
  • [7]CWE-20: Improper Input Validation
  • [8]CWE-436: Interpretation Conflict

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-140236
7.2

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

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.

Amit Schendel
Amit Schendel
3 views•12 min read
•about 3 hours ago•CVE-2026-140234
7.1

CVE-2026-140234: Null Byte Truncation Bypass in node-tar Leading to Denial of Service and Path Differential

CVE-2026-140234 (GHSA-wpwg-r92p-fjjh) is an improper null byte neutralization vulnerability (CWE-158) in node-tar versions prior to 8.0.0. The regular expression used to truncate null-terminated header strings omits the dotAll (s) flag, causing truncation to halt prematurely when a null byte is followed by a line terminator. This defect allows embedded null bytes and trailing characters to persist in parsed file and link paths, resulting in asynchronous Node.js process crashes via native filesystem validation errors and path differentials against compliant TAR implementations.

Alon Barad
Alon Barad
2 views•11 min read
•about 4 hours ago•CVE-2026-140248
7.2

CVE-2026-140248: Symlink Target Path Traversal and Arbitrary File Access in node-tar

CVE-2026-140248 is a High-severity path traversal and symbolic link resolution vulnerability (CWE-59) in the npm package tar (node-tar) affecting versions 7.5.22 through 7.5.24. When extracting archives under default security configurations (preservePaths: false), node-tar validates symbolic link targets using purely lexical path normalization via path.posix functions without accounting for intermediate symbolic link resolution on the host filesystem. By crafting an archive containing chained symbolic links, paths ending in trailing '/.' segments, or POSIX directory names containing backslashes, an attacker can plant a symbolic link inside the extraction directory that resolves to arbitrary locations outside the destination root. Downstream processes reading or writing through the extracted symlink can consequently disclose or overwrite arbitrary files on the host system.

Alon Barad
Alon Barad
5 views•14 min read
•about 5 hours ago•CVE-2026-141536
3.7

CVE-2026-141536: HTTP Request Splitting and CRLF Injection in Ruby Addressable Gem

A CRLF injection and HTTP request splitting vulnerability exists in the Ruby addressable gem from version 2.1.2 prior to 2.10.0. The Addressable::URI#request_uri method returns stored control characters and spaces without percent-encoding them. When an HTTP client writes the output of #request_uri directly into an HTTP request line without additional validation or normalization, an attacker supplying an untrusted URI can terminate the request line prematurely, inject arbitrary HTTP headers, or initiate a secondary HTTP request over a keep-alive connection.

Amit Schendel
Amit Schendel
5 views•9 min read
•about 6 hours ago•CVE-2026-141530
3.1

CVE-2026-141530: Domain Spoofing via Missing Bidirectional Validation in Ruby Addressable Pure IDNA Implementation

CVE-2026-141530 is a user interface misrepresentation vulnerability in the pure-Ruby Internationalized Domain Names in Applications (IDNA) implementation of the Addressable gem (versions 2.0.0 through 2.9.2). The library omits enforcement of the RFC 3454 Section 6 bidirectional rule when converting between Punycode A-labels and Unicode U-labels. Consequently, calling Addressable::IDNA.to_unicode or Addressable::URI#display_uri decodes malformed Punycode labels containing mixed directional categories and trailing digits. When rendered in a standard left-to-right display context, the Unicode Bidirectional Algorithm visually reorders digits across domain label separators, enabling an attacker controlling a complementary domain to spoof a target hostname.

Alon Barad
Alon Barad
5 views•10 min read
•about 7 hours ago•CVE-2026-123746
2.3

CVE-2026-123746: Authentication Bypass in Symfony Security HTTP Programmatic Logins

An authentication bypass vulnerability in the Symfony Security HTTP component (symfony/security-http) causes programmatic login operations to skip the checkPostAuth() method of configured user checkers. Because AuthenticatorManager::authenticateUser() fails to dispatch the security.authentication.success event, custom post-authentication restrictions—such as checks for expired or locked accounts—are bypassed when users authenticate via programmatic flows like password resets or email verification callbacks.

Alon Barad
Alon Barad
4 views•10 min read