CVE-2026-140238 — Tar — CWE-22 · CWE-93
### 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:
### 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:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CVE-2026-140238
CVSS 7.2/10 · HIGH · 01.12.2026
CWE: CWE-22, CWE-93
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
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 WHAT IS THIS VULNERABILITY?
Path Traversal / LFI
Summary: node-tar is a tar archive manipulation library for Node.js. Prior to 8.0.0, newline splitting of PAX extended header records permits attacker-controlled entry attributes to be forged. Direct node-tar extraction without strip can overwrite a path within the extraction target.
Affected: isaacs node-tar
⚡ ATTACK VECTOR
Network / Remote (AV:N) · no authentication required (PR:N) · user interaction required (UI:R) · low attack complexity (AC:L).
🌍 REAL WORLD IMPACT
Partial confidentiality disclosure (C:L); data can be modified or deleted; reduced availability or partial DoS (A:L).
🛡️ REMEDIATION
→ Apply vendor security update for isaacs node-tar.
→ Use realpath() canonicalization, implement allowlists.
→ Pre-patch: put service behind VPN or apply IP allowlist.
→ Add WAF rule, create IDS alert for anomalous traffic.
⚠️ URGENCY
⚠️ This week (7 days) — High risk, anonymous remote.
────────────────────────────────────────
[Automated Technical Vulnerability & CVSS Vector Analysis]
FOFA Query