Executive brief
Fastify is a popular Node.js web framework used to build fast and low-overhead web applications. An attacker can craft a malicious Content-Type HTTP header that causes the application to crash, leading to a denial of service attack that renders the web service unavailable. No authentication or user interaction is required; the attack can be initiated directly over the network.
Technical details
The vulnerability is an improper exception handling flaw (CWE-754) in Fastify's content type parser. The root cause lies in insufficient validation of Content-Type header values before they are processed by the body parser. An attacker can supply a malicious Content-Type header containing prototype pollution-related keywords (such as __proto__ or constructor properties) that trigger an unhandled exception when the parser attempts to process the value, crashing the entire application. The attack vector is network-based, requires no authentication or user interaction, and affects only the 4.x version branch (v3.x is not affected). The issue was patched in version 4.8.1 by adding safeguards against malicious content types in the content type parser logic.
Affected products
- Fastify fastify >=4.0.0, <4.8.1
Timeline
- 2022-10-11: disclosed
- 2022-10-10: patched: fix committed on 2022-10-10; patch released in version 4.8.1
References
- https://github.com/fastify/fastify/security/advisories/GHSA-455w-c45v-86rg
- https://github.com/fastify/fastify/commit/fbb07e8dfad74c69cd4cd2211aedab87194618e3
- https://github.com/fastify/fastify
- https://github.com/fastify/fastify/security/policy
- https://hackerone.com/bugs?report_id=1715536&subject=fastify