All vulnerabilities

npm

CVE-2026-140239

node-tar: Global PAX extended header injects attacker-controlled linkpath into tar.Parser entries, bypassing strict-mode validation

Severity
High
Published
2 Dec 2026
Last changed
2 Dec 2026
Added to UpHeron
2 Dec 2026
Fixed in
8.0.0
Weakness
Improper input validation (CWE-20)Insufficient verification of data authenticity (CWE-345)
Also known as
GHSA-ffhw-4r4q-5cwv
Sources
OSV.dev and GitHub

Description

A tar archive with a Global Extended Header (PAX type g) with a linkpath field injects that value into every entry returned by tar.Parser , including plain File and Directory entries, with zero warnings under strict: true. This happens because header.js's #slurp() correctly excludes linkpath from global headers, but read-entry.js's #slurp() does not apply the same filter. Any application that consumes tar.Parser or tar.list() directly and uses entry.linkpath to build paths or create symlinks, without revalidating the value, can be made to read or write files outside the intended directory via a crafted symlink.

There are two separate #slurp() implementations apply Global Extended Header (g-type) fields to parsed state, and they filter different fields.

In src/header.js, #slurp(ex, gex = false) correctly excludes linkpath when gex is true:

In src/read-entry.js, the equivalent method has no such clause — it only excludes path:

The execution flow:

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Affected software

SoftwareAffected versions
tarnpm · osv:npm:tar
  • Every version before 8.0.0

About tar

Weekly downloads (npm)
113,520,680npm, 1 Dec 2026

References