All vulnerabilities

npm

CVE-2026-140235

node-tar parses PAX extended headers by newline-splitting instead of length-delimiting, causing record dropping and forged-field injection

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)CWE-436
Also known as
GHSA-rgjp-p5j7-w36x
Sources
OSV.dev and GitHub

Description

node-tar parses POSIX pax extended headers by splitting the header body on every newline and validating each resulting line's length prefix, instead of consuming length-delimited records as the format specifies. A record whose value contains a newline (which occurs legitimately whenever an archived filename contains a newline) is mishandled two ways: the true record is dropped (the entry falls back to its truncated 100-byte header name), and any post-newline fragment that itself forms a self-valid key=value line is applied as a real extended-header field. This is a cross-implementation divergence and an arbitrary PAX-field injection primitive (path, size, linkpath, mode, uid, gid, mtime) driven by a single attacker-controlled filename or crafted archive.

POSIX pax records are key=value\n, where counts the entire record including any newline inside the value. Splitting on \n breaks a record whose value contains a newline into fragments: the leading fragment fails the n ===…

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

Affected software

SoftwareAffected versions
tarnpm · osv:npm:tar
  • From 7.5.0 before 8.0.0

About tar

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

References