/

CVE-2026-24842

Severity:

HIGH RISK

(8.2)

Path Traversal in Archive Extraction in node-tar Archive

CVE-2026-24842

Modified

Vulnerability type

Category:

Path Traversal in Archive Extraction

CWE:

CWE-22, CWE-59

Impact:

Arbitrary File System Access via Hardlink Creation

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

node-tar, a TAR processing library for Node.js, contains a vulnerability where hardlink path validation uses different path resolution semantics than the logic that actually creates the hardlink.

An attacker can craft a malicious TAR archive that bypasses the intended path traversal protections and creates hardlinks to arbitrary files outside the extraction directory, potentially exposing or modifying sensitive files on the host system.

Affected context

This vulnerability affects applications that:

  • Use node-tar in versions prior to 7.5.7
  • Allow processing of TAR archives from untrusted or semi-trusted sources
  • Extract archives onto a filesystem where sensitive files are reachable via the node-tar process' privileges

The issue is specifically triggered when archives contain hardlink entries whose paths are validated differently from the paths ultimately used during hardlink creation, enabling traversal outside the designated extraction directory under certain path layouts.

Exploit preconditions

  • Attack surface: Any service, CLI tool, or background job that accepts TAR input and extracts it using vulnerable versions of node-tar.
  • Required access: Ability to supply or influence the TAR archive being processed (e.g., file upload, package ingestion, CI artifacts, backup/restore flows).
  • Trigger point: Extraction of a crafted TAR containing hardlink entries with paths designed to bypass validation.
  • Why exploitation is possible: The security check and the actual hardlink creation routine rely on different path resolution semantics. A path that appears safe to the validator can resolve to a different, potentially external, location when the hardlink is created, enabling path traversal via hardlinks.

Why this happens

The core issue stems from inconsistent path normalization and resolution between the security check and the hardlink creation logic.

While node-tar attempts to prevent path traversal by validating hardlink targets, it uses a different interpretation of paths than the code that ultimately creates the hardlinks.

This divergence leads to a classic CWE-22: Improper Limitation of a Pathname to a Restricted Directory scenario, combined with CWE-59: Improper Link Resolution Before File Access ('Link Following'), where link-based file operations are not subject to the same constraints as the validation step.

Abstractly, the pattern is: validate a path (or link target) using one normalization/semantics, then perform file system operations with another, leaving a gap that attacker-controlled paths can exploit.

Potential impact

  • Creation of hardlinks pointing to files outside the intended extraction directory
  • Indirect read access to sensitive files via hardlinks exposed in application-controlled directories
  • Facilitation of data modification or corruption when linked files are writable by the process
  • Escalation of impact in combination with other vulnerabilities (e.g., if subsequent code operates on all extracted files with elevated trust)
  • Potential interference with security or configuration files depending on deployment layout and permissions

General mitigation guidance

Effective mitigation focuses on aligning validation with actual filesystem behavior and tightening trust boundaries around archive extraction:

  • Ensure that any path validation uses the same canonicalization and resolution logic as the final filesystem operation, including handling of .., symlinks, hardlinks, and platform-specific path rules.
  • Treat all paths within archives as untrusted; enforce a strict policy that all resolved paths must remain under a designated extraction root after full resolution.
  • Consider disabling or rejecting hardlink (and optionally symlink) entries from untrusted archives, or only allowing them when they resolve to already-validated locations within the extraction directory.
  • Run archive extraction with least-privilege accounts that have limited access to sensitive directories and files, reducing blast radius if traversal occurs.
  • Isolate extraction into dedicated, minimal, and disposable directories, and avoid extracting directly into locations that contain application binaries, configuration, or secrets.

How teams detect issues like this

Detection typically combines code-level review with behavioral monitoring:

  • Static analysis / code review: Look for uses of node-tar where:
  • Archive contents originate from user-controlled or external sources.
  • Hardlink and symlink entries are not explicitly restricted, filtered, or normalized.
  • Custom validation or path-joining logic exists and may differ from the underlying filesystem operations.
  • Security testing: Perform archive extraction tests with malicious TAR files containing:
  • Hardlink paths using ../ sequences or mixed absolute/relative references.
  • Platform-specific path constructs intended to escape the extraction directory.
  • Runtime monitoring: Use audit logs or filesystem monitoring to detect creation of links or files outside the expected extraction root during archive processing.
  • Automated SAST or dependency review tools can be configured to flag the use of vulnerable archive libraries and highlight untrusted archive extraction flows.

Sources

SourceLink
github.comgithub.com/isaacs/node-tar/commit/f4a7aa9bc3d717c987fdf1480ff7a64e87ffdb46
github.comgithub.com/isaacs/node-tar/security/advisories/GHSA-34x7-hfp2-rc4v
access.redhat.comaccess.redhat.com/errata/RHSA-2026:18480
access.redhat.comaccess.redhat.com/errata/RHSA-2026:18868
access.redhat.comaccess.redhat.com/errata/RHSA-2026:2900
access.redhat.comaccess.redhat.com/errata/RHSA-2026:33371
access.redhat.comaccess.redhat.com/errata/RHSA-2026:5447
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6192
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-24842
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2433645
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-24842.json

Frequently asked

questions

It can be, if a service exposes an interface (such as file upload, package ingestion, or backup restore) where an attacker can provide a TAR archive that is automatically extracted using node-tar. In such cases, exploitation does not require local access.

The attacker must be able to control or significantly influence the TAR archive that is being processed. No shell access is required; control over the archive contents is sufficient when the vulnerable extraction path is invoked.

The safest pattern is to ensure that all resolved paths (after full normalization and link handling) are validated against a strict extraction root before any filesystem operation, and to either block or heavily constrain hardlink and symlink handling. Additionally, use updated archive libraries that enforce consistent validation and extraction semantics.

Adopt a defensive design for archive handling: treat all archive entries as untrusted, enforce extraction into isolated directories, avoid trusting paths provided by archives, and keep path validation and file operations tightly coupled. Combine these practices with regular dependency maintenance, security testing with crafted archives, and policy checks in CI to prevent regressions.

Find out what's already
exploitable in your codebase.