Cross-site Request Forgery (CSRF) Affecting @fastify/csrf-protection package, versions <4.1.0>=5.0.0 <6.3.0


Severity

Recommended
0.0
medium
0
10

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

Threat Intelligence

EPSS
0.11% (32nd 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-FASTIFYCSRFPROTECTION-5441128
  • published21 Apr 2023
  • disclosed20 Apr 2023
  • creditPedro Adão, Marco Squarcina

Introduced: 20 Apr 2023

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

How to fix?

Upgrade @fastify/csrf-protection to version 4.1.0, 6.3.0 or higher.

Overview

@fastify/csrf-protection is an A plugin for adding CSRF protection to Fastify.

Affected versions of this package are vulnerable to Cross-site Request Forgery (CSRF) such that whenever userInfo parameter is missing, or its value can be predicted for the target user account, network and same-site attackers can 1. fixate a _csrf cookie in the victim's browser, and 2. forge CSRF tokens that are valid for the victim's session. This allows attackers to bypass the CSRF protection mechanism.

Note: This issue is exploitable when the library in combination with @fastify/cookie

Workaround

Developers can use a random, non-predictable userInfo parameter for each user.

CVSS Base Scores

version 3.1