Skip to content

Jvr2022/CVE-2026-23745

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

CVE-2026-23745: node-tar Arbitrary File Overwrite

Research: Joshua van Rijswijk

Description

PoC for CVE-2026-23745, a high-severity path traversal vulnerability in node-tar ( <7.5.2).

The library fails to sanitize absolute paths in the linkpath field for Hardlinks and Symlinks. This allows malicious tar archives to bypass the extraction root and overwrite arbitrary files on the host system, even when preservePaths: false is set.

The Vulnerability

Located in src/unpack.ts. The library uses path.resolve() on unsanitized user input:

// The bug: path.resolve ignores 'cwd' if the second argument is absolute
const target = path.resolve(this.cwd, String(entry.linkpath))

If an attacker provides an absolute path (e.g., /etc/passwd) in the tar header, node-tar resolves it to the system root instead of the extraction directory.

PoC Usage

The included poc.js generates a malicious archive and attempts to overwrite a local secret.txt file.

  1. Install vulnerable version: npm install tar@7.5.2

  2. Run exploit generator: node poc.js

Output:

[+] VULN CONFIRMED: Hardlink overwrite successful
    Target file content changed to: OVERWRITTEN

Fix

Patched in v7.5.3. The update adds stripAbsolutePath() to sanitize link targets before resolution.

References:

About

Proof of Concept for CVE-2026-23745: Arbitrary File Overwrite vulnerability in node-tar (versions < 7.5.3).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages