CVE-2026-140235: node-tar parses PAX extended headers by newline-splitting instead of length-delimiting, causing record dropping and forged-field injection
node-tar is a tar archive manipulation library for Node.js. From 7.5.0 until 8.0.0, parseKV splits length-delimited PAX records on newline characters, so a newline inside a record value can drop the original field and turn a trailing fragment into a forged path, size, linkpath, or other entry attribute. Default extraction confines a forged path to the extraction root. When preservePaths is enabled, the forged path may instead be absolute or contain a parent-directory component. This issue is fixed in version 8.0.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 8.0.0
Event History
Frequently Asked Questions
Which deployments face the highest impact from this issue?
Applications that extract attacker-controlled tar archives with node-tar versions from 7.5.0 up to, but not including, 8.0.0 are affected. Risk is higher when extraction uses preservePaths, because forged paths can be absolute or include parent-directory components; default extraction confines forged paths to the extraction root.
What must an attacker provide to exploit the flaw?
An attacker needs a crafted tar archive containing PAX extended-header records with a newline inside a length-delimited record value. The newline can cause the intended field to be dropped and a trailing fragment to be interpreted as a forged entry attribute such as path, size, or linkpath.
Is the default extraction configuration vulnerable to writing outside the extraction directory?
Default extraction confines a forged path to the extraction root. Extraction configured with preservePaths may allow a forged path to be absolute or contain parent-directory components.
What should teams do if they cannot immediately upgrade?
Avoid extracting untrusted tar archives with affected versions, and do not enable preservePaths where possible. Upgrade node-tar to version 8.0.0 when feasible.
How can teams determine whether they are affected?
Check whether the application uses npm/tar versions 7.5.0 through versions before 8.0.0 and parses or extracts tar archives. Also review extraction options for preservePaths, especially where archives can be supplied by untrusted sources.