All vulnerabilities

npm

CVE-2026-140247

node-tar: Symlink linkpath escape check is lexical: '..' after an in-archive symlink creates symlinks outside the extraction directory

Severity
High
Published
2 Dec 2026
Last changed
2 Dec 2026
Added to UpHeron
2 Dec 2026
Fixed in
8.0.0
Weakness
Path traversal (CWE-22)Link following (CWE-59)
Also known as
GHSA-gvrf-jx37-rjv5
Sources
OSV.dev and GitHub

Description

With default options, tar.x() / Unpack / UnpackSync can be made to create SymbolicLink entries whose targets resolve outside the extraction directory, although the README states that "Link and SymbolicLink entries are not allowed to target locations outside of the extraction folder". The trick is a .. segment that follows a symlink created earlier by the same archive:

l1 SymbolicLink -> . esc SymbolicLink -> l1/../outside.txt (lexically "outside.txt", actually /../outside.txt) escdir SymbolicLink -> l1/.. (lexically ".", actually the parent of cwd)

or, to go further up (one level per in-archive directory):

p/q/r/s SymbolicLink -> ../../.. (= cwd) x SymbolicLink -> p/q/r/s/../../../victim.txt (lexically "p/victim.txt", actually /../../../victim.txt)

None of these entries produces a warning, while the direct form (esc -> ../outside.txt) is still rejected. The step-2 symlink of the GHSA-83g3-92jg-28cx chain (a/b/c/up -> ../.., a/b/escape -> c/up/../..) also still points outside the…

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Affected software

SoftwareAffected versions
tarnpm · osv:npm:tar
  • Every version before 8.0.0

About tar

Weekly downloads (npm)
113,520,680npm, 1 Dec 2026

References