node-tarの脆弱性、アーカイブ展開で任意のファイルを上書きされるおそれ
Summary
node-tarの8.0.0より前のバージョンには、PAX拡張ヘッダーのレコードで改行が正しく処理されず、エントリの属性を偽装される脆弱性があります。strip指定なしで直接展開すると、展開先の中のパスが上書きされるおそれがあります。修正版として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より前のバージョンには、PAX拡張ヘッダーのレコードで改行が正しく処理されず、エントリの属性を偽装される脆弱性があります。strip指定なしで直接展開すると、展開先の中のパスが上書きされるおそれがあります。修正版として8.0.0が公開されているため、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
node-tar's PAX extended-header record framing is not enforced by byte length, so a newline embedded in any PAX value is reinterpreted on extraction as a record boundary. This lets an attacker forge arbitrary PAX records (path, linkpath, size, uid, ...) for an entry, overriding its real header-derived attributes. In the most damaging case this rewrites an entry's path, writing content to a location the archive's structure did not declare.
This is distinct from the already-published PAX issues: GHSA-gvwx-54wh-qm9j is NUL-byte-in-PAX causing a DoS crash; this report is newline-in-PAX causing silent record forgery / attribute override — an integrity/path-overwrite primitive, not a crash. Verified end-to-end: overwriting package.json inside an installed npm package and executing an injected postinstall on a real Windows machine.
Details
Affected versions
All versions up to and including 7.5.22 (reproduced on current main, commit 2a22bfc).
Root cause (two complementary bugs)
Extraction side — src/pax.ts parseKV (primary): the PAX body is split on \n and each line is validated only by a per-line self-consistency check (declaredLen === byteLength(line) + 1). The PAX format frames records strictly by their declared byte length; this parser instead treats any newline inside a value as a record boundary, so bytes after an embedded newline become an independent, attacker-chosen record. The source already flags this: `//…
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