Home/Research/Post

GHSA-3wwj-8j6r-q339: node-tar: Symlink containment bypass via chained symlinks lets tar.x() create links that resolve outside the extraction directory (regression since 7.5.5)

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

### Summary

With default options, `tar.x()` in `tar@7.5.22` (and every release since 7.5.5) extracts a symbolic link that resolves outside the extraction directory when the link target passes through another symlink from the same archive and then uses `..` — for example `sub/up -> ..` followed by `esc -> sub/up/..`. Both symlink-target checks collapse `..` lexically before considering symlinks, so the intermediate symlink is never seen, while the kernel resolves it before applying `..`. With enough nesting the extracted link resolves to `/`.

This breaks the README guarantee that “`Link` and `SymbolicLink` entries are not allowed to target locations outside of the extraction folder”, and gives any application that later reads or writes extracted paths file read/write outside the extraction root (the same impact model as GHSA-9ppj-qmqm-q256). It is a regression of the containment added for GHSA-8qq5-rm4j-mr97 (7.5.3–7.5.4 reject the chain; 7.5.5–7.5.22 accept it), and it also bypasses the `[SYMLINK]` check added for GHSA-83g3-92jg-28cx. A self-contained PoC, measured version matrix, and a remote-read deployment example are below.

### Details

### Malicious archive

Three entries, no file contents needed:

“`
sub/ Directory
sub/up SymbolicLink -> .. lexical: “sub/..” = “.” (inside)
esc SymbolicLink -> sub/up/.. lexical: “sub/up/..” = “sub” (inside)
“`

On disk, the kernel resolves `esc` as `sub/up` → “, then `..` → **parent of “**.

### Root cause 1 — lexical escape check…

Source: GitHub Security Advisories · 2026-12-02