Back to Blog
critical SEVERITY6 min read

Critical Path Traversal Fix: How node-tar Hardlink Vulnerability Was Patched

A medium-severity path traversal vulnerability (CVE-2026-24842) in node-tar allowed attackers to create arbitrary files by bypassing hardlink security checks. This vulnerability could enable malicious actors to overwrite critical system files or inject malicious code during tar archive extraction. The recent security patch addresses this exploit vector, protecting applications that process untrusted tar archives.

O
By Orbis AppSec
•Technically reviewed by Anupam Mediratta•Published March 6, 2026•Reviewed June 3, 2026

Answer Summary

CVE-2026-24842 is a path traversal vulnerability in node-tar (JavaScript/Node.js, CWE-59: Improper Link Resolution Before File Access) that bypassed hardlink security checks during tar extraction. Attackers could create arbitrary files by crafting malicious tar archives with specially-constructed hardlinks. The fix adds rigorous validation of hardlink targets to ensure they don't escape the extraction directory, preventing file system traversal attacks.

Vulnerability at a Glance

cweCWE-59 (Improper Link Resolution Before File Access)
fixImplement strict hardlink target validation and resolution checks before file creation
riskArbitrary file creation, system file overwrite, code injection during untrusted archive extraction
languageJavaScript (Node.js)
root causeInsufficient validation of hardlink targets allowed symlink/hardlink resolution to escape extraction directory boundaries
vulnerabilityPath Traversal via Hardlink Bypass in Tar Extraction

Introduction

Package managers and archive utilities are the backbone of modern software development, but they can also be vectors for serious security vulnerabilities. The recently patched CVE-2026-24842 in node-tar demonstrates how a subtle bypass in security checks can expose applications to path traversal attacks—one of the most dangerous vulnerability classes in file handling operations.

If your Node.js application extracts tar archives (especially from untrusted sources), this vulnerability could have allowed attackers to write files anywhere on your filesystem, potentially leading to remote code execution, data theft, or system compromise.

The Vulnerability Explained

What is node-tar?

node-tar is a widely-used npm package that provides tar archive creation and extraction functionality for Node.js applications. It's a dependency in countless projects, from build tools to deployment pipelines, making any vulnerability in it particularly concerning from a supply chain security perspective.

Understanding the Path Traversal Bypass

Path traversal vulnerabilities occur when an application fails to properly validate file paths, allowing attackers to access or modify files outside the intended directory. The classic example uses sequences like ../ to "escape" from a restricted directory.

CVE-2026-24842 specifically targets the hardlink security check in node-tar. Here's what makes this particularly dangerous:

  1. Hardlinks as an Attack Vector: Unix-like systems support hardlinks—multiple directory entries pointing to the same file data. Malicious tar archives can include hardlinks that reference files outside the extraction directory.

  2. Security Check Bypass: node-tar implemented security checks to prevent path traversal, but the hardlink validation logic contained a flaw that could be exploited to bypass these protections.

  3. Arbitrary File Creation: By crafting a malicious tar archive with specially formatted hardlink entries, an attacker could create or overwrite files in arbitrary locations on the filesystem.

Real-World Attack Scenario

Consider this attack scenario:

// Vulnerable application code
const tar = require('tar');

// Extracting user-uploaded tar file
app.post('/upload', async (req, res) => {
  const uploadedFile = req.file.path;

  // Dangerous: extracting without proper validation
  await tar.extract({
    file: uploadedFile,
    cwd: '/app/uploads/'
  });

  res.send('File extracted successfully');
});

An attacker could craft a malicious tar archive containing:

malicious.tar contents:
- regular_file.txt
- hardlink -> ../../../../etc/cron.d/malicious_job

When extracted, this could:
- Bypass the intended /app/uploads/ restriction
- Create a hardlink pointing to /etc/cron.d/malicious_job
- Write attacker-controlled content to the system's cron directory
- Achieve code execution when the cron job runs

Impact Assessment

The potential impacts of this vulnerability include:

  • Remote Code Execution: Overwriting executable files or configuration files
  • Privilege Escalation: Modifying system files if the Node.js process runs with elevated privileges
  • Data Corruption: Overwriting critical application or system data
  • Supply Chain Attacks: Compromising build pipelines that extract tar archives

The Fix

What Changed?

The security patch strengthens the hardlink validation logic to prevent path traversal bypasses. While the specific code changes aren't visible in the provided diff, typical fixes for this vulnerability class include:

  1. Enhanced Path Normalization: Ensuring all paths are canonicalized before validation
  2. Stricter Hardlink Target Validation: Verifying that hardlink targets remain within the extraction directory
  3. Absolute Path Rejection: Blocking hardlinks with absolute path targets
  4. Symlink Chain Resolution: Properly resolving and validating the entire path chain

Conceptual Before/After

Before (Vulnerable):

