node-tar: crafted archives escape extraction dir or hang/crash it (CVE-2026-140250, CVE-2026-140251)
Severity: high · Patch status: patched · Since 2026-11-26 · CVE-2026-140234, CVE-2026-140235, CVE-2026-140236, CVE-2026-140238, CVE-2026-140239, CVE-2026-140240, CVE-2026-140241, CVE-2026-140242, CVE-2026-140244, CVE-2026-140245, CVE-2026-140246, CVE-2026-140247, CVE-2026-140248, CVE-2026-140249, CVE-2026-140250, CVE-2026-140251
Sixteen GitHub advisories against npm tar (CVE-2026-140234 to CVE-2026-140251 range, 16 CVEs) were published on 2026-12-02, not four as the current summary says. The most serious are path-escape bugs. Chained or nested symlinks let tar.x() leave links that resolve outside the extraction directory (CVE-2026-140250, a containment regression since 7.5.5), so an application that later reads or writes extracted paths can touch files outside the root. The advisories also describe a Windows-only path overwrite that reaches an npm postinstall script (CVE-2026-140238), a small archive that permanently deadlocks async extraction (CVE-2026-140251), a process crash on a 4-byte zstd magic header on Node builds without native zstd (CVE-2026-140241), a non-finite PAX size that drops entries and throws on re-pack (CVE-2026-140242), and memory or CPU exhaustion through path-reservation bookkeeping (CVE-2026-140240). The advisories embed proof-of-concept code. No in-the-wild exploitation was found in the sources checked. The fix is tar 8.0.2 or later (8.0.5 is current on npm); tar 7.5.24 only addresses the PAX size issue.
What to do
- Upgrade npm tar to 8.0.2 or later (8.0.5 is the current npm release) across all projects and lockfiles; 8.0.2 is the minimum for all 16 advisories because CVE-2026-140240 is fixed only in 8.0.2
- On the 7.x line, 7.5.24 fixes only the PAX size issue (CVE-2026-140242); the symlink, deadlock and parser advisories need 8.x
- Find every tar copy that installs or extracts third-party tarballs, including transitive dependencies and CI images, and force the upgrade there
- Until upgraded, extract untrusted archives only in a sandbox: no network, read-only mounts, an unprivileged user and a throwaway directory; the symlink escapes reproduce with both async and sync extraction
- Treat the async deadlock and the zstd crash as availability incidents: monitor extraction jobs for promises that never settle and for process crashes
- On Windows hosts, do not run npm installs of untrusted packages until upgraded; the PAX newline advisory describes a postinstall code-execution path there
Fixed versions
- tar 8.0.2 (fixes all 16; minimum)
- tar 8.0.5 (current npm latest)
- tar 7.5.24 (CVE-2026-140242 only)
Sources
All live incidents on Threat Watch