CVE-2026-140245: node-tar Symlink Linkpath Containment Bypass Vulnerability
HIGHCVE-2026-140245 is a HIGH symlink linkpath containment bypass vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting node-tar libraries in the npm ecosystem. The issue involves symlink linkpath containment bypass via entry paths ending in '/.'. Remediation is available by upgrading affected packages to version 8.0.0.
CVE-2026-140245 at a Glance
How to Fix CVE-2026-140245
To remediate this vulnerability, upgrade all affected node-tar dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install tar@8.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls tar
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-140245, inspect your project dependencies using npm:
npm ls tar
Analyze the terminal output to locate any version of node-tar in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.0.0), your application is affected.
Note: The npm ls tar command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In node-tar, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-140245 Affected node-tar Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
tar
|
npm |
≥ 7.5.5
< 8.0.0
|
8.0.0
|
References
Frequently Asked Questions
What is CVE-2026-140245?
Which node-tar versions are affected?
What version fixes CVE-2026-140245?
Is tar affected?
What CWE is associated with CVE-2026-140245?
How can I check npm dependencies for CVE-2026-140245?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-jmj2-9c5q-vw73",
"modified" : "2026-12-02T01:09:38Z",
"published" : "2026-12-02T01:09:38Z",
"aliases" : [ "CVE-2026-140245" ],
"summary" : "node-tar: Symlink linkpath containment bypass via entry paths ending in '/.'",
"details" : "### Summary\n\nA relative symlink linkpath is validated against path.posix.dirname(entry.path) but created at path.resolve(cwd, entry.path). An entry named 'x/.' shifts the check's base one level shallower, so one '..' is absorbed by the check and the link still escapes the extraction directory, with default options and no warning. Regression in 7.5.5-7.5.22 (introduced by the #450 fix).\n\n### Details\n\n### Mechanism\n\n`[STRIPABSOLUTEPATH]` resolves a relative `linkpath` against `path.posix.dirname(entry.path)` (`src/unpack.ts:286`), but the link is created at `path.resolve(cwd, entry.path)` (`src/unpack.ts:359`).\n\nFor an entry name ending in `/.`, `dirname` returns a base one level shallower than the directory the link is actually created in. The check therefore normalises `x/../outside/secret.txt` to `outside/secret.txt`, which passes `startsWith('../')` at `:291`, while the kernel resolves the link from `cwd` and lands outside the destination.\n\n### Affected\n\n`>= 7.5.5, <= 7.5.22`. The regression was introduced by `e9a1ddb` (the #450 relative-linkpath fix). `7.5.4` rejects the entry with `linkpath contains '..'`.\n\n### Fix\n\n```ts\nconst base = path.posix.dirname(normalize(entry.path))\n```\n\nUsing the same base the filesystem will use makes the check and the write agree. Verified against a 1,464-pair property corpus: 300 buggy pairs rejected, 0 legitimate pairs rejected, 0 new accepts; 677 existing tests pass.\n\n### Notes\n\nDistinct from GHSA-9ppj-qmqm-q256: that finding is a malicious *linkpath* string (`C:..`); here the linkpath is ordinary and the defect is the entry-path base computation. #450 introduced this code, so it is the regression rather than a duplicate.\n\n### Proof of concept\n\nReproduced against the npm-published `tar@7.5.22` (not only a source checkout), with one archive entry and default options:\n\n```js\n{ path: 'x/.', type: 'SymbolicLink', linkpath: '../outside/secret.txt' }\n```\n\n```\npad x -> ../outside/secret.txt realpath resolves outside dest warnings: []\nctrl path 'x' (no '/.') rejected: \"linkpath escapes extraction directory\"\nstrip strip:1 (pacote/npm path) x -> ../outside/secret.txt warnings: []\n7.5.4 baseline rejected: \"linkpath contains '..'\"\n```\n\nThe `x/.` entry is created with the escaped target, with default options, and emits no warning. It also works with `strip: 1`, PAX `path` and GNU `L`.\n\nPoC and controls: `poc-linkpath-pad.mjs` plus a version-regression script (7.5.2 vs 7.5.22).\n\n### Impact\n\nA crafted archive can create a symlink pointing outside the extraction directory using default options and without any warning.\n\n`node-tar`'s own subsequent entries cannot follow the link — `mkdir` refuses symlink parents and file writes use `O_NOFOLLOW` — so the outside write is **consumer-mediated**: a caller that later writes through the extracted path writes outside the destination. This is the same impact model as the accepted GHSA-9ppj-qmqm-q256 / CVE-2026-31802, and it is not claimed to be an in-library write or npm RCE.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "tar"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.5.5"
}, {
"fixed" : "8.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/isaacs/node-tar/security/advisories/GHSA-jmj2-9c5q-vw73"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-140245"
}, {
"type" : "WEB",
"url" : "https://github.com/isaacs/node-tar/commit/23b368128b6cf7d4c26f2e302c0e4a82f70a6e3d"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/isaacs/node-tar"
}, {
"type" : "WEB",
"url" : "https://github.com/isaacs/node-tar/releases/tag/v8.0.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-12-02T01:09:38Z",
"nvd_published_at" : "2026-12-01T18:17:28Z"
}
}