- Severity: HIGH
- CVE: CVE-2026-140245
- Ecosystems: npm
- Packages: tar
### 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, ../outside/secret.txt realpath resolves outside dest warnings: []
ctrl path ‘x’ (no ‘/.’) rejected: “linkpath escapes extraction directory”
strip strip:1 (pacote/npm path) x -> ../outside/secret.txt warnings: []
7.5.4 baseline rejected: “linkpath contains ‘..'”
“`
The `x/.` entry is created with the escaped target, with default options, and emits no warning. It also works with `strip: 1`, PAX `path` and GNU `L`.
PoC and controls: `poc-linkpath-pad.mjs` plus a version-regression script (7.5.2 vs 7.5.22).
### I…
Source: GitHub Security Advisories · 2026-12-02