Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 2 min read

CVE-2026-128118: CVE-2026-128118: Server-Only Module Guard Bypass and Secret Exposure in SvelteKit

CVE-2026-128118: Server-Only Module Guard Bypass and Secret Exposure in SvelteKit Vulnerability ID: CVE-2026-128118 CVSS Score: 7.5 Published: 2026-11-16 CVE-2026-128118 (GHSA-m9j8-jcmv-hp69) is an information discl

CVE-2026-128118: Server-Only Module Guard Bypass and Secret Exposure in SvelteKit

Vulnerability ID: CVE-2026-128118
CVSS Score: 7.5
Published: 2026-11-16

CVE-2026-128118 (GHSA-m9j8-jcmv-hp69) is an information disclosure vulnerability affecting the SvelteKit framework (@sveltejs/kit) from version 3.0.0 through 3.1.0. A design flaw in the build-time Vite module guard plugin (plugin_guard) failed to register src/params.js as a client entry point and implemented a fail-open validation model. Consequently, server-only modules and private environment variables imported directly or dynamically within parameter matchers were compiled into publicly accessible client-side JavaScript bundles without triggering a build error.

TL;DR

A fail-open logic flaw and missing client entrypoint registration in SvelteKit's build-time module guard allow server-only modules and private environment variables ($app/env/private) imported via src/params.js to be bundled into public client-side JavaScript assets in @sveltejs/kit versions 3.0.0 through 3.1.0.

⚠️ Exploit Status: POC

Technical Details

  • Vulnerability ID: CVE-2026-128118 / GHSA-m9j8-jcmv-hp69
  • Affected Package: @sveltejs/kit (3.0.0 - 3.1.0)
  • Patched Version: @sveltejs/[email protected]
  • Weakness Class: CWE-200 / CWE-668 (Information Exposure / Wrong Sphere)
  • CVSS v3.1 Score: 7.5 High (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N)
  • EPSS Score: 0.282% (21.02nd Percentile)
  • Exploit Status: Proof-of-Concept (Unit test reproduction in patch commit)
  • CISA KEV Status: Not Listed

Affected Systems

  • @sveltejs/kit (SvelteKit Web Framework)
  • @sveltejs/kit: >= 3.0.0, < 3.1.1 (Fixed in: 3.1.1)

Code Analysis

Commit: ae07803

Register manifest_data.params as a client entrypoint in plugin_guard, enforce fail-closed behavior when server-only modules enter the client bundle, and strip query parameters before server-only path validation.

if (manifest_data.params) add_entrypoint(manifest_data.params);

let chain = find_chain(normalized, [normalized], (id) => entrypoints.has(id));
if (!chain) {
  visited = new Set([normalized]);
  chain = find_chain(normalized, [normalized], (id) => !import_map.has(id)) ?? [normalized];
}

e.server_only_import({ module: normalized, chain: pyramid }, { stackless: true });

Exploit Details

  • GitHub: Official SvelteKit security fix commit containing test suite reproduction apps demonstrating static and dynamic imports of server secrets via src/params.js.

Mitigation Strategies

  • Upgrade @sveltejs/kit to version 3.1.1 or later to enforce fail-closed build-time checks on server-only modules.
  • Audit src/params.js and all transitive imports to ensure no .server.js files, /server/ directories, or private environment modules ($app/env/private) are referenced.
  • Rotate any credentials, API keys, or secrets that were imported directly or transitively by src/params.js in builds produced with @sveltejs/kit 3.0.0 through 3.1.0.
  • Move secret-dependent route validation or database lookups out of parameter matchers and into +page.server.js load functions or src/hooks.server.js.

Remediation Steps:

  1. Update package.json to require @sveltejs/kit@^3.1.1 using npm, pnpm, or yarn.
  2. Run the production build (vite build) to verify whether plugin_guard detects any prohibited server-only imports in src/params.js.
  3. Inspect existing production build artifacts in .svelte-kit/output/client/ for any leaked environment variable strings (e.g., grep -rn "PRIVATE_" .svelte-kit/output/client/).
  4. Revoke and regenerate any secrets found in compiled client chunks and redeploy the clean build.

References

Read the full report for CVE-2026-128118 on our website for more details including interactive diagrams and full exploit analysis.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.