Fastify: Incorrect Content-Type parsing can lead to CSRF attack
Package
Affected versions
>= 4.0.0, < 4.10.2
>= 3.0.0, < 3.29.4
Patched versions
4.10.2
3.29.4
Description
Published to the GitHub Advisory Database
Nov 21, 2022
Reviewed
Nov 21, 2022
Published by the National Vulnerability Database
Nov 22, 2022
Last updated
Jan 31, 2023
Impact
The attacker can use the incorrect
Content-Typeto bypass thePre-Flightchecking offetch.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 acceptsapplication/jsoncontent type, thus bypassing any CORS protection, and therefore they could lead to a Cross-Site Request Forgery attack.Patches
For
4.xusers, please update to at least4.10.2For
3.xusers, please update to at least3.29.4Workarounds
Implement Cross-Site Request Forgery protection using
@fastify/csrf.References
Check out the HackerOne report: https://hackerone.com/reports/1763832.
For more information
Fastify security policy
References