CVE-2026-140238: node-tar: Newline injection in PAX extended-header records enables entry-attribute forgery (path overwrite → npm postinstall RCE on Windows)
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. The npm execution chain additionally requires Windows strip:1 normalization, an overwrite of package.json, and later execution of the injected postinstall script; POSIX npm processing with strip:1 is not affected by that chain. This issue is fixed in version 8.0.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/node-tarto a version that resolves this vulnerability.Fixed in 8.0.0
Event History
Frequently Asked Questions
Which deployments are exposed to path overwrites during extraction?
node-tar versions prior to 8.0.0 are affected. Direct extraction using node-tar without strip can overwrite a path within the extraction target when processing a crafted archive.
What conditions are required for the npm postinstall execution chain?
The described npm chain requires Windows strip:1 normalization, an overwrite of package.json, and subsequent execution of the injected postinstall script. POSIX npm processing with strip:1 is not affected by that chain.
How can I determine whether my environment is affected?
Check the node-tar version in use: versions earlier than 8.0.0 are affected. Also identify workflows that extract untrusted tar archives directly without strip, or Windows npm workflows that use strip:1 and may later execute package scripts.
What should be done to remediate the issue?
Upgrade node-tar to version 8.0.0, which fixes the issue. Until upgraded, avoid extracting untrusted archives in the affected direct-extraction and Windows npm conditions described.