VitestのAPIサーバーにおけるリモートコード実行の脆弱性
タイトル VitestのAPIサーバーにおけるリモートコード実行の脆弱性
概要

VitestはViteをベースとしたテストフレームワークです。影響を受けるバージョンでは、VitestのAPIサーバーがリスニング中にユーザーが悪意のあるウェブサイトにアクセスすると、クロスサイトWebSocketハイジャック(CSWSH)攻撃によって任意のリモートコードが実行されるおそれがあります。`api`オプションが有効な場合(Vitest UIで有効化されます)、VitestはWebSocketサーバーを起動します。このWebSocketサーバーにはOriginヘッダーの検証や認証機構がなく、CSWSH攻撃に対して脆弱です。このWebSocketサーバーにはテストファイルを編集できる`saveTestFile` APIと、テストを再実行できる`rerun` APIがあります。攻撃者は`saveTestFile` APIを使ってテストファイルにコードを注入し、そのファイルを`rerun` APIで実行させることで任意のコードを実行できます。この脆弱性によって、Vitest serve APIを利用するユーザーはリモートコード実行のリスクにさらされます。本問題はバージョン1.6.1、2.1.9、3.0.5で修正されました。ユーザーはアップグレードすることが推奨されます。本脆弱性に対する既知の回避策は存在しません。

想定される影響 当該ソフトウェアが扱う全ての情報が外部に漏れる可能性があります。 また、当該ソフトウェアが扱う全ての情報が書き換えられる可能性があります。 さらに、当該ソフトウェアが完全に停止する可能性があります。 そして、この脆弱性を悪用した攻撃の影響は、他のソフトウェアには及びません。 
対策

正式な対策が公開されています。ベンダ情報を参照して適切な対策を実施してください。

公表日 2025年2月4日0:00
登録日 2026年1月6日10:54
最終更新日 2026年1月6日10:54
CVSS3.0 : 重要
スコア 8.8
ベクター CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
影響を受けるシステム
Vitest.dev
Vitest 0.0.125 およびそれ以前
Vitest 1.0.0 以上 1.6.1 未満
Vitest 2.0.0 以上 2.1.9 未満
Vitest 3.0.0 以上 3.0.5 未満
CVE (情報セキュリティ 共通脆弱性識別子)
CWE (共通脆弱性タイプ一覧)
ベンダー情報
その他
変更履歴
No 変更内容 変更日
1 [2026年01月06日]
  掲載
2026年1月6日10:54

NVD脆弱性情報
CVE-2025-24964
概要

Vitest is a testing framework powered by Vite. Affected versions are subject to arbitrary remote Code Execution when accessing a malicious website while Vitest API server is listening by Cross-site WebSocket hijacking (CSWSH) attacks. When `api` option is enabled (Vitest UI enables it), Vitest starts a WebSocket server. This WebSocket server did not check Origin header and did not have any authorization mechanism and was vulnerable to CSWSH attacks. This WebSocket server has `saveTestFile` API that can edit a test file and `rerun` API that can rerun the tests. An attacker can execute arbitrary code by injecting a code in a test file by the `saveTestFile` API and then running that file by calling the `rerun` API. This vulnerability can result in remote code execution for users that are using Vitest serve API. This issue has been patched in versions 1.6.1, 2.1.9 and 3.0.5. Users are advised to upgrade. There are no known workarounds for this vulnerability.

公表日 2025年2月5日5:15
登録日 2025年2月6日4:01
最終更新日 2025年2月5日5:15
関連情報、対策とツール
共通脆弱性一覧