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

CVE-2026-140250: Symlink Containment Bypass and Path Traversal in node-tar

Amit Schendel
Amit Schendel
Senior Security Researcher

Dec 2, 2026·12 min read·1 visit

Executive Summary (TL;DR)

A regression in node-tar versions 7.5.5 through 7.5.24 allows crafted tar archives with chained symbolic links and relative traversal paths to bypass extraction sandbox checks, creating symlinks that point outside the target extraction directory.

CVE-2026-140250 (GHSA-3wwj-8j6r-q339) is a high-severity symbolic link containment bypass and path traversal vulnerability in node-tar (npm package 'tar'), affecting versions 7.5.5 through 7.5.24. When extracting archives using default options, the Unpack class validates symbolic link targets using purely lexical path normalization. An attacker can supply a crafted archive containing chained symbolic links combined with directory traversal segments ('..') to create symbolic links that resolve outside the designated extraction directory. If the host application subsequently follows the created link, it can lead to arbitrary file disclosure or modification within the application's privilege context.

Vulnerability Overview

node-tar (published to the npm registry as tar) is the standard archive extraction and manipulation library for the Node.js ecosystem. It is widely deployed in package managers, continuous integration pipelines, build systems, and web applications to unpack user-supplied or remotely fetched .tar and .tgz archives. By design, node-tar enforces extraction sandboxing by default: when tar.x() is invoked, the library sanitizes archive entry paths and validates symbolic link targets to ensure no extracted artifact resolves outside the designated working directory (cwd).

CVE-2026-140250 (tracked as GitHub Security Advisory GHSA-3wwj-8j6r-q339) is a symlink containment bypass vulnerability classified under CWE-59 (Improper Link Resolution Before File Access) and CWE-22 (Improper Limitation of a Pathname to a Restricted Directory). The vulnerability is a regression introduced in version 7.5.5 via commit 26ab90474e642cf00d84a05bcdc2eaf2a19f1581 and affects all releases in the 7.5.x branch up to 7.5.24. It allows an unauthenticated attacker supplying a crafted archive to create symbolic links inside the extraction directory that resolve to arbitrary locations on the host file system.

The flaw stems from a discrepancy between how node-tar validates link targets in memory and how the operating system kernel resolves symbolic links on disk. While node-tar prevents direct relative traversal (such as a symlink target starting with enough ../ segments to escape cwd), it fails to account for chained symbolic links where a named directory component in the target path is itself a symbolic link pointing to an ancestor directory.

> [!IMPORTANT] > While node-tar itself does not follow extracted symbolic links to overwrite outside files during the same archive extraction pass, it leaves the escaping symbolic link on the filesystem. Any post-extraction logic in the host application that reads from or writes through the unpacked file tree will traverse the escaping symlink with the effective permissions of the Node.js process.

Root Cause Analysis

During archive unpacking, the Unpack class in src/unpack.ts executes the [STRIPABSOLUTEPATH] method to sanitize both the entry's destination path (entry.path) and, for symbolic or hard links, its target path (entry.linkpath). In vulnerable versions (7.5.5 through 7.5.24), node-tar verified that a linkpath remained inside the extraction root by joining the entry's parent directory (entryDir) with the link target and passing the combined string to path.posix.normalize().

The root cause of CVE-2026-140250 is the reliance on purely lexical string normalization (path.posix.normalize) to simulate filesystem path resolution. In POSIX path normalization, a sequence of <segment>/.. is collapsed and removed based solely on string structure, operating under the implicit assumption that <segment> is a physical directory. However, when the operating system kernel resolves a path on an actual filesystem, it evaluates each path component sequentially. If <segment> is a symbolic link, the kernel resolves <segment> to its target directory first, and then applies the .. parent traversal relative to that resolved target.

Because path.posix.normalize collapses s1/.. into an empty string, a link target of s1/../outside.txt normalizes to outside.txt. The containment check verifies whether the normalized string equals .. or begins with ../. Seeing outside.txt, the check concludes the target resides safely at the root of the extraction directory and permits node-tar to write the symlink to disk. When s1 is an earlier (or later) archive entry configured as a symlink pointing to . or .., subsequent filesystem operations on esc follow s1 and then evaluate .., ascending outside the extraction directory.

