CVE-2023-27495
JavaScript vulnerability analysis and mitigation

Overview

@fastify/csrf-protection is a plugin which helps protect Fastify servers against CSRF attacks. The vulnerability affects versions up to 4.0.1 and versions 5.0.0 to 6.2.0. The CSRF protection enforced by the @fastify/csrf-protection library in combination with @fastify/cookie can be bypassed from network and same-site attackers under certain conditions. This vulnerability was discovered in April 2023 (NVD, GitHub Advisory).

Technical details

The vulnerability exists because @fastify/csrf-protection supports an optional userInfo parameter that binds the CSRF token to the user, which was introduced to prevent cookie-tossing attacks as a fix for CVE-2021-29624. When the userInfo parameter is missing or its value can be predicted for the target user account, attackers can fixate a _csrf cookie in the victim's browser and forge CSRF tokens that are valid for the victim's session. The vulnerability has a CVSS v3.1 base score of 6.5 MEDIUM (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N) (NVD).

Impact

If successfully exploited, this vulnerability allows attackers to bypass the CSRF protection mechanism, potentially leading to unauthorized actions being performed on behalf of authenticated users. The impact primarily affects the integrity of user sessions, while confidentiality and availability remain unaffected (GitHub Advisory).

Mitigation and workarounds

The vulnerability has been patched in versions 6.3.0 and 4.1.0. The fix includes a server-defined secret hmacKey that cryptographically binds the CSRF token to the value of the _csrf cookie and the userInfo parameter, making tokens non-spoofable by attackers. For users unable to upgrade, a workaround is available by using a random, non-predictable userInfo parameter for each user (GitHub Advisory).

Additional resources


SourceThis report was generated using AI

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management