- Severity: HIGH
- CVE: CVE-2026-140244
- Ecosystems: npm
- Packages: tar
### Summary
node-tar checks that a symlink’s target stays inside `cwd`, but the check is lexical. It runs `path.resolve(dirname, linkpath)`, which collapses `..` without following symlinks. Entry 1 `s1 -> .` is accepted because its target is cwd. Entry 2 `s2 -> s1/../secret.txt` resolves lexically to `/secret.txt` and is accepted too. On disk the kernel resolves `s1` to cwd first and then applies `..`, so `s2` points to `/../secret.txt`, outside the extraction root. Repeating `s1/` climbs further. node-tar rejects the direct form (`../secret.txt` gives TAR_ENTRY_ERROR), so it treats outside-pointing symlinks as in scope. This bypasses the linkpath containment added for GHSA-8qq5-rm4j-mr97 and related advisories.
### Affected
tar 7.5.22 (latest). `src/unpack.ts`, the `[STRIPABSOLUTEPATH]` normalize/startsWith(‘../’) check and the `[SYMLINK]` path (`dist/esm/unpack.js` around lines 224-244 and 511-513).
### Reproduction
tar 7.5.22, tar-stream 3.2.2, node 22, Docker with `–network none`. `secret.txt` sits next to the extraction dir.
“`js
const tar = require(‘tar’), tarstream = require(‘tar-stream’), fs = require(‘fs’), path = require(‘path’);
const base = process.argv[2]; const root = path.join(base,’root’); const ext = path.join(root,’ext’);
fs.mkdirSync(root,{recursive:true}); fs.writeFileSync(path.join(root,’secret.txt’),’CANARY\n’);
const ents = {
direct: [{name:’evil’,type:’symlink’,linkname:’../secret.txt’}],
dotdot_via_s1: [{name:’s1′,type:’symlink’,linkname:’.’…
Source: GitHub Security Advisories · 2026-12-02