CVE-2020-28482: Cross-site Request Forgery in fastify-csrf

fastify-csrf Updated 02 Oct 2025

Summary

20/01/2021
Yes i
High
8.8

CVE-2020-28482: Cross-site Request Forgery in fastify-csrf. Affects fastify-csrf versions < 3.0.0. Fixed in 3.0.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The fastify-csrf package is an npm package that provides Cross-Site Request Forgery (CSRF) protection for Fastify, a web framework for Node.js. It helps prevent unauthorized requests from being made on behalf of authenticated users. The package generates CSRF tokens and adds them to requests to ensure their authenticity. However, versions before 3.0.0 have several vulnerabilities that affect the effectiveness of CSRF protection.

Vulnerability Detail

The vulnerability in fastify-csrf before 3.0.0 arises from insecure defaults and the availability of the CSRF token in the GET query parameter. The package's generated cookie used insecure defaults and did not have the httpOnly flag set, making it vulnerable to cross-site scripting attacks. Additionally, the CSRF token was exposed in the GET query parameter, which could be intercepted and used by an attacker to forge requests on behalf of authenticated users. This vulnerability can lead to unauthorized actions being performed by attackers, potentially compromising the security and integrity of the application.

How To Fix

Latest published version: 3.1.0 as of 23 Oct 2026

npm install fastify-csrf@3.1.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

3.0.0

This is the first release that contains the fix.

npm install fastify-csrf@3.0.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no specific workaround mentioned for this vulnerability. The recommended solution is to upgrade to the fixed version of the fastify-csrf package.

Conclusion

The fastify-csrf package before version 3.0.0 has vulnerabilities that affect its CSRF protection. Upgrading to version 3.0.0 or later is recommended to fix these vulnerabilities and ensure the security of the application. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for fastify-csrf →

Share this vulnerability

FAQ

fastify-csrf is an npm package that provides Cross-Site Request Forgery (CSRF) protection for Fastify, a web framework for Node.js. It helps prevent unauthorized requests from being made on behalf of authenticated users.

Cross-Site Request Forgery (CSRF) is an attack that tricks the victim into submitting a malicious request. It occurs when a malicious website or application forces a user's browser to perform unwanted actions on a trusted website where the user is authenticated.

This vulnerability can allow attackers to perform unauthorized actions on behalf of authenticated users. They can manipulate the application's state, access sensitive information, or perform actions that the user did not intend to perform.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities, using just the package-lock.json file.

For further support on vulnerability remediation, you can contact info@devnack.com. They can provide guidance and assistance in fixing the vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for fastify-csrf.

How To Fix

Latest published version: 3.1.0 as of 23 Oct 2026

npm install fastify-csrf@3.1.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

3.0.0

This is the first release that contains the fix.

npm install fastify-csrf@3.0.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback