/

CVE-2026-35523

Severity:

HIGH RISK

(7.5)

Authentication Bypass in Strawberry GraphQL graphql-ws

CVE-2026-35523

Analyzed

Vulnerability type

Category:

Authentication Bypass

CWE:

CWE-306

Impact:

Unauthorized Access to Protected GraphQL Subscriptions

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Strawberry GraphQL's legacy graphql-ws WebSocket subscription handler failed to enforce completion of the connection_init handshake before accepting subscription start messages.

An unauthenticated remote client using the graphql-ws subprotocol could open a WebSocket and immediately start subscriptions, bypassing the on_ws_connect authentication hook that is normally required.

Affected context

This vulnerability appears in Strawberry GraphQL deployments that:

  • Expose WebSocket endpoints for GraphQL subscriptions
  • Enable or fall back to the legacy graphql-ws subprotocol handler
  • Rely on on_ws_connect or equivalent connection hooks to enforce authentication or authorization

The issue manifests when the server assumes that every subscription goes through a connection_init handshake, but the implementation processes start messages even when that handshake did not occur.

Exploit preconditions

  • Attack surface: Public or internal WebSocket endpoint used for GraphQL subscriptions (typically at the same path as HTTP GraphQL, e.g., /graphql).
  • Required access: Network-level ability to reach the WebSocket endpoint; no prior authentication is required to attempt exploitation.
  • Trigger point: An attacker opens a WebSocket connection using the graphql-ws subprotocol and sends a start (subscription) message directly, omitting the connection_init message.
  • Why exploitation is possible: The legacy graphql-ws handler does not enforce that the connection_init handshake has completed before processing start messages, so the subscription setup logic runs without the authentication hook (on_ws_connect) ever being invoked.

Why this happens

The root cause is a missing authentication enforcement step in the protocol state machine for the graphql-ws WebSocket handler.

Instead of modeling the connection as a sequence of states (e.g., CONNECTING → INIT_RECEIVED → AUTHENTICATED → SUBSCRIBING) and rejecting out-of-order messages, the implementation accepts start messages regardless of whether a connection_init was previously received and processed.

This maps to CWE-306: Missing Authentication for Critical Function, because the critical operation—creating and running subscription operations, often bound to user-specific data—is allowed to proceed without confirming that the client has been authenticated via the intended hook.

Potential impact

  • Unauthorized clients may subscribe to GraphQL channels that were intended to require authentication.
  • Attackers could receive real-time data streams (e.g., user updates, notifications, or sensitive domain events) without valid credentials.
  • Information exposure about application behavior, schema fields, or internal events via subscription payloads.
  • Potential compliance or privacy violations if subscription data contains personally identifiable or regulated information.

General mitigation guidance

Effective mitigation focuses on enforcing authentication and protocol correctness for WebSocket subscription flows:

  • Ensure the WebSocket subscription handler enforces a strict protocol state machine that rejects start messages until a valid connection_init has been received and authenticated.
  • Centralize authentication checks so that subscription creation always runs under an established security context, rather than relying on optional or best-effort hooks.
  • Treat WebSocket endpoints as fully privileged entry points: apply the same authentication, authorization, and rate-limiting policies that protect your HTTP GraphQL endpoint.
  • Consider implementing server-side guards that validate the presence of user identity, session, or token context at subscription resolution time, not just at connection time.
  • Use least privilege principles in subscription logic, limiting the amount and sensitivity of data exposed on any single subscription channel.

How teams detect issues like this

Detection can combine protocol-aware testing, code review, and runtime monitoring:

  • Static analysis & code review:
  • Inspect WebSocket subscription handlers for explicit checks that connection_init has completed before handling start messages.
  • Look for any code paths that create subscriptions or execute subscription resolvers without verifying authentication state.
  • Review usage of hooks like on_ws_connect and ensure their results are enforced before subscription setup.
  • Dynamic and security testing:
  • Use integration tests or security testing tools to simulate a graphql-ws client that sends a start message without a preceding connection_init, and verify that the server rejects the request.
  • Include protocol misuse test cases in CI pipelines to guard against regressions in WebSocket state handling.
  • Runtime monitoring:
  • Log WebSocket connection lifecycle events and message types, and alert on anomalous patterns, such as start messages from connections with no recorded authentication step.
  • Instrument subscription resolvers to record whether an authenticated principal is associated with each subscription; investigate any unauthenticated subscriptions.

Sources

SourceLink
github.comgithub.com/strawberry-graphql/strawberry/security/advisories/GHSA-vpwc-v33q-mq89

Frequently asked

questions

Yes, if the WebSocket subscription endpoint is accessible over the network (for example, on a public GraphQL API), a remote attacker can attempt to exploit it by speaking the graphql-ws subprotocol and skipping the connection_init handshake.

No. The vulnerability specifically arises because the handler fails to enforce that authentication has occurred. An attacker only needs network-level access to the WebSocket endpoint; no valid token or session is required to attempt the bypass.

The safest pattern is to enforce a strict WebSocket protocol state machine: require a connection_init message, perform authentication in that phase, and reject or close any connection that sends start messages before successful initialization. Additionally, ensure all subscription creation logic checks that an authenticated user context is present.

Model WebSocket and other long-lived protocol handlers as explicit state machines with clear preconditions for each message type, and encode authentication as a mandatory transition. Include protocol misuse tests in automated test suites, and make authentication and authorization checks explicit and centralized for all real-time or streaming endpoints.

Find out what's already
exploitable in your codebase.