CVE-2026-140244 — Tar — CWE-22 · CWE-59
### 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 `<cwd>/secret.txt` and is accepted too. On disk the kernel resolves `s1` to cwd first and then applies `..`, so `s2` points to `<cwd>/../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',li
### 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 `<cwd>/secret.txt` and is accepted too. On disk the kernel resolves `s1` to cwd first and then applies `..`, so `s2` points to `<cwd>/../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',li
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CVE-2026-140244
CVSS 7.2/10 · HIGH · 01.12.2026
CWE: CWE-22, CWE-59
Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 WHAT IS THIS VULNERABILITY?
Path Traversal / LFI
Summary: node-tar is a tar archive manipulation library for Node.js. Prior to 8.0.0, the STRIPABSOLUTEPATH linkpath containment check uses path.resolve and collapses parent components without following an earlier archive-created symlink. A second symlink can therefore be planted inside the extraction root while pointing outside it.
⚡ ATTACK VECTOR
Network / Remote (AV:N) · no authentication required (PR:N) · user interaction required (UI:R) · low attack complexity (AC:L).
🌍 REAL WORLD IMPACT
Partial confidentiality disclosure (C:L); data can be modified or deleted; reduced availability or partial DoS (A:L).
🛡️ REMEDIATION
→ Apply the vendor-released patch immediately.
→ Use realpath() canonicalization, implement allowlists.
→ Pre-patch: put service behind VPN or apply IP allowlist.
→ Add WAF rule, create IDS alert for anomalous traffic.
⚠️ URGENCY
⚠️ This week (7 days) — High risk, anonymous remote.
────────────────────────────────────────
[Automated Technical Vulnerability & CVSS Vector Analysis]