Skip to main content
Vulnerability Database/CVE-2026-107727

CVE-2026-107727: Strawberry GraphQL DOS Vulnerability

CVE-2026-107727 is a denial of service vulnerability in Strawberry GraphQL that allows attackers to exhaust subscription slots on WebSocket connections. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-107727 Overview

Strawberry GraphQL contains a resource exhaustion vulnerability in its legacy graphql-ws subscription handler. The flaw exists in strawberry/subscriptions/protocols/graphql_ws/handlers.py across versions 0.312.3 through 0.327.1. Completed subscription operations are not removed from the handler's internal self.tasks and self.subscriptions dictionaries. When max_subscriptions_per_connection is configured, a client reusing a persistent WebSocket can issue one-shot subscriptions with distinct operation IDs to fill all slots. Later legitimate operations on that connection are then rejected with Subscription limit reached. The modern graphql-transport-ws protocol and deployments without the per-connection cap are not affected. The issue is fixed in version 0.327.2.

Critical Impact

A single authenticated or unauthenticated WebSocket client can exhaust the configured subscription slots on its own connection, blocking all subsequent GraphQL operations until the connection is torn down.

Affected Products

  • Strawberry GraphQL versions 0.312.3 through 0.327.1
  • Deployments using the legacy graphql-ws subscription protocol
  • Deployments with max_subscriptions_per_connection configured

Discovery Timeline

  • 2026-10-08 - CVE-2026-107727 published to NVD
  • 2026-10-13 - Last updated in NVD database

Technical Details for CVE-2026-107727

Vulnerability Analysis

Strawberry GraphQL implements two subscription transports: the legacy graphql-ws protocol and the modern graphql-transport-ws protocol. The legacy handler tracks each active subscription in two dictionaries keyed by operation ID: self.subscriptions holds the async result source, and self.tasks holds the asyncio task driving the operation. When a subscription completes naturally, the handler sends a complete message to the client but does not pop the operation ID from either dictionary. The entries persist for the lifetime of the WebSocket connection. This is a classic uncontrolled resource consumption flaw tracked under [CWE-400].

Root Cause

The legacy handler lacks a finally block in its operation runner to release bookkeeping state after an operation terminates. The slot accounting used by max_subscriptions_per_connection reads directly from self.subscriptions, so stale entries from already-completed one-shot subscriptions are counted as live. Only an explicit client stop message or connection teardown reclaimed the slot before the patch.

Attack Vector

A remote client opens a single WebSocket to the GraphQL endpoint and negotiates the legacy graphql-ws subprotocol. The client then submits short-lived subscription operations, each with a unique operation ID, until the configured per-connection cap is reached. Subsequent operations from that same client, or any workflow sharing the connection, receive Subscription limit reached errors. The attack requires no authentication beyond what the endpoint already requires and leaves the TCP connection open while slots remain exhausted.

python
        except asyncio.CancelledError:
            await self.send_message(CompleteMessage(type="complete", id=operation_id))
+        finally:
+            # The operation is over, whether it completed on its own, failed
+            # before execution or was stopped. Release its bookkeeping so that
+            # it no longer counts towards ``max_subscriptions_per_connection``
+            # and its id can be reused right away.
+            self.subscriptions.pop(operation_id, None)
+            self.tasks.pop(operation_id, None)

    async def cleanup_operation(self, operation_id: str) -> None:
-        if operation_id in self.subscriptions:
+        result_source = self.subscriptions.pop(operation_id, None)
+        if result_source is not None:
            with suppress(RuntimeError):
-                await self.subscriptions[operation_id].aclose()
-            del self.subscriptions[operation_id]
+                await result_source.aclose()
+
+        task = self.tasks.pop(operation_id, None)
+        if task is None:
+            # Already finished (and released itself), or never existed
+            return

-        self.tasks[operation_id].cancel()
+        task.cancel()
        with suppress(BaseException):
-            await self.tasks[operation_id]
-        del self.tasks[operation_id]

Source: GitHub Commit 24c5e46

Detection Methods for CVE-2026-107727

Indicators of Compromise

  • Repeated GraphQL error responses containing the string Subscription limit reached on established WebSocket sessions.
  • Long-lived WebSocket connections to the GraphQL endpoint with a high rate of start and complete messages using monotonically increasing operation IDs.
  • Connections negotiating the deprecated graphql-ws subprotocol rather than graphql-transport-ws.

Detection Strategies

  • Instrument the subscription handler to log the current size of self.subscriptions per connection and alert when it approaches max_subscriptions_per_connection.
  • Correlate Subscription limit reached errors against the originating client IP, session, or API key to identify abusive clients.
  • Review WebSocket access logs for connections that issue many short-duration subscriptions without ever sending a client-side stop message.

Monitoring Recommendations

  • Track the ratio of GraphQL start messages to successful complete deliveries per connection and flag anomalies.
  • Alert on WebSocket connections whose lifetime exceeds a defined threshold while continuously accumulating operation IDs.
  • Capture Python application logs from strawberry.subscriptions.protocols.graphql_ws.handlers for stack traces or warnings tied to subscription cleanup.

How to Mitigate CVE-2026-107727

Immediate Actions Required

  • Upgrade Strawberry GraphQL to version 0.327.2 or later across all services exposing subscriptions.
  • Audit application configuration for max_subscriptions_per_connection and confirm which protocol clients negotiate.
  • Terminate long-lived WebSocket sessions after upgrade to force clients onto patched handler state.

Patch Information

The fix is delivered in Strawberry GraphQL 0.327.2 via pull request #4610 and commit 24c5e46. The patch adds a finally block to the operation runner that pops completed operation IDs from both self.subscriptions and self.tasks, and hardens cleanup_operation to tolerate already-released state. Full advisory details are in GHSA-m952-2w3f-6r8h and the 0.327.2 release notes.

Workarounds

  • Migrate clients and server configuration from graphql-ws to the modern graphql-transport-ws protocol, which is not affected.
  • Remove the max_subscriptions_per_connection setting if upgrading is not immediately feasible, since the slot-exhaustion vector requires the cap to be enforced.
  • Enforce per-connection idle timeouts and lifetime limits at the reverse proxy or ASGI layer to recycle sockets and reset handler state.
bash
# Pin the fixed release in requirements.txt or pyproject.toml
pip install 'strawberry-graphql>=0.327.2'

# Verify the installed version
python -c "import strawberry; print(strawberry.__version__)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.