node-tarに細工したアーカイブを読ませるとサービス停止になる脆弱性
Summary
node-tarの7.5.22から8.0.0までの版には、Zstandard形式の圧縮を自動判定する処理で例外が捕捉されず、プロセスが停止する脆弱性があります。細工された入力ファイルを非同期のファイル一覧取得や展開のAPIに渡されると、サービス妨害(DoS)につながります。修正版は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の7.5.22から8.0.0までの版には、Zstandard形式の圧縮を自動判定する処理で例外が捕捉されず、プロセスが停止する脆弱性があります。細工された入力ファイルを非同期のファイル一覧取得や展開のAPIに渡されると、サービス妨害(DoS)につながります。修正版は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
An unauthenticated remote-input denial of service allows a four-byte file to crash any process that lists or extracts it with node-tar's asynchronous file API, on any Node runtime without native zlib zstd support (Node 18.x, 20.x, 21.x, 22.0-22.14, 23.0-23.7, all of which satisfy the package's declared engines: node >= 18). node-tar's default-enabled compression sniffing detects the zstd magic (28 b5 2f fd) and constructs new ZstdDecompress({}) with no error handling. On a runtime without the zstd binding, minizlib's constructor throws a TypeError synchronously inside the file-read stream's data callback, so the async tar.t() / tar.x() promise never settles and the exception is uncaught, killing the process.
Details
Parser.write() sniffs the first bytes of every input and, on the zstd magic, constructs the decompressor unguarded:
// src/parse.ts:547-550
this[UNZIP] =
this[UNZIP] === undefined ? new Unzip({})
: isZstd ? new ZstdDecompress({}) // throws TypeError on a runtime without native zstd
: new BrotliDecompress({})
minizlib's ZlibBase constructor throws TypeError: Compression method not supported: ZstdDecompress when node:zlib lacks the binding. Because this construction runs inside the file-read stream's data handler (ReadStream.emit -> Unpack.write -> new ZstdDecompress), the throw is not routed through the stream's error event or Parser.abort(). For the async file form (tar.x({file}) / `tar.t({fi…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- web github.com
- web github.com
- web github.com
- web nvd.nist.gov
- web github.com