CVE-2026-140248: node-tar: Nested symlink target can escape node-tar extraction root
node-tar is a tar archive manipulation library for Node.js. From 7.5.22 until 8.0.0, with preservePaths disabled, a crafted archive can first create an in-root symlink and then create a second SymbolicLink whose linkpath traverses that symlink followed by a parent component. STRIPABSOLUTEPATH evaluates the target lexically, while the filesystem follows the first symlink before applying the parent traversal. The resulting link remains inside the extraction tree but points outside it; access outside the root occurs when a later consumer follows the planted link. This issue is fixed in version 8.0.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/tarto a version that resolves this vulnerability.Fixed in 8.0.0
Event History
Frequently Asked Questions
Which deployments are exposed?
Deployments using node-tar versions from 7.5.22 up to, but not including, 8.0.0 are affected when extracting attacker-crafted archives with preservePaths disabled.
What must an attacker control to exploit this issue?
An attacker needs to supply a crafted tar archive that creates an in-root symlink followed by a second symbolic link whose target traverses that symlink and then a parent directory component. The out-of-root access occurs only if a later consumer follows the planted link.
Does exploitation directly write files outside the extraction directory?
The crafted link itself remains within the extraction tree, but it points outside that tree. Access outside the root happens later when software follows the planted symbolic link.
What is the available remediation?
Upgrade node-tar to version 8.0.0, which fixes the issue.