CVE-2026-40074: Denial of Service via Unhandled Exceptions in SvelteKit Redirects
Vulnerability ID: CVE-2026-40074
CVSS Score: 6.3
Published: 2026-04-10
SvelteKit versions prior to 2.57.1 are vulnerable to a Denial of Service (DoS) condition due to improper handling of exceptional conditions in the redirect() function. When supplied with invalid HTTP header characters, the underlying JavaScript runtime throws a TypeError that terminates the process or hangs the request.
TL;DR
A DoS vulnerability in SvelteKit < 2.57.1 allows attackers to crash the server or hang requests by injecting invalid HTTP header characters (like CRLF) into the location parameter of the redirect() function.
⚠️ Exploit Status: POC
Technical Details
- CWE ID: CWE-755
- Attack Vector: Network
- CVSS 4.0 Score: 6.3 (Medium)
- Impact: Denial of Service (DoS)
- Exploit Status: Proof of Concept (PoC)
- Vulnerable Component: redirect() function / internal_respond
Affected Systems
- SvelteKit
- Node.js (underlying runtime impact)
- Bun (underlying runtime impact)
- Deno (underlying runtime impact)
-
SvelteKit: < 2.57.1 (Fixed in:
2.57.1)
Code Analysis
Commit: 10d7b44
safer redirects
Adds validation in internal index.js using `new Headers({ location })` and adds a try...catch block in server/respond.js falling back to `handle_fatal_error`.
Exploit Details
-
Framework Test Suite: Test case demonstrating the crash via
request.get('/redirect/in-handle?location=%2Fredirect%2Fc%0D%0Aset-cookie%3A%20evil%3D1')
Mitigation Strategies
- Upgrade @sveltejs/kit to a patched version (2.57.1+).
- Implement application-level input sanitization for any user-provided redirect destinations.
- Ensure production deployments utilize process managers (like PM2 or container orchestration) to automatically recover from unhandled exceptions.
- Deploy WAF rules to block incoming requests containing CRLF sequences in query parameters.
Remediation Steps:
- Identify all instances of
redirect()calls in the SvelteKit application. - Trace the data flow to determine if untrusted user input can reach the
locationparameter. - Update the
@sveltejs/kitdependency to version 2.57.1 by runningnpm update @sveltejs/kitor equivalent. - Run the application test suite to ensure the upgrade does not introduce regressions.
- Deploy the updated application to production environments.
References
- GitHub Security Advisory GHSA-3f6h-2hrp-w5wx
- Fix Commit: safer redirects
- SvelteKit 2.57.1 Release Notes
- NVD CVE-2026-40074 Details
Read the full report for CVE-2026-40074 on our website for more details including interactive diagrams and full exploit analysis.
Top comments (0)