Fastify Vulnerable to DoS via Unbounded Memory Allocation in sendWebStream
Affected releases · fastify
- 5.x5.0.0 – 5.7.2Fixed in 5.7.3
- 4.x and older0.0.1 – 4.29.1No fix, no longer updated
On 5.x, the newest line:
npm install fastify@5.7.3Affected
5.0.0 – 5.7.2
17 releases
Fixed
5.7.3 – 5.12.7
22 releases, latest
Affected
4.0.0 – 4.29.1
61 releases
Affected
3.0.0 – 3.29.5
71 releases
Affected
2.0.0 – 2.15.3
25 releases
Affected
1.0.0 – 1.14.6
31 releases
Affected
0.0.1 – 0.43.0
73 releases
Is your project affected?
Paste your package.json, or type the range you declare for fastify. It is read in your browser and sent nowhere.
What happens
Impact
A Denial of Service vulnerability in Fastify’s Web Streams response handling can allow a remote client to exhaust server memory. Applications that return a ReadableStream (or Response with a Web Stream body) via reply.send() are impacted. A slow or non-reading client can trigger unbounded buffering when backpressure is ignored, leading to process crashes or severe degradation.
Patches
The issue is fixed in Fastify 5.7.3. Users should upgrade to 5.7.3 or later.
Workarounds
Avoid sending Web Streams from Fastify responses (e.g., ReadableStream or Response bodies). Use Node.js streams (stream.Readable) or buffered payloads instead until the project can upgrade.
References