6.5
MEDIUM
CVE-2023-29020
Fastify Passport Unpoured CSRF Token Defense.
Description

@fastify/passport is a port of passport authentication library for the Fastify ecosystem. The CSRF (Cross-Site Request Forger) protection enforced by the `@fastify/csrf-protection` library, when combined with `@fastify/passport` in affected versions, can be bypassed by network and same-site attackers. `fastify/csrf-protection` implements the synchronizer token pattern (using plugins `@fastify/session` and `@fastify/secure-session`) by storing a random value used for CSRF token generation in the `_csrf` attribute of a user's session. The `@fastify/passport` library does not clear the session object upon authentication, preserving the `_csrf` attribute between pre-login and authenticated sessions. Consequently, CSRF tokens generated before authentication are still valid. Network and same-site attackers can thus obtain a CSRF token for their pre-session, fixate that pre-session in the victim's browser via cookie tossing, and then perform a CSRF attack after the victim authenticates. As a solution, newer versions of `@fastify/passport` include the configuration options: `clearSessionOnLogin (default: true)` and `clearSessionIgnoreFields (default: ['passport', 'session'])` to clear all the session attributes by default, preserving those explicitly defined in `clearSessionIgnoreFields`.

INFO

Published Date :

April 21, 2023, 11:15 p.m.

Last Modified :

May 3, 2023, 2:42 p.m.

Remotely Exploitable :

Yes !

Impact Score :

3.6

Exploitability Score :

2.8
Affected Products

The following products are affected by CVE-2023-29020 vulnerability. Even if cvefeed.io is aware of the exact versions of the products that are affected, the information is not represented in the table below.

ID Vendor Product Action
1 Fastify passport
References to Advisories, Solutions, and Tools

We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).

Results are limited to the first 15 repositories due to potential performance issues.

The following list is the news that have been mention CVE-2023-29020 vulnerability anywhere in the article.

The following table lists the changes that have been made to the CVE-2023-29020 vulnerability over time.

Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.

  • CVE Modified by [email protected]

    May. 14, 2024

    Action Type Old Value New Value
  • Initial Analysis by [email protected]

    May. 03, 2023

    Action Type Old Value New Value
    Added CVSS V3.1 NIST AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
    Changed Reference Type https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern No Types Assigned https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern Technical Description
    Changed Reference Type https://github.com/fastify/fastify-passport/commit/07c90feab9cba0dd4779e47cfb0717a7e2f01d3d No Types Assigned https://github.com/fastify/fastify-passport/commit/07c90feab9cba0dd4779e47cfb0717a7e2f01d3d Patch
    Changed Reference Type https://github.com/fastify/fastify-passport/security/advisories/GHSA-2ccf-ffrj-m4qw No Types Assigned https://github.com/fastify/fastify-passport/security/advisories/GHSA-2ccf-ffrj-m4qw Vendor Advisory
    Changed Reference Type https://owasp.org/www-community/attacks/csrf No Types Assigned https://owasp.org/www-community/attacks/csrf Technical Description
    Added CWE NIST CWE-352
    Added CPE Configuration OR *cpe:2.3:a:fastify:passport:*:*:*:*:*:node.js:*:* versions up to (excluding) 1.1.0 *cpe:2.3:a:fastify:passport:*:*:*:*:*:node.js:*:* versions from (including) 2.0.0 up to (excluding) 2.3.0
EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days. Following chart shows the EPSS score history of the vulnerability.
CWE - Common Weakness Enumeration

While CVE identifies specific instances of vulnerabilities, CWE categorizes the common flaws or weaknesses that can lead to vulnerabilities. CVE-2023-29020 is associated with the following CWEs:

Exploit Prediction

EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days.

0.08 }} 0.01%

score

0.34049

percentile

CVSS31 - Vulnerability Scoring System
Attack Vector
Attack Complexity
Privileges Required
User Interaction
Scope
Confidentiality
Integrity
Availability