In addition to chained symlinks where .. follows a named path segment, the vulnerability encompasses two related lexical mismatches in src/unpack.ts:

  1. Unnormalized Entry Path Depth Skew: The calculation const entryDir = path.posix.dirname(entry.path) occurred before entry.path was normalized. If an archive contained a symlink entry with a trailing dot segment, such as esc/. or esc/./, path.posix.dirname('esc/.') returned 'esc'. This caused node-tar to believe the symlink was being created one directory level deeper than its actual on-disk location (.), allowing an extra ../ segment in linkpath without triggering the boundary warning.
  2. POSIX Backslash Handling: When splitting linkpath into segments, backslashes were treated inconsistently relative to POSIX directory naming rules. An archive creating a directory named A\B (a valid single directory name on POSIX systems) paired with a symlink targeting A\B/../../outside.txt caused discrepancy between segment counting and kernel resolution.

Code Analysis

The vulnerability resides in the Unpack class within src/unpack.ts. Prior to version 8.0.0, the target containment check inside [STRIPABSOLUTEPATH] computed the relative depth of linkpath using unnormalized directory lookups and allowed .. segments to appear anywhere within the target path string:

// Vulnerable code in src/unpack.ts (v7.5.5 - v7.5.24)
// Resolve linkpath relative to the entry's directory.
// `path.posix` is safe to use because we're operating on
// tar paths, not a filesystem.
const entryDir = path.posix.dirname(entry.path)
const resolved = path.posix.normalize(
  path.posix.join(entryDir, parts.join('/')),
)
if (resolved.startsWith('../') || resolved === '..') {
  this.warn(
    'TAR_ENTRY_ERROR',
    `${field} escapes extraction directory`,
    { entry, [field]: p },
  )
  return false
}

In commit 23b368128b6cf7d4c26f2e302c0e4a82f70a6e3d, the maintainer addressed all three bypass vectors by enforcing two new invariants before checking the normalized target path:

