Home/Research/Post

GHSA-4pf9-5fpx-xmr6: node-tar: Symlink target escapes the extraction directory through an in-archive symlink chain

  • Severity: HIGH
  • CVE: CVE-2026-140249
  • Ecosystems: npm
  • Packages: tar

### Summary

Summary
With default options, tar.x() in tar 7.5.5 through 7.5.23 (the latest release) creates a symbolic link that points outside the extraction directory, and raises no warning. The archive needs only a directory and two symlinks. This breaks the README’s listed protection that “Link and SymbolicLink entries are not allowed to target locations outside of the extraction folder.”

This is not the TOCTOU case (no one but tar touches the extraction folder) and not an old version: it reproduces on 7.5.23 and on main (eb92e17), with default options.

### Details

x/ Directory
x/y -> .. (resolves to cwd: allowed)
l -> x/y/../secret.txt (checked as cwd/x/secret.txt; really cwd/../secret.txt)

– [STRIPABSOLUTEPATH] validates the lexically normalized linkpath, x/secret.txt, which is inside cwd.
– [SYMLINK] runs ENSURE_NO_SYMLINK on path.resolve(…) of the linkpath, which also removes y/.. before checking, so it never sees that x/y is a symlink.
– [LINK] then creates the link with the raw linkpath, x/y/../secret.txt. The kernel resolves x/y first (to cwd), then applies .., so l points to cwd/../secret.txt.

Repeating the x/y/ step reaches any absolute path: x/y/ × 8 followed by ../ × 16 and etc/hostname fits in the 100-byte ustar linkpath field and points at /etc/hostname. Entry order does not matter; the link can come before or after x/y.

This is the same chain as the proof of concept in GHSA-83g3-92jg-28cx (CVE-2026-26960). That fix blocked the hardlink created thro…

Source: GitHub Security Advisories · 2026-12-02