Cross-Site Request Forgery (CSRF) in fastify-csrf (CVE-2021-29624)
Summary
Vulnerability in fastify-csrf (CVE-2021-29624). Data can be tampered with by attackers. Exploitable via userInfo. Mitigation: upgrade to 3.1.0 or later.
Original description
The description as published by the source.
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
- https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html
- https://owasp.org/www-pdf-archive/David_Johansson-Double_Defeat_of_Double-Submit_Cookie.pdf
Credits
This vulnerability was found by Xhelal Likaj .
For more information
If you have any questions or comments about this advisory:
- Open an issue in fastify-csrf
- Email us at hello@matteocollina.com
Source: OSV.dev (Open Source Vulnerabilities) NVD GitHub Advisory OSV
Auto-generated summary
Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.
A vulnerability tracked as CVE-2021-29624 has been found in fastify-csrf.
Attackers can target a specific entry point like userInfo over the network to misuse the product.
Data can be tampered with by attackers.
What to do: upgrade fastify-csrf to 3.1.0 or later.
If unsure, ask your IT team or search "fastify-csrf CVE-2021-29624" on the vendor's site.
CVE-2021-29624 (fastify-csrf) — CWE-352
Attack vector: remote (network-reachable) / unauthenticated
Attack surface: userInfo
Patched: 3.1.0 — apply immediately
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
CSRF (CWE-352) exists in fastify-csrf. Attackers reach the vulnerable code path via userInfo without authentication.
Check the vendor advisory for the affected versions of fastify-csrf. Attack surface: userInfo.
Severity: ?. Data can be tampered with by attackers.
Update to 3.1.0.
Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.
Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'fastify-csrf' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1Identify exposure identify
grep -r 'fastify-csrf' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
fastify-csrfを grep し、稼働しているサービス・バージョンを把握する。 -
2Apply patch patch
Upgrade fastify-csrf to 3.1.0ステージング環境で 3.1.0 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
3Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Affected packages
References
- advisory nvd.nist.gov
- web github.com
- web github.com
- web github.com
- web cheatsheetseries.owasp.org
- web github.com
- web owasp.org