The vulnerability lies in the unbounded creation of WebSocket subscriptions, leading to a denial of service. The provided patch (0977a4e6b41b7cfe3e9d8ba84a43458a2b0c54c2) addresses this by introducing a max_subscriptions_per_connection limit. The analysis of the patch identified the two specific functions responsible for handling subscription requests for the different WebSocket protocols used by strawberry-graphql.
-
For the modern graphql-transport-ws protocol, the GraphQLTransportWSHandler.handle_subscribe function in strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py is the vulnerable function. The patch adds a check to limit the number of concurrent operations (self.operations).
-
For the legacy graphql-ws protocol, the GraphQLWSHandler.handle_start function in strawberry/subscriptions/protocols/graphql_ws/handlers.py is the vulnerable function. The patch adds a similar check to limit the number of concurrent tasks (self.tasks).
These two functions are the direct entry points for the vulnerability, as they are responsible for allocating resources for each subscription request. An exploit would repeatedly call these functions, and they would therefore be prominent in any runtime profile or stack trace during such an attack.