node-tarの脆弱性、NUL文字が残りアーカイブのファイル名が変わるおそれ
Summary
node-tarの8.0.0より前のバージョンには、ファイル名の切り詰め処理の不備により、NUL文字が残ってしまう脆弱性があります。非同期の展開処理では、プロセスが例外を捕捉しない場合にクラッシュするおそれがあり、ほかのツールとファイル名の解釈がずれることもあります。修正版は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より前のバージョンには、ファイル名の切り詰め処理の不備により、NUL文字が残ってしまう脆弱性があります。非同期の展開処理では、プロセスが例外を捕捉しない場合にクラッシュするおそれがあり、ほかのツールとファイル名の解釈がずれることもあります。修正版は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
Names are cut at the first NUL with .replace(/\0.*/, ''). Without the s flag, . doesn't match \n, \r, U+2028 or U+2029. If one of these follows the NUL, only part of the name is removed, and the NUL remains. The GHSA-gvwx-54wh-qm9j fix (7.5.17, commit 7a635c2) added this regex for PAX values on the assumption that PAX lines can't contain line terminators. The same regex is also used for ustar names and for GNU long-name/long-link data.
Details
| # | Location | Default options |
|---|---|---|
| VULN-006 | src/header.ts:358 (ustar names); src/parse.ts:390 (GNU L), :397 (GNU K, same regex, not tested separately) |
Yes (crash in async x); strip for the differential |
| VULN-021 | src/pax.ts:179 (the GHSA-gvwx fix site): CR, U+2028 and U+2029 still end the match |
Yes (crash); strip for the differential |
Proof of concept
exploit_tests/test_vuln_006_* and _021_. Each runs a control and an attack against the unmodified 7.5.22 build, with output recorded in exploit_tests/evidence/. All were run on macOS.
Impact
In async extraction, a name that still contains a NUL reaches fs and throws, which crashes a process that doesn't catch it (the outcome GHSA-gvwx-54wh-qm9j addressed). With strip, the surviving characters make node-tar's view of the name differ from other tools'.
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