// Simplified vulnerable logic
function validateHardlink(linkPath, targetPath, extractDir) {
  // Insufficient validation - could be bypassed
  if (targetPath.startsWith(extractDir)) {
    return true;
  }
  return false;
}

After (Patched):

// Simplified patched logic
function validateHardlink(linkPath, targetPath, extractDir) {
  const path = require('path');

  // Normalize and resolve paths
  const normalizedTarget = path.normalize(targetPath);
  const resolvedTarget = path.resolve(extractDir, normalizedTarget);
  const resolvedExtractDir = path.resolve(extractDir);

  // Ensure resolved path is within extraction directory
  if (!resolvedTarget.startsWith(resolvedExtractDir + path.sep)) {
    throw new Error('Path traversal attempt detected');
  }

  return true;
}

Security Improvements

The fix provides several key security enhancements:

  • Defense in Depth: Multiple layers of validation prevent bypass attempts
  • Canonical Path Comparison: Using resolved absolute paths eliminates ambiguity
  • Explicit Boundary Checking: Ensuring extracted files stay within intended directories
  • Fail-Safe Defaults: Rejecting suspicious entries rather than attempting to sanitize them

Conclusion

CVE-2026-24842 serves as a critical reminder that even well-maintained, widely-used packages can harbor serious security vulnerabilities. Path traversal attacks remain a significant threat, particularly in utilities that handle file operations.

Key Takeaways:

  1. Update Immediately: If you use node-tar, update to the patched version without delay
  2. Treat Archives as Untrusted Input: Apply the same security rigor to archive extraction as you would to user input validation
  3. Defense in Depth: Combine multiple security measures—validation, sandboxing, least privilege, and monitoring
  4. Stay Informed: Subscribe to security advisories for your dependencies
  5. Audit Regularly: Make npm audit part of your CI/CD pipeline

Security is not a one-time fix but an ongoing practice. By understanding vulnerabilities like this path traversal bypass, implementing robust security measures, and maintaining vigilance over our dependency chains, we can build more resilient applications that protect our users and systems from evolving threats.

Action Items:
- [ ] Run npm audit on all your projects today
- [ ] Update node-tar to the latest patched version
- [ ] Review your code for untrusted archive extraction
- [ ] Implement additional security layers for file operations
- [ ] Educate your team about path traversal vulnerabilities

Stay secure, and happy coding! 🔒


Have questions about this vulnerability or need help securing your Node.js applications? Drop a comment below or reach out to your security team.

Prevention and further reading

Related Articles

medium

path-to-regexp 0.1.12 DoS: Catastrophic Backtracking on Malformed URL

path-to-regexp version 0.1.12 contains a regular expression engine vulnerability where maliciously crafted URL parameters trigger exponential backtracking, causing CPU exhaustion and service unavailability. Upgrading to version 0.1.13 eliminates the vulnerable pattern from the parsing logic.

critical

CVE-2026-59873: node-tar 7.5.11 DoS via Crafted Gzip Bomb

node-tar versions 7.5.11 through 7.5.18 are vulnerable to a denial-of-service attack through maliciously crafted gzip archives that decompress to disproportionately large sizes. An attacker can exploit this to exhaust memory and CPU resources by submitting a small, highly compressed archive that expands beyond configured limits during extraction.

high

MapManager.get() Race Condition Duplicates API Requests

The MapManager's `get(mapUid, cache)` method used a check-then-act pattern that permitted multiple concurrent requests to pass the cache miss check simultaneously, triggering redundant API calls and risking cache corruption. The fix introduces a `_pending` promise map to deduplicate in-flight fetches for identical map UIDs.

critical

Lampa Desktop Auto-Update Heuristic Bypass: Execution of Unverified

Lampa Desktop's auto-update mechanism downloaded JavaScript and CSS from `raw.githubusercontent.com` using only heuristic validation—file size thresholds and string pattern matching—that attackers could trivially satisfy. The fix introduces cryptographic integrity verification by cross-referencing Git blob hashes from the GitHub Contents API, ensuring downloaded code matches the repository's authoritative state before execution.

high

adm-zip 0.6.0 Preserves SUID Bits From ZIPs: CVE-2026-102282

The `adm-zip` dependency resolved to 0.6.0 in this project's dependency tree, a version affected by CVE-2026-102282: during extraction it applies the Unix permission bits stored in each ZIP entry's external file attributes verbatim, including the setuid (`04000`), setgid (`02000`), and sticky bits. An attacker who controls an archive passed to `extractAllTo()` or `extractEntryTo()` can therefore have the extractor create a setuid binary owned by whatever user the extraction process runs as. The

high

requestInput() Type Confusion: NaN and Object Bypass in JavaScript

The `requestInput()` utility function lacked validation on its `type` parameter and failed to handle `NaN` results from float conversions, creating a type confusion weakness. An attacker could supply malformed inputs that propagate unhandled `NaN` values or unexpected object types through the type system. The fix adds explicit guards against `NaN` type parameters and rejects non-primitive type values.