CVSS 4.8 MEDIUM Truy cập trái phép

Nuxt dev server exposes generated appSecret through Vite file serving

Mã khác
GHSA-3xf4-9g3c-4h4w
Công bố
Cập nhật
Lần đầu thấy
Nguồn
GitHub Advisory, NVD, CVE.org, OSV.dev

Mô tả

Impact

When no appSecret is configured (via NUXT_APP_SECRET, NITRO_APP_SECRET or runtimeConfig.appSecret), nuxt dev generates a development secret and stores it in <buildDir>/app-secret (by default .nuxt/app-secret). The build directory is inside the directories that Nuxt passes to Vite's server.fs.allow, so the file can be fetched from the dev server:

curl http://<dev-server>/_nuxt/@fs/<absolute-path-to-project>/.nuxt/app-secret

Anyone who can read it can compute every secret derived from it with deriveSecret(), including the default password used by useSession, and so can forge session cookies accepted by that dev server.

Exploitation requires direct HTTP access to the dev server. nuxt dev listens on localhost by default, so this mainly affects dev servers that are exposed to a network (for example with --host, a published container port or a tunnel). A malicious website cannot read the file through a developer's browser: Vite's CORS and host checks prevent pages on other origins from reading the response.

Production builds never generate an appSecret and are not affected. Dev servers with an explicitly configured appSecret do not use the generated file.

Patches

Fixed in @nuxt/vite-builder 4.6.3, which nuxt 4.6.3 depends on. The dev server now adds app-secret to Vite's server.fs.deny, keeping Vite's default deny list.

Workarounds

Set NUXT_APP_SECRET in .env to a random value of at least 32 characters (for example the output of openssl rand -base64 32), or avoid exposing the dev server to untrusted networks.

If a dev server using a generated secret has been reachable by untrusted clients, delete .nuxt/app-secret (a new secret is generated on the next nuxt dev) or set NUXT_APP_SECRET. Either invalidates existing dev sessions.

Điểm và phân loại

CVSS
4.8 MEDIUM v3.1
Nguồn điểm
NVD
Mức độ (theo nguồn)
MEDIUM
EPSS
0.21%
CWE
CWE-552

Vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N

Ảnh hưởng

Package Bản bị ảnh hưởng Bản đã sửa
npm @nuxt/vite-builder >= 4.6.0, < 4.6.3 4.6.3

Sản phẩm

  • nuxt nuxt

Vì sao bị lọc

  • CVSS 4.8 < 8.0 và không thuộc CISA KEV

Loại tác động

Truy cập trái phép
từ khoá "default password"

Dữ liệu riêng của nguồn

CVE.org · Đơn vị cấp mã
GitHub_M
CVE.org · SSVC
Tự động hoá được: no · Khai thác: none · Tác động kỹ thuật: partial
OSV.dev · ID
GHSA-3xf4-9g3c-4h4w

Tham khảo