HIGHCVSS v4 7.2Vulnerability

CVE-2026-140238

### Summary node-tar's PAX extended-header **record framing is not enforced by byte length**, so a newline embedded in any PAX value is reinterpreted on extraction as a record boundary. This lets an attacker forge arbitrary PAX records (`path`, `linkpath`, `size`, `uid`, ...) for an entry, overriding its real header-derived attributes. In the most damaging case this rewrites an entry's `path`, writing content to a location the archive's structure did not declare. This is distinct from the already-published PAX issues: `GHSA-gvwx-54wh-qm9j` is NUL-byte-in-PAX causing a DoS crash; this report is **newline-in-PAX causing silent record forgery / attribute override** — an integrity/path-overwrite primitive, not a crash. Verified end-to-end: overwriting `package.json` inside an installed npm package and executing an injected `postinstall` on a real Windows machine. ### Details ## Affected versions All versions up to and including 7.5.22 (reproduced on current `main`, commit `2a22bfc`). ## Root cause (two complementary bugs) **Extraction side — `src/pax.ts` `parseKV` (primary):** the PAX body is split on `\n` and each line is validated only by a per-line self-consistency check (`declaredLen === byteLength(line) + 1`). The PAX format frames records strictly by their declared byte length; this parser instead treats any newline inside a value as a record boundary, so bytes after an embedded newline become an independent, attacker-chosen record. The source already flags this: `// XXX Values with \n in them will fail this. Refactor to not be a naive line-by-line parse.` **Creation side — `src/pax.ts` `encodeField` (enabler / defense-in-depth):** PAX values are serialized with no escaping (`' ' + field + '=' + v + '\n'`), so a newline in a filename is written verbatim into the PAX body. This means even archives produced by node-tar itself, from a directory containing an attacker-planted filename, carry forged records. Accepted keys are whitelisted and applied to the entr

Properties

Severity
high
Summary
node-tar: Newline injection in PAX extended-header records enables entry-attribute forgery (path overwrite → npm postinstall RCE on Windows)
Nvd fetched at
2026-12-02T06:37:54.190518+00:00
Cvss severity
HIGH
Cvss score
7.2
Retrieved at
2026-12-02T06:39:20+00:00
Ghsa published
2026-12-02T01:26:18Z
Source url
https://github.com/advisories/GHSA-mpg7-vg3p-wc3m
Ghsa updated
2026-12-02T01:26:18Z
Ghsa id
GHSA-mpg7-vg3p-wc3m
Last source
GitHub Advisory Database
Score
7.2
Cvss version
4.0
Cve id
CVE-2026-140238
Cvss vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
First seen by Signal
2026-12-01T18:35:21+00:00
Name
CVE-2026-140238
Is ghsa only
false
Vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Published at
2026-12-01T18:17:27.547

Related Entities (4)

AFFECTS (1)

→[Software]npm/tar

VULNERABLE_TO (1)

←[Software]npm/tar

Related research

Explore deeper with Ninja Signal's threat intelligence graph

CVE-2026-140238 (CVSS v4 7.2) — Ninja Signal Threat Intelligence | Ninja Signal