CVE-2022-39386 is a high-severity (CVSS 7.5) CWE-248 vulnerability in @fastify/websocket. A fix is available for @fastify/websocket — see the affected versions and patch details below.
fastify-websocket vulnerable to uncaught exception via crash on malformed packet
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2022-39386.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
@fastify/websocketnpmfastify-websocketnpmDescription
Impact
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.
Patches
This has been patched in v7.1.1 (fastify v4) and v5.0.1 (fastify v3).
Workarounds
No known workaround is available. However, it should be possible to attach the error handler manually. The recommended path is upgrading to the patched versions.
Credits
marcolanaro for finding and patching this vulnerability
For more information
If you have any questions or comments about this advisory:
- Open an issue in @fastify/websocket
- Email us at [email protected]
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @fastify/websocket | ≥ 5.0.0&&< 5.0.1 | 5.0.1npm install @fastify/websocket@5.0.1 |
| 📦npm | @fastify/websocket | ≥ 6.0.0&&< 7.1.1 | 7.1.1npm install @fastify/websocket@7.1.1 |
| 📦npm | fastify-websocket | all versions | No fix |
Affected Products
websocketfastifyDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @fastify/websocket, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update @fastify/websocket to 5.0.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2022-39386 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Frequently Asked Questions
Is CVE-2022-39386 in your dependencies?
Find it across npm, including transitive dependencies.