Описание
Vitest is a testing framework powered by Vite. From 2.1.0 until 4.1.11 and 5.0.0-rc.2, the public mockerPlugin and standalone interceptorPlugin exports in packages/mocker/src/node/interceptorPlugin.ts register the vitest:interceptor:register handler on Vite's unauthenticated HMR WebSocket without validating redirect targets against the file-serving allowlist. The implementation processes event.redirect without enforcing server.fs.allow and server.fs.deny through isFileLoadingAllowed. A remote client that can reach an exposed development server can submit an opaque URL scheme preserving .. segments, causing join(server.config.root, redirectUrl.pathname) to resolve outside the project root. The plugin's load hook then returns readFile(mock.redirect, 'utf-8') as module source, disclosing local files readable by the dev-server process. Vitest browser mode uses a token-authenticated RPC and is not remotely unauthenticated by default, although the same boundary check was missing on that path. This issue is fixed in versions 4.1.11 and 5.0.0-rc.2.
A flaw was found in Vitest, a testing framework. A remote attacker, able to reach an exposed development server, could exploit an issue in the mockerPlugin and interceptorPlugin exports. These plugins register a handler on Vite's unauthenticated HMR WebSocket without properly validating redirect targets. By submitting a specially crafted URL with path traversal segments, an attacker could read arbitrary local files accessible by the development server process, leading to information disclosure.
Отчет
This vulnerability in Vitest allows an unauthenticated remote attacker to read arbitrary local files on an exposed development server. The flaw stems from a path traversal issue within the HMR WebSocket handler, which fails to properly validate redirect targets. Exploitation is limited to development environments where the Vitest server is accessible from untrusted networks.
Меры по смягчению последствий
Restrict network access to development servers running Vitest. Configure firewall rules to limit inbound connections to the Vitest HMR WebSocket port to only trusted internal networks or localhost. This may impact development workflows that rely on remote access to the development server.
Затронутые пакеты
| Платформа | Пакет | Состояние | Рекомендация | Релиз |
|---|---|---|---|---|
| Red Hat AMQ Broker 7 | amq-broker-bin.zip | Fix deferred | ||
| Red Hat AMQ Broker 7 | amq-broker-maven-repository.zip | Fix deferred | ||
| Red Hat Ansible Automation Platform 2 | ansible-automation-platform-26/gateway-rhel9 | Fix deferred | ||
| Red Hat Ansible Automation Platform 2 | ansible-automation-platform-27/gateway-rhel9 | Fix deferred | ||
| Red Hat Ansible Automation Platform 2 | automation-gateway | Out of support scope | ||
| Red Hat Ansible Automation Platform 2 | automation-platform-ui | Fix deferred | ||
| Red Hat Build of Keycloak | keycloak-operator.redhat-00001.zip | Fix deferred | ||
| Red Hat Build of Keycloak | rhbk-quarkus-dist.zip | Fix deferred | ||
| Red Hat Build of Podman Desktop | rh-podman-desktop.git | Fix deferred | ||
| Red Hat Enterprise Linux 10 | rh-podman-desktop | Fix deferred |
Показывать по
Ссылки на источники
Дополнительная информация
Статус:
EPSS
5.9 Medium
CVSS3
Связанные уязвимости
Vitest is a testing framework powered by Vite. From 2.1.0 until 4.1.11 and 5.0.0-rc.2, the public mockerPlugin and standalone interceptorPlugin exports in packages/mocker/src/node/interceptorPlugin.ts register the vitest:interceptor:register handler on Vite's unauthenticated HMR WebSocket without validating redirect targets against the file-serving allowlist. The implementation processes event.redirect without enforcing server.fs.allow and server.fs.deny through isFileLoadingAllowed. A remote client that can reach an exposed development server can submit an opaque URL scheme preserving .. segments, causing join(server.config.root, redirectUrl.pathname) to resolve outside the project root. The plugin's load hook then returns readFile(mock.redirect, 'utf-8') as module source, disclosing local files readable by the dev-server process. Vitest browser mode uses a token-authenticated RPC and is not remotely unauthenticated by default, although the same boundary check was missing on that path
Vitest: Path Traversal / Arbitrary File Read via @vitest/mocker Redirect Mock
EPSS
5.9 Medium
CVSS3