npm
CVE-2026-140249
node-tar: Symlink target escapes the extraction directory through an in-archive symlink chain
- Severity
- High
- Published
- 2 Dec 2026
- Last changed
- 2 Dec 2026
- Added to UpHeron
- 2 Dec 2026
- Fixed in
- 8.0.0
- Also known as
- GHSA-4pf9-5fpx-xmr6
- Sources
- OSV.dev and GitHub
Description
Summary With default options, tar.x() in tar 7.5.5 through 7.5.23 (the latest release) creates a symbolic link that points outside the extraction directory, and raises no warning. The archive needs only a directory and two symlinks. This breaks the README's listed protection that "Link and SymbolicLink entries are not allowed to target locations outside of the extraction folder."
This is not the TOCTOU case (no one but tar touches the extraction folder) and not an old version: it reproduces on 7.5.23 and on main (eb92e17), with default options.
x/ Directory x/y -> .. (resolves to cwd: allowed) l -> x/y/../secret.txt (checked as cwd/x/secret.txt; really cwd/../secret.txt)
- [STRIPABSOLUTEPATH] validates the lexically normalized linkpath, x/secret.txt, which is inside cwd.
- [SYMLINK] runs ENSURE_NO_SYMLINK on path.resolve(...) of the linkpath, which also removes y/.. before checking, so it never sees that x/y is a symlink.
Affected software
| Software | Affected versions |
|---|---|
tarnpm · osv:npm:tar |
|
About tar
- Weekly downloads (npm)
- 113,520,680npm, 1 Dec 2026
Vulnerabilities in tar
- In our list
- 18
- Published in the last 12 months
- 18
- Critical, last 12 months
- 0
- High, last 12 months
- 17
- Known exploited
- 0
- CVE-2026-140234node-tar: Incomplete NUL-byte truncation in ustar, GNU, and PAX names causes name differentials and async crashesHigh 2 Dec 2026
- CVE-2026-140235node-tar parses PAX extended headers by newline-splitting instead of length-delimiting, causing record dropping and forged-field injectionHigh 2 Dec 2026
- CVE-2026-140236node-tar: Archive framing differential from PAX size still being applied to GNU/PAX meta entries via ReadEntry and related size/precedence inconsistenciesHigh 2 Dec 2026
- CVE-2026-140237node-tar: ReadEntry pending PAX size reapplication permits metadata-body file smugglingMedium 2 Dec 2026
- CVE-2026-140238node-tar: Newline injection in PAX extended-header records enables entry-attribute forgery (path overwrite → npm postinstall RCE on Windows)High 2 Dec 2026
- CVE-2026-140239node-tar: Global PAX extended header injects attacker-controlled linkpath into tar.Parser entries, bypassing strict-mode validationHigh 2 Dec 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-140249
- GitHub Advisory Database https://github.com/advisories/GHSA-4pf9-5fpx-xmr6