Unbounded GraphQL WebSocket Message Buffering Causes Memory Exhaustion
Description
Hot Chocolate GraphQL Server does not enforce a maximum size for incoming GraphQL WebSocket messages.
An unauthenticated remote attacker can send an oversized WebSocket message, causing excessive memory consumption and potentially resulting in denial of service.
Applications exposing the Hot Chocolate GraphQL WebSocket endpoint without an external WebSocket message-size limit are affected.
Fixed Versions
The vulnerability is fixed in the following Hot Chocolate releases:
- 16.6.4
- 15.1.18
- 14.3.2
- 13.9.17
Users running Hot Chocolate 12, 13, 14, 15, or 16 should upgrade to the corresponding patched release or a later version as soon as possible.
Version 12 need to upgrade to Version 13 or later.
Impact
An unauthenticated remote client can cause the server to buffer an excessively large GraphQL WebSocket message in memory.
Successful exploitation can cause significant memory consumption, degrade application performance, or terminate the server process due to memory exhaustion.
No authentication, valid GraphQL operation, or knowledge of the GraphQL schema is required to trigger the vulnerable behavior.
This issue is classified as CWE-400: Uncontrolled Resource Consumption.
Recommendation
Upgrade to one of the patched releases listed above.
If an immediate upgrade is not possible, disable the Hot Chocolate GraphQL WebSocket transport until the application can be updated.
For applications using the combined GraphQL endpoint:
app.UseWebSockets();
app.MapGraphQL();replace MapGraphQL() with the HTTP-only endpoint:
app.MapGraphQLHttp();If the WebSocket endpoint is explicitly mapped, remove the MapGraphQLWebSocket() registration:
// Remove this:
app.MapGraphQLWebSocket();UseWebSockets() may also be removed if the application does not use WebSockets for anything else.
Alternatively, applications may mitigate the issue by enforcing an appropriate WebSocket message-size limit at the reverse proxy or infrastructure layer.
Acknowledgements
We would like to thank @EQSTLab for responsibly reporting this issue.
Affected versions
- HotChocolate.AspNetCorefixed in 13.9.17
- HotChocolate.AspNetCoreFrom 14.0.0 · fixed in 14.3.2
- HotChocolate.AspNetCoreFrom 15.0.0 · fixed in 15.1.18
- HotChocolate.AspNetCoreFrom 16.0.0 · fixed in 16.6.4
- HotChocolate.Fusionfixed in 13.9.17
- HotChocolate.FusionFrom 14.0.0 · fixed in 14.3.2
- HotChocolate.FusionFrom 15.0.0 · fixed in 15.1.18
- HotChocolate.Fusion.AspNetCorefixed in 16.6.4