node-tarの脆弱性、細工したアーカイブで展開先の外に書き込まれるおそれ
Summary
node-tarの8.0.0より前のバージョンに脆弱性があり、細工したアーカイブを展開すると、展開先ディレクトリの外にあるファイルを読み書きされるおそれがあります。修正版は8.0.0です。node-tarを利用している場合は、8.0.0以降へ更新してください。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
node-tarの8.0.0より前のバージョンに脆弱性があり、細工したアーカイブを展開すると、展開先ディレクトリの外にあるファイルを読み書きされるおそれがあります。修正版は8.0.0です。node-tarを利用している場合は、8.0.0以降へ更新してください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| isaacsnode-tar | — | Not listed |
| npmtar |
< 8.0.0→ 8.0.0 |
8.0.0 |
Original description The description as published by the source.
Summary
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 /../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 /../../../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) acce…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- web github.com
- web github.com
- web github.com
- web github.com