Medium

Lack of protection against cookie tossing attacks in fastify-csrf

  • Disclosed: 17.05.2021
  • Updated: 11.10.2026 10:22

Impact

Users that used fastify-csrf with the "double submit" mechanism using cookies with an application deployed across multiple subdomains, e.g. "heroku"-style platform as a service.

Patches

Version 3.1.0 of the fastify-csrf fixes it. See https://github.com/fastify/fastify-csrf/pull/51 and https://github.com/fastify/csrf/pull/2.

The user of the module would need to supply a userInfo when generating the CSRF token to fully implement the protection on their end. This is needed only for applications hosted on different subdomains.

Workarounds

None available.

References

  1. https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html
  2. https://owasp.org/www-pdf-archive/David_Johansson-Double_Defeat_of_Double-Submit_Cookie.pdf

Credits

This vulnerability was found by Xhelal Likaj xhelallikaj20@gmail.com.

For more information

If you have any questions or comments about this advisory:

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package fastify-csrf < 3.1.0 3.1.0

References

CVSS score 6.5/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
Weakness (CWE)
CWE-352, CWE-565
Platform
npm
Package
fastify-csrf
Disclosed
17.05.2021
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-rc4q-9m69-gqp8 - CC BY 4.0

Vulnerability history: fastify-csrf

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
2
First → latest
01.2021 05.2021
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • High 1
  • Medium 1

Disclosures per year

  1. 2021: 2
  2. 2022: 0
  3. 2023: 0
  4. 2024: 0
  5. 2025: 0
  6. 2026: 0
  1. Lack of protection against cookie tossing attacks in fastify-csrf this entry
    Medium · 6.5 CVE-2021-29624 < 3.1.0 3.1.0
  2. High · 8.8 CVE-2020-28482 < 3.0.0 3.0.0

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.