Skip to content
High 7.2

node-tarに脆弱性、展開先の外のファイルを読まれるおそれ

CVE-2026-140244 First seen on SecPulse

Summary

node-tarの8.0.0より前のバージョンには、展開したアーカイブ内のシンボリックリンクを経由して、展開先の外にある任意のファイルを読める脆弱性があります。影響を受けるのは、展開後のファイルツリーを読み取り、配信、コピー、アーカイブするアプリケーションです。修正版は8.0.0で、利用中のバージョンを確認し、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で、利用中のバージョンを確認し、8.0.0以降へ更新してください。

Affected packages

PackageAffected → Fixed
isaacsnode-tar —
npmtar
< 8.0.0→ 8.0.0

Fix status by distribution

Records published by each distribution for this CVE. Fixed versions differ by release; check each link.

Original description The description as published by the source.

Summary

node-tar checks that a symlink's target stays inside cwd, but the check is lexical. It runs path.resolve(dirname, linkpath), which collapses .. without following symlinks. Entry 1 s1 -> . is accepted because its target is cwd. Entry 2 s2 -> s1/../secret.txt resolves lexically to /secret.txt and is accepted too. On disk the kernel resolves s1 to cwd first and then applies .., so s2 points to /../secret.txt, outside the extraction root. Repeating s1/ climbs further. node-tar rejects the direct form (../secret.txt gives TAR_ENTRY_ERROR), so it treats outside-pointing symlinks as in scope. This bypasses the linkpath containment added for GHSA-8qq5-rm4j-mr97 and related advisories.

Affected

tar 7.5.22 (latest). src/unpack.ts, the [STRIPABSOLUTEPATH] normalize/startsWith('../') check and the [SYMLINK] path (dist/esm/unpack.js around lines 224-244 and 511-513).

Reproduction

tar 7.5.22, tar-stream 3.2.2, node 22, Docker with --network none. secret.txt sits next to the extraction dir.

const tar = require('tar'), tarstream = require('tar-stream'), fs = require('fs'), path = require('path');
const base = process.argv[2]; const root = path.join(base,'root'); const ext = path.join(root,'ext');
fs.mkdirSync(root,{recursive:true}); fs.writeFileSync(path.join(root,'secret.txt'),'CANARY\n');
const ents = {
 direct: [{name:'evil',type:'symlink',linkname:'../secret.txt'}],
 dotdot_via_s1: [{name:'s1',type:'symlink',linkname:'.'…

Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details