Skip to content
A detailed explainer is available in Japanese. Read the Japanese explainer
Critical 9.1

Viteの開発サーバーにRCE脆弱性、修正版を公開

GHSA-p4f5-76q4-ffq7 First seen on SecPulse

Summary

Viteの開発サーバーをネットワークに公開していると、HTTPリクエストだけでサーバー上の任意のコードを実行されるおそれがあります。該当する開発チームは系列ごとの修正版へ更新し、--hostの使用箇所も点検してください。

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.

Viteの開発サーバーをネットワークに公開していると、HTTPリクエストだけでサーバー上の任意のコードを実行されるおそれがあります。該当する開発チームは系列ごとの修正版へ更新し、--hostの使用箇所も点検してください。

Affected packages

PackageAffected → Fixed
npmvite
>=8.3.0,<=8.3.6→ 8.3.7
npmvite
>=8.2.0,<=8.2.4→ 8.2.5
npmvite
>=8.0.0,<=8.1.6→ 8.1.7
npmvite
>=7.0.0,<=7.3.7→ 7.3.8
npmvite
>= 4.0.0,<=6.4.5→ 6.4.6
npmvite-plus
<=1.5.0→ 1.5.1
Original description The description as published by the source.

Summary

By sending an HTTP request to the dev server, a arbitrary code execution was possible.

Impact

Only apps that match the following condition are affected:

Details

Vite's resolver plugin has __vite-browser-external: virtual module and __vite-optional-peer-dep: virtual module. These modules embedded the module ID, which is derived from the URL, without escaping. The `` can be any value, so any code was able to be injected in those modules.

Since Vite trusts the module code, there was two problems with this injection.

First, the modules referenced by a module are allowed for the server.fs check. For example, if the attacker injects import '/path/to/some-secret-file.txt', /path/to/some-secret-file.txt can be fetched.

Second, Vite uses eval to extract the value in the module code for new Worker and import.meta.glob. By using that functionality, the attacker can make Vite evaluate the injected code on the server. Vite prevents some module / global variables like exports, require to avoid bugs, but because this is not a security boundary, there's a bypass like globalThis.process.getBuiltinModule.

PoC

printf 'CANARY-SECRET-not-valid-js\n' > /tmp/decoy-secret.txt   # outside the project
vite

/tmp/decoy-secret.txt stands in for any sensitive file outside the…

Source: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV

References

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