CVE-2026-140245 — Tar — CWE-22
### Summary A relative symlink linkpath is validated against path.posix.dirname(entry.path) but created at path.resolve(cwd, entry.path). An entry named 'x/.' shifts the check's base one level shallower, so one '..' is absorbed by the check and the link still escapes the extraction directory, with default options and no warning. Regression in 7.5.5-7.5.22 (introduced by the #450 fix). ### Details ### Mechanism `[STRIPABSOLUTEPATH]` resolves a relative `linkpath` against `path.posix.dirname(entry.path)` (`src/unpack.ts:286`), but the link is created at `path.resolve(cwd, entry.path)` (`src/unpack.ts:359`). For an entry name ending in `/.`, `dirname` returns a base one level shallower than the directory the link is actually created in. The check therefore normalises `x/../outside/secret.txt` to `outside/secret.txt`, which passes `startsWith('../')` at `:291`, while the kernel resolves the link from `cwd` and lands outside the destination. ### Affected `>= 7.5.5, <= 7.5.22`. The regression was introduced by `e9a1ddb` (the #450 relative-linkpath fix). `7.5.4` rejects the entry with `linkpath contains '..'`. ### Fix ```ts const base = path.posix.dirname(normalize(entry.path)) ``` Using the same base the filesystem will use makes the check and the write agree. Verified against a 1,464-pair property corpus: 300 buggy pairs rejected, 0 legitimate pairs rejected, 0 new accepts; 677 existing tests pass. ### Notes Distinct from GHSA-9ppj-qmqm-q256: that finding is a maliciou
### Summary A relative symlink linkpath is validated against path.posix.dirname(entry.path) but created at path.resolve(cwd, entry.path). An entry named 'x/.' shifts the check's base one level shallower, so one '..' is absorbed by the check and the link still escapes the extraction directory, with default options and no warning. Regression in 7.5.5-7.5.22 (introduced by the #450 fix). ### Details ### Mechanism `[STRIPABSOLUTEPATH]` resolves a relative `linkpath` against `path.posix.dirname(entry.path)` (`src/unpack.ts:286`), but the link is created at `path.resolve(cwd, entry.path)` (`src/unpack.ts:359`). For an entry name ending in `/.`, `dirname` returns a base one level shallower than the directory the link is actually created in. The check therefore normalises `x/../outside/secret.txt` to `outside/secret.txt`, which passes `startsWith('../')` at `:291`, while the kernel resolves the link from `cwd` and lands outside the destination. ### Affected `>= 7.5.5, <= 7.5.22`. The regression was introduced by `e9a1ddb` (the #450 relative-linkpath fix). `7.5.4` rejects the entry with `linkpath contains '..'`. ### Fix ```ts const base = path.posix.dirname(normalize(entry.path)) ``` Using the same base the filesystem will use makes the check and the write agree. Verified against a 1,464-pair property corpus: 300 buggy pairs rejected, 0 legitimate pairs rejected, 0 new accepts; 677 existing tests pass. ### Notes Distinct from GHSA-9ppj-qmqm-q256: that finding is a maliciou
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CVE-2026-140245
CVSS 7.2/10 · HIGH · 01.12.2026
CWE: CWE-22
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
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 WHAT IS THIS VULNERABILITY?
Path Traversal / LFI
Summary: ### Summary
A relative symlink linkpath is validated against path.posix.dirname(entry.path) but created at path.resolve(cwd, entry.path). An entry named 'x/.' shifts the check's base one level shallower, so one '..' is absorbed by the check and the link still escapes the extraction directory, with default options and no warning. Regression in 7.5.5-7.5.22 (introduced by the #450 fix).
Affected: tar
⚡ 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 vendor security update for tar.
→ 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]