{"id":"CVE-2023-29008","kind":"vulnerability","aliases":["CVE-2023-29008","GHSA-gv7g-x59x-wf8f"],"related":[],"title":"SvelteKit framework has Insufficient CSRF protection for CORS requests","description":"### Summary\nThe SvelteKit framework offers developers an option to create simple REST APIs. This is done by defining a `+server.js` file, containing endpoint handlers for different HTTP methods.\n\nSvelteKit provides out-of-the-box cross-site request forgery (CSRF) protection to its users. The protection is implemented at `kit/src/runtime/server/respond.js`. While the implementation does a sufficient job of mitigating common CSRF attacks, the protection can be bypassed by simply specifying an upper-cased `Content-Type` header value. The browser will not send uppercase characters on form submission, but this check does not block all expected cross-site requests: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests\n\n### Details\nThe CSRF protection is implemented using the code shown below.\n\n``` javascript\n\t\tconst forbidden =\n\t\t\tis_form_content_type(request) &&\n\t\t\t(request.method === 'POST' ||\n\t\t\t\trequest.method === 'PUT' ||\n\t\t\t\trequest.method === 'PATCH' ||\n\t\t\t\trequest.method === 'DELETE') &&\n\t\t\trequest.headers.get('origin') !== url.origin;\n\n\t\tif (forbidden) {\n\t\t\tconst csrf_error = error(403, `Cross-site ${request.method} form submissions are forbidden`);\n\t\t\tif (request.headers.get('accept') === 'application/json') {\n\t\t\t\treturn json(csrf_error.body, { status: csrf_error.status });\n\t\t\t}\n\t\t\treturn text(csrf_error.body.message, { status: csrf_error.status });\n\t\t}\n```\n\nIf the incoming request specifies a POST/PUT/PATCH/DELETE method, the protection will compare the server’s origin with the value of the HTTP Origin header. A mismatch between these values signals that a potential attack has been detected. The final check is performed on the request’s `Content-Type` header whether the value is either `application/x-www-form-urlencoded`, `multipart/form-data` or `text/plain`. If all the previous checks pass, the request will be rejected with an 403 error response.\nHowever, `is_form_content_type`, which is responsible for checking the value of the `Content-Type` header, is not sufficient to mitigate all possible variations of this type of attack. Since this function is checking `Content-Type` with lower-cased values, and the browser accepts upper-cased `Content-Type` header to be sent, a CSRF attack performed with the `Content-Type` header that contains an upper-cased character (e.g., `text/plaiN`) can circumvent the protection and the request will be processed by the endpoint handler.\n<!--\n### PoC\n1. Set up the SvelteKit with `POST /api/test` endpoint.\n2. Replace `REPLACE_DOMAIN` in the following HTML.\n``` html\n<script>\n(async() => {\n\tawait fetch(\"https://REPLACE_DOMAIN/api/test\", {method: \"POST\", headers:{\"Content-Type\":\"text/plaiN\"}, body: \"hello=world\"});\n})();\n</script>\n```\n3. Confirm that a POST request is processed by the server.\n-->\n### Impact\nIf abused, this issue will allow malicious requests to be submitted from third-party domains, which can allow execution of operations within the context of the victim's session, and in extreme scenarios can lead to unauthorized access to users’ accounts. This may lead to all POST operations requiring authentication being allowed in the following cases:\n1. If the target site sets `SameSite=None` on its auth cookie and the user visits a malicious site in a Chromium-based browser\n2. If the target site doesn't set the `SameSite` attribute explicitly and the user visits a malicious site with Firefox/Safari with tracking protections turned off.\n3. If the user is visiting a malicious site with a very outdated browser.\n\n### Remediations\nIt is preferred to update to SvelteKit 1.15.2. It is also recommended to explicitly set `SameSite` to a value other than `None` on authentication cookies especially if the upgrade cannot be done in a timely manner.","summary":"SvelteKit's built-in cross-site request forgery check can be bypassed by sending the Content-Type header with an uppercase character, such as text/plaiN. A malicious third-party page can then submit POST, PUT, PATCH or DELETE requests that run in the victim's logged-in session.","severity":"high","cvss":8.800000190734863,"epss":0.0037299999967217445,"exploited":false,"exploited_at":null,"products":[{"name":"@sveltejs/kit","fixed":["1.15.2"],"affected":"< 1.15.2","ecosystem":"npm"},{"name":"svelte sveltekit","fixed":["1.15.2"],"affected":"< 1.15.2","ecosystem":"vendor"}],"ecosystems":["npm","vendor"],"tags":["cwe-352","cwe-918","next.js","npm","package","self-hosted","sveltekit"],"not_affected_if":["no-cookie-auth","static-export","version-1.15.2-or-later"],"how_to_check":"Run npm ls @sveltejs/kit and check whether the version is below 1.15.2.\nReview whether auth cookies set SameSite=None; the advisory names this as the main exposure.","fix":"Upgrade @sveltejs/kit to 1.15.2 or later.\nSet SameSite to a value other than None on authentication cookies if the upgrade cannot happen soon.","status":"open","published_at":"2023-04-06T17:15:10+00:00","first_seen_at":"2026-10-23T19:11:32+00:00","triaged_at":"2026-10-23T21:43:54+00:00","updated_at":"2026-10-23T23:44:52+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-10-23T21:43:54Z","model":"claude-haiku-5-5","output":{"fix":"Upgrade @sveltejs/kit to 1.15.2 or later.\nSet SameSite to a value other than None on authentication cookies if the upgrade cannot happen soon.","reach":"internet","impact":"medium","summary":"SvelteKit's built-in cross-site request forgery check can be bypassed by sending the Content-Type header with an uppercase character, such as text/plaiN. A malicious third-party page can then submit POST, PUT, PATCH or DELETE requests that run in the victim's logged-in session.","category":"package","who_cares":["sveltekit","next.js","self-hosted","npm"],"confidence":0.8,"needs_auth":"no","worst_case":"Attacker triggers state-changing requests as a logged-in victim, possibly taking over accounts.","analyst_note":"","how_to_check":"Run npm ls @sveltejs/kit and check whether the version is below 1.15.2.\nReview whether auth cookies set SameSite=None; the advisory names this as the main exposure.\nunknown","needs_analyst":false,"not_affected_if":["version-1.15.2-or-later","no-cookie-auth","static-export"],"user_interaction":"yes","needs_special_setup":"no","severity_if_unknown":"high"},"cost_usd":0.000623,"input_tokens":4066,"output_tokens":433,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-2023':11A,19A '-29008':12A,20A '-352':25B '-918':27B '/en-us/docs/web/http/cors#simple_requests':192C '1':476C '1.15.2':549C '2':501C '3':527C '403':229C,324C 'abus':420C 'accept':240C,374C 'access':457C 'account':460C 'allow':424C,437C,471C 'also':552C 'api':100C 'application/json':241C 'application/x-www-form-urlencoded':307C 'attack':150C,285C,357C,387C 'attribut':511C 'auth':486C 'authent':469C,565C 'base':499C 'block':183C 'box':122C 'browser':169C,373C,500C,540C 'built':38B 'built-in':37B 'bypass':48B,155C 'cannot':571C 'case':162C,369C,377C,400C,475C 'charact':59B,174C,401C 'check':45B,180C,291C,315C,336C,362C 'chromium':498C 'chromium-bas':497C 'circumv':405C 'code':201C 'common':148C 'compar':263C 'const':205C,225C 'contain':109C,396C 'content':53B,164C,209C,299C,330C,342C,364C,379C,392C 'content-typ':52B,163C,298C,341C,363C,378C,391C 'context':443C 'cooki':487C,566C 'cor':8A 'creat':97C 'cross':41B,124C,187C,231C 'cross-sit':40B,123C,186C,230C 'csrf':5A,128C,149C,195C,226C,386C 'csrf_error.body':244C 'csrf_error.body.message':249C 'csrf_error.status':246C,251C 'cve':10A,18A 'cwe':24B,26B 'defin':105C 'delet':76B,219C 'detail':193C 'detect':288C 'develop':93C 'developer.mozilla.org':191C 'developer.mozilla.org/en-us/docs/web/http/cors#simple_requests':190C 'differ':113C 'doesn':506C 'domain':434C 'done':103C,573C 'e.g':402C 'either':306C 'endpoint':110C,416C 'error':227C,228C,325C 'especi':567C 'execut':438C 'expect':185C 'explicit':512C,555C 'extrem':451C 'file':108C 'final':290C 'firefox/safari':521C 'follow':474C 'forbidden':206C,224C,237C 'forgeri':44B,127C 'form':176C,208C,234C,329C 'framework':2A,91C 'function':360C 'ghsa':14A 'ghsa-gv7g-x59x-wf8f':13A 'gv7g':15A 'handler':111C,417C 'header':55B,166C,275C,301C,344C,381C,394C 'host':33B 'howev':327C 'http':114C,273C 'impact':418C 'implement':136C,141C,198C 'incom':254C 'insuffici':4A 'issu':422C 'javascript':204C 'job':145C 'json':243C 'kit/src/runtime/server/respond.js':138C 'lead':454C,463C 'log':85B 'logged-in':84B 'lower':368C 'lower-cas':367C 'malici':64B,425C,493C,518C,534C 'manner':577C 'may':462C 'method':115C,259C 'mismatch':277C 'mitig':147C,349C 'multipart/form-data':308C 'next.js':28B 'none':483C,563C 'npm':29B 'offer':92C 'oper':440C,467C 'option':95C 'origin':221C,267C,274C 'out-of-the-box':118C 'outdat':539C 'packag':30B 'page':68B 'parti':67B,433C 'pass':316C 'patch':74B,217C 'perform':293C,388C 'possibl':351C 'post':72B,213C,466C 'post/put/patch/delete':258C 'potenti':284C 'prefer':544C 'previous':314C 'process':413C 'protect':6A,129C,134C,152C,196C,261C,407C,524C 'provid':117C 'put':73B,215C 'recommend':553C 'reject':321C 'remedi':541C 'request':9A,43B,77B,126C,189C,211C,255C,296C,318C,410C,426C 'request.headers.get':220C,239C 'request.method':212C,214C,216C,218C,233C 'requir':468C 'respons':326C,334C 'rest':99C 'return':242C,247C 'run':79B 'samesit':482C,510C,557C 'scenario':452C 'self':32B 'self-host':31B 'send':50B,172C 'sent':384C 'server':265C 'server.js':107C 'session':87B,448C 'set':481C,508C,556C 'shown':202C 'signal':281C 'simpl':98C 'simpli':157C 'sinc':358C 'site':42B,125C,188C,232C,480C,494C,505C,519C,535C 'specifi':158C,256C 'status':245C,250C 'submiss':177C,235C 'submit':71B,429C 'suffici':144C,347C 'summari':88C 'svelte':22A 'sveltejs/kit':21A 'sveltekit':1A,23A,34B,35B,90C,116C,548C 'target':479C,504C 'text':248C 'text/plain':62B,310C,403C 'third':66B,432C 'third-parti':65B,431C 'time':576C 'track':523C 'turn':525C 'type':54B,165C,210C,300C,331C,343C,355C,365C,380C,393C 'unauthor':456C 'updat':546C 'upgrad':570C 'upper':161C,376C,399C 'upper-cas':160C,375C,398C 'uppercas':58B,173C 'url.origin':222C 'use':199C 'user':132C,459C,490C,515C,530C 'valu':167C,270C,280C,304C,338C,370C,560C 'variat':352C 'victim':82B,446C 'visit':491C,516C,532C 'wf8f':17A 'whether':302C 'within':441C 'x59x':16A","nicknames":[],"mitigations":[],"who_affected":null,"tier":null,"verified":{},"analyst_revisit_at":null,"first_public_at":"2023-04-06T17:15:10+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-gv7g-x59x-wf8f","url":"https://github.com/advisories/GHSA-gv7g-x59x-wf8f","severity":"high","published_at":"2023-04-07T19:23:31+00:00","modified_at":"2026-10-18T14:58:05+00:00","first_seen_at":"2026-10-23T19:11:32+00:00","fetched_at":"2026-10-23T19:11:32+00:00","note":null},{"source":"nvd","external_id":"CVE-2023-29008","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-29008","severity":null,"published_at":"2023-04-06T17:15:10+00:00","modified_at":"2026-06-17T05:49:10+00:00","first_seen_at":"2026-10-23T23:44:52+00:00","fetched_at":"2026-10-23T23:44:52+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}