File: src/unpack.ts
@@ -279,7 +279,23 @@ export class Unpack extends Parser {
       // Resolve linkpath relative to the entry's directory.
       // `path.posix` is safe to use because we're operating on
       // tar paths, not a filesystem.
-      const entryDir = path.posix.dirname(entry.path)
+      // A '..' is only safe at the start of the target. Any named
+      // part before it can be a symlink, and then the '..' goes to
+      // the parent of that symlink's target.
+      const firstName = parts.findIndex(
+        part => part !== '..' && part !== '.' && part !== '',
+      )
+      if (firstName !== -1 && parts.includes('..', firstName)) {
+        this.warn(
+          'TAR_ENTRY_ERROR',
+          `${field} contains '..' after a path portion`,
+          { entry, [field]: p },
+        )
+        return false
+      }
+      // Normalize the path, so that the directory is the one where
+      // the link is created. The path 'x/.' creates the link 'x'.
+      const entryDir = path.posix.dirname(path.posix.normalize(entry.path))
       const resolved = path.posix.normalize(
         path.posix.join(entryDir, parts.join('/')),
       )

First, the patch scans the split parts array of the link target to locate the index of the first named component (firstName)—defined as any segment other than .., ., or an empty string. It then checks if any .. segment appears at or after firstName using parts.includes('..', firstName). If a .. segment follows a named component, node-tar immediately emits a TAR_ENTRY_ERROR warning (linkpath contains '..' after a path portion) and rejects the entry. This invariant guarantees that relative parent traversals (..) are only permitted as leading prefixes of a symlink target, where their traversal depth can be deterministically bounded against entryDir without depending on what any intermediate directory name resolves to on disk.

Second, the patch wraps entry.path in path.posix.normalize() prior to calling path.posix.dirname(). For an entry path such as esc/. or a/esc/./, path.posix.normalize() strips the trailing dot component first (yielding esc or a/esc), ensuring path.posix.dirname() returns the exact directory depth (. or a) where the symbolic link will reside on the filesystem.

Fix Completeness Assessment

The fix in commit 23b368128b6cf7d4c26f2e302c0e4a82f70a6e3d is robust against lexical symlink chaining. By forbidding .. after any named path segment in linkpath, node-tar eliminates the possibility of a named component acting as a symlink pivot prior to an upward traversal. Furthermore, normalizing entry.path before computing entryDir ensures the starting depth calculation matches the actual creation path. One trade-off is that legitimate archives containing redundant non-escaping internal traversals in symlinks (e.g., dir/subdir/../file.txt where subdir is a normal directory) will now be rejected during default extraction unless preservePaths: true is explicitly configured.

Exploitation Methodology

Exploiting CVE-2026-140250 requires an application to extract an untrusted tar archive using tar.x() (or tar.extract()) with default security settings (preservePaths left as false, and no custom filter rejecting symbolic links). No special privileges or race conditions are required; the bypass is deterministic and relies strictly on archive header crafting.

An attacker can construct a minimal malicious archive using two symbolic link headers (type: '2' in USTAR format). The order of the entries inside the archive does not matter because the validation flaw occurs during lexical inspection of the individual header, and the kernel only resolves the symlink chain when the application accesses the link post-extraction:

  1. Pivot Symlink (s1): Created at the root of the extraction directory (path: 's1'), pointing to the extraction root itself (linkpath: '.'), or created inside a subdirectory (path: 'x/y') pointing up (linkpath: '..').
  2. Escaping Symlink (esc): Created at the root of the extraction directory (path: 'esc'), with a target that traverses through the pivot symlink followed by .. segments (linkpath: 's1/../outside.txt' or linkpath: 's1/../../../etc/passwd').

Alternatively, using the trailing-dot sub-variant, an attacker only needs a single archive entry without any pivot symlink:

  1. Single-Entry Depth Skew (esc/.): A symbolic link header with path: 'esc/.' and linkpath: '../outside.txt'. When node-tar evaluates path.posix.dirname('esc/.'), it computes entryDir as 'esc'. Joining 'esc' with '../outside.txt' normalizes to 'outside.txt', passing the check. When the OS creates the symlink at 'esc/.' (which resolves to 'esc' in the root of cwd), its target '../outside.txt' points one level above cwd.

The upstream test suite in test/symlink-linkpath-escape.test.ts documents the seven distinct payload structures that bypass versions 7.5.5 through 7.5.24:

const escapes: Record<string, [HeaderData[], string]> = {
  "'..' after an earlier symlink": [
    [link('s1', '.'), link('esc', 's1/../outside.txt')],
    "linkpath contains '..' after a path portion",
  ],
  "'..' after a later symlink": [
    [link('esc', 'x/y/../outside.txt'), dir('x'), link('x/y', '..')],
    "linkpath contains '..' after a path portion",
  ],
  "'..' after a nested symlink": [
    [dir('a'), link('a/b', '../x'), link('a/esc', 'b/../../outside.txt')],
    "linkpath contains '..' after a path portion",
  ],
  "entry path that ends in '/.'": [
    [link('esc/.', '../outside.txt')],
    'linkpath escapes extraction directory',
  ],
  "entry path that ends in '/./'": [
    [link('esc/./', '../outside.txt')],
    'linkpath escapes extraction directory',
  ],
  "nested entry path that ends in '/.'": [
    [dir('a'), link('a/esc/.', '../../outside.txt')],
    'linkpath escapes extraction directory',
  ],
  'backslash in a directory name': [
    [dir('A\\B'), link('esc', 'A\\B/../../outside.txt')],
    "linkpath contains '..' after a path portion",
  ],
}

Once extraction completes, /path/to/cwd/esc exists on the filesystem pointing outside /path/to/cwd/. If the application performs post-extraction processing—such as serving extracted static files over HTTP, reading configuration files from the unpacked archive, or writing build artifacts into the extracted directory tree—the application will read or overwrite arbitrary files on the host filesystem.

Impact Assessment

CVE-2026-140250 is assigned a CVSS v4.0 base score of 7.2 (High) with the vector string 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 attack vector is Network (AV:N) with Low attack complexity (AC:L), no attack requirements (AT:N), and no privileges required (PR:N), reflecting common deployment patterns where web services or automated pipelines ingest archives from untrusted users. User interaction is scored as Passive (UI:P) because the host application or user must unpack the archive and interact with the extracted contents.

The primary security impact depends on how the consuming application interacts with the extraction directory after tar.x() finishes:

  • High Integrity Impact (VI:H): If an application extracts an archive to a working workspace and subsequently writes data, compiles files, or modifies permissions across the unpacked files without checking fs.lstat() / fs.realpath(), writing to the escaping symbolic link will overwrite arbitrary files outside the workspace with the permissions of the Node.js process. In many environments, overwriting application source files, .bashrc, or authorized SSH keys escalates directly to remote code execution.
  • Confidentiality Impact (VC:L): If the application packs, indexes, or serves the extracted files back to the user (for example, a cloud build service publishing build artifacts or a web server hosting unpacked templates), the attacker can read sensitive host files such as /etc/passwd, /proc/self/environ, or application secrets.
  • Availability Impact (VA:L): Corrupting critical application state or configuration files via symlink writes can cause service disruption.

According to FIRST.org Exploit Prediction Scoring System (EPSS) metrics, CVE-2026-140250 holds an EPSS score of 0.00917 (61.31st percentile). While it is not currently listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, public proof-of-concept testing harnesses (googlesky/CVE-2026-140250) and full reproduction test cases in the upstream repository make exploitation straightforward against vulnerable deployments.

Remediation & Mitigation

The vulnerability is fixed in node-tar version 8.0.0 via commit 23b368128b6cf7d4c26f2e302c0e4a82f70a6e3d. Engineering teams should upgrade the tar package dependency to >= 8.0.0:

npm install tar@^8.0.0

> [!WARNING] > Version 8.0.0 introduces breaking architectural changes to node-tar. It drops support for Node.js versions prior to Node.js 22, replaces legacy Minipass stream interfaces with standard Promises and Web Streams, and tightens file mode stripping. Applications running on older Node.js runtimes (such as Node.js 18 or 20) cannot upgrade directly to v8.0.0 without upgrading their runtime or backporting the fix.

Workarounds for Legacy Environments (v7.5.5 – v7.5.24)

If immediate migration to tar@8.0.0 is blocked by runtime requirements or API incompatibilities, implement a custom filter callback in all tar.x() / tar.extract() invocations.

If the application does not require symbolic links or hard links in extracted archives, reject all link entry types outright:

const tar = require('tar');
 
await tar.x({
  file: 'untrusted-archive.tar',
  cwd: extractionDir,
  filter: (entryPath, entry) => {
    if (entry.type === 'SymbolicLink' || entry.type === 'Link') {
      return false;
    }
    return true;
  }
});

If symbolic links must be supported within the archive, replicate the v8.0.0 containment logic inside the filter function and verify post-extraction paths using fs.realpathSync() before accessing extracted files:

const path = require('node:path');
const tar = require('tar');
 
await tar.x({
  file: 'untrusted-archive.tar',
  cwd: extractionDir,
  filter: (entryPath, entry) => {
    // Reject entry paths ending in '.' or './' that skew dirname depth
    const rawParts = entryPath.split(/[\/\\]/);
    if (rawParts.includes('.') || rawParts.includes('..')) {
      return false;
    }
    if (entry.type === 'SymbolicLink' || entry.type === 'Link') {
      const linkParts = entry.linkpath.split(/[\/\\]/);
      const firstName = linkParts.findIndex(
        p => p !== '..' && p !== '.' && p !== ''
      );
      // Reject '..' appearing after any named path segment
      if (firstName !== -1 && linkParts.includes('..', firstName)) {
        return false;
      }
      const normEntryDir = path.posix.dirname(path.posix.normalize(entryPath));
      const resolved = path.posix.normalize(
        path.posix.join(normEntryDir, linkParts.join('/'))
      );
      if (resolved.startsWith('../') || resolved === '..' || path.posix.isAbsolute(resolved)) {
        return false;
      }
    }
    return true;
  }
});

Official Patches

GitHub / isaacsOfficial GitHub Security Advisory GHSA-3wwj-8j6r-q339 for node-tar
GitHub / isaacsGit commit 23b368128b6cf7d4c26f2e302c0e4a82f70a6e3d patching src/unpack.ts
GitHub / isaacsnode-tar v8.0.0 release notes

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
EPSS Probability
0.92%
Top 39% most exploited

Affected Systems

node-tar (npm package 'tar') versions 7.5.5 through 7.5.24

Affected Versions Detail

Product
Affected Versions
Fixed Version
tar (node-tar)
isaacs
>= 7.5.5, <= 7.5.248.0.0
AttributeDetail
Vulnerability TypeCWE-59: Improper Link Resolution Before File Access / CWE-22: Path Traversal
Affected Componentnode-tar (npm: tar) Unpack.[STRIPABSOLUTEPATH] in src/unpack.ts
Vulnerable Versions>= 7.5.5, <= 7.5.24 (Fixed in 8.0.0)
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)
EPSS Score0.92% (61.31st Percentile)
ImpactSymlink sandbox escape leading to arbitrary file read or modification if followed by the host application
Exploit StatusProof-of-Concept (PoC) Publicly Available
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1083File and Directory Discovery
Discovery
T1005Data from Local System
Collection
CWE-59
Improper Link Resolution Before File Access ('Link Following')

The software attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource outside the intended extraction boundary.

Known Exploits & Detection

GitHubPublic differential proof-of-concept and verification script testing symlink containment bypass vectors.

Vulnerability Timeline

Upstream maintainer commits fix (23b368128b6cf7d4c26f2e302c0e4a82f70a6e3d) rejecting symlink targets that can leave cwd.
2026-11-27
GitHub Security Advisory GHSA-3wwj-8j6r-q339 and CVE-2026-140250 published; node-tar v8.0.0 released on npm.
2026-12-01
FIRST.org assigns initial EPSS score and public verification scripts are released.
2026-12-02

References & Sources

  • [1]CVE-2026-140250 Official CVE Record
  • [2]NVD Vulnerability Detail: CVE-2026-140250
  • [3]GitHub Security Advisory GHSA-3wwj-8j6r-q339
  • [4]GitHub Fix Commit: unpack: reject symlink targets that can leave the cwd
  • [5]node-tar v8.0.0 Release Notes
  • [6]CVEProject CVE-2026-140250 JSON Record
  • [7]Public PoC and Verification Repository for CVE-2026-140250

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

CVE-2026-140249: Path Traversal via Lexical Symlink Normalization in node-tar

CVE-2026-140249 (also tracked as GHSA-4pf9-5fpx-xmr6) is a path traversal and improper link resolution vulnerability in node-tar, the core tar archive manipulation library for Node.js. Affecting versions 7.5.5 through 7.5.24, the flaw resides in the symbolic link path validation routine executed during archive extraction via tar.x(). Because the library validates link targets using purely lexical string manipulation rather than filesystem-aware path resolution, an attacker can craft an archive containing chained symlinks or unnormalized path suffixes that bypass traversal checks. Although node-tar does not directly write archive payloads through escaping symlinks during the extraction phase, it allows the creation of symlinks inside the extraction directory that resolve to arbitrary locations on the host filesystem. Any subsequent read or write operation performed by the host application on the extracted directory tree follows these symlinks, leading to arbitrary file disclosure or overwrite within the privilege context of the Node.js process.

Alon Barad
Alon Barad
4 views•13 min read
•about 2 hours ago•CVE-2026-140247
7.2

CVE-2026-140247: Lexical Path Validation Bypass and Symlink Escape in node-tar

CVE-2026-140247 (GHSA-gvrf-jx37-rjv5) is a high-severity path traversal and link resolution vulnerability in the npm tar package (node-tar) prior to version 8.0.0. The library validates symbolic link targets lexically rather than against the physical filesystem hierarchy, allowing specially crafted archives to create symlinks inside the extraction directory that resolve to arbitrary locations outside the extraction root.

Amit Schendel
Amit Schendel
6 views•11 min read
•about 3 hours ago•CVE-2026-140246
7.2

CVE-2026-140246: Symbolic Link Path Traversal via Backslash Separator Differential in node-tar

CVE-2026-140246 (GHSA-hqgx-p3r3-2cfg) is a path traversal and link-following vulnerability in the node-tar (tar) npm package prior to version 8.0.0. The defect stems from a semantic discrepancy in how backslash characters are processed during lexical path validation versus how they are resolved by POSIX filesystem kernels. By combining a directory containing a literal backslash with a symbolic link utilizing relative parent traversal sequences, an attacker can construct a tar archive that bypasses extraction containment checks and points to arbitrary files outside the target root directory on non-Windows hosts.

Amit Schendel
Amit Schendel
5 views•13 min read
•about 4 hours ago•CVE-2026-140245
7.2

CVE-2026-140245: Symlink Linkpath Containment Bypass via Trailing Dot Segments in node-tar

CVE-2026-140245 (GHSA-jmj2-9c5q-vw73) is a path traversal vulnerability (CWE-22) affecting versions 7.5.5 through 7.5.24 of the node-tar (tar) archive manipulation library for Node.js. A discrepancy between path evaluation during symlink containment validation and actual filesystem placement allows archives containing symbolic link entries with trailing dot segments (such as '/.' or '/./') to bypass directory boundary checks. When extracted under default configurations, these crafted entries create symbolic links pointing outside the designated extraction directory (cwd), establishing a primitive for arbitrary file overwrite or creation during subsequent extraction steps.

Alon Barad
Alon Barad
6 views•10 min read
•about 5 hours 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
6 views•13 min read
•about 6 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
7 views•11 min read