All vulnerabilities

Servers and applications

GHSA-mqj6-p822-rq2j

SvelteKit CSRF origin check does not cover some browser-generated requests to `+server` endpoints

Severity
Low 3.1
Published
25 Nov 2026
Last changed
25 Nov 2026
Added to UpHeron
25 Nov 2026
Fixed in
3.4.1
Weakness
Cross-site request forgery (CWE-352)
Attack
Over the network · Only under certain conditions · No login needed · Needs someone to click or open something
Attacker can
Change some data
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:L/A:N
Sources
Project advisories (GitHub)

Description

SvelteKit's built-in CSRF protection checks the Origin header of cross-site POST, PUT, PATCH and DELETE requests whose content type a browser can send without a CORS preflight. Some browser-generated requests, such as those sent by hyperlink auditing (), use a content type that was not covered by this check. As a result, such requests could reach +server` endpoint handlers without the origin check.

The impact is low. An application is only affected if all of the following are true:

  • It has a +server endpoint that performs a state-changing action on POST, PUT, PATCH or DELETE without reading or validating the request body (the body of these requests is fixed and cannot be controlled).
  • It authenticates that endpoint with cookies.
  • For cross-site requests: the session cookie is set with SameSite=None and the user's browser sends third-party cookies.
From sveltejs/kit's security advisory. Shortened; the full text is there.

Workarounds

Reject cross-origin state-changing requests in a handle hook, or in the affected endpoints, by checking that the Origin header matches your application's origin. Alternatively, require a request body or a custom request header for state-changing endpoints, or use SameSite=Lax or SameSite=Strict session cookies.

Workarounds as given by sveltejs/kit's security advisory.

Affected software

SoftwareAffected versions
SvelteKitServers and applications · github:sveltejs/kit
  • Every version before 3.4.1

About SvelteKit

web development, streamlined

From its GitHub repository.
Weekly downloads (npm)
5,128,894npm, 22 Nov 2026
GitHub stars
20,926GitHub, 22 Nov 2026
Forks
2,391GitHub, 22 Nov 2026
Latest release
@sveltejs/[email protected]GitHub, 22 Nov 2026
Released
18 Nov 2026GitHub
License
MITGitHub
First published on GitHub
15 Oct 2020GitHub

References