CVE-2026-140242 — Tar — CWE-1284
## Summary `tar` (node-tar) does not validate that a numeric `size` value supplied through a PAX extended header (typeflag `x`) is finite before it is applied to the following archive entry. A PAX record such as `17 size=Infinity\n` is coerced to the JavaScript number `Infinity` and accepted, because the only guard on the value is a `>= 0` check and `Infinity >= 0` is true. The non-finite size then propagates into the entry-body state machine and, when the entry is re-packed, into numeric header encoding. Any process that parses, extracts, lists, or re-packs an attacker-supplied archive is affected; no authentication or non-default configuration is required. ## Root Cause The PAX key/value parser assigns the `size` field after a check that was designed only to reject negative values. It never checks that the coerced number is finite or a safe integer, so `Infinity` (and other non-finite positive values) pass. ```typescript // src/pax.ts (parseKVLine) case 'size': const s = +v // +"Infinity" === Infinity if (s >= 0) set[k] = s // Infinity >= 0 is true, so size is set to Infinity break ``` The `>= 0` guard was added to reject negative sizes. It does not enforce finiteness. The secondary guard `notNegative()` in `src/header.ts` has the same gap: `Infinity < 0` is false, so it returns `Infinity` unchanged. As a result the entry's `size` becomes `Infinity` and reaches two distinct sinks: the parser body-length state machine and the numeric header encoder use
## Summary `tar` (node-tar) does not validate that a numeric `size` value supplied through a PAX extended header (typeflag `x`) is finite before it is applied to the following archive entry. A PAX record such as `17 size=Infinity\n` is coerced to the JavaScript number `Infinity` and accepted, because the only guard on the value is a `>= 0` check and `Infinity >= 0` is true. The non-finite size then propagates into the entry-body state machine and, when the entry is re-packed, into numeric header encoding. Any process that parses, extracts, lists, or re-packs an attacker-supplied archive is affected; no authentication or non-default configuration is required. ## Root Cause The PAX key/value parser assigns the `size` field after a check that was designed only to reject negative values. It never checks that the coerced number is finite or a safe integer, so `Infinity` (and other non-finite positive values) pass. ```typescript // src/pax.ts (parseKVLine) case 'size': const s = +v // +"Infinity" === Infinity if (s >= 0) set[k] = s // Infinity >= 0 is true, so size is set to Infinity break ``` The `>= 0` guard was added to reject negative sizes. It does not enforce finiteness. The secondary guard `notNegative()` in `src/header.ts` has the same gap: `Infinity < 0` is false, so it returns `Infinity` unchanged. As a result the entry's `size` becomes `Infinity` and reaches two distinct sinks: the parser body-length state machine and the numeric header encoder use
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CVE-2026-140242
CVSS 7.1/10 · HIGH · 01.12.2026
CWE: CWE-1284
Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:H/SC:N/SI:N/SA:N
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 WHAT IS THIS VULNERABILITY?
Summary: ## Summary
tar (node-tar) does not validate that a numeric size value supplied through a PAX extended header (typeflag x) is finite before it is applied to the following archive entry. A PAX record such as 17 size=Infinity\n is coerced to the JavaScript number Infinity and accepted, because the only guard on the value is a >= 0 check and Infinity >= 0 is true. The non-finite size…
Affected: 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); limited integrity modification (I:L); service can be completely taken down.
🛡️ REMEDIATION
→ Apply vendor security update for tar.
→ 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]