CVE-2022-39386 fastify-websocket vulnerable to uncaught exception via crash on malformed packet
Attackers can crash applications using the deprecated fastify-websocket library by sending malformed packets, requiring an upgrade to patched versions.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2022-39386?
CVE-2022-39386 is a high-severity denial of service vulnerability in fastify-websocket, published on 8 Nov 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
@fastify/websocket provides WebSocket support for Fastify. Any application using @fastify/websocket could crash if a specific, malformed packet is sent. All versions of fastify-websocket are also impacted. That module is deprecated, so it will not be patched. This has been patched in version 7.1.1 (fastify v4) and version 5.0.1 (fastify v3). There are currently no known workarounds. However, it should be possible to attach the error handler manually. The recommended path is upgrading to the patched versions.
Weakness: CWE-248
Which versions are affected by CVE-2022-39386?
6 open source packages ship an affected version, including fastify-websocket and @fastify/websocket. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
fastify-websocket npm | All versions to 4.3.0 | None |
fastify-websocket npm | All versions to 4.3.0 | None |
@fastify/websocket npm | From 5.0.0 | 5.0.1 |
@fastify/websocket npm | From 5.0.0 | 5.0.1 |
@fastify/websocket npm | From 6.0.0 | 7.1.1 |
@fastify/websocket npm | From 6.0.0 | 7.1.1 |
Products include Fastify Websocket.
How do I fix CVE-2022-39386?
Upgrade to a fixed version.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
Is CVE-2022-39386 being exploited?
There is no known exploitation of CVE-2022-39386 in the wild and no public exploit code.
Sources
Also known as GHSA-4pcg-wr6c-h9cq.