How to Get GraphQL Introspection via WebSocket
The author found that a hardened bug bounty program allowed GraphQL introspection over WebSocket even though it was likely disabled over HTTP. By sending an introspection query through the WebSocket connection, an attacker could extract the full schema and discover hidden operations such as a query that returned a secret flag.
medium.com
Published on medium.com
· Background · CTF challenge · Solution ∘ How to Identify GraphQL over WebSocket ∘ Executing GraphQL introspection via WebSocket ∘ Finding Hidden GraphQL Operations ∘ Execute Hidden GraphQL Operations · Summary
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the server enforced a restriction on GraphQL introspection for regular HTTP requests but did not apply the same restriction to GraphQL operations sent over WebSocket.
Impact
An attacker could extract the full GraphQL schema over WebSocket and discover hidden queries or mutations, potentially leading to further vulnerabilities; the text notes that reporting introspection alone is often closed as informative.
What the attacker needed
Application uses GraphQL over WebSocket; ability to intercept WebSocket traffic
How it was found
- Identify that the application uses WebSocket by looking for a 101 Switching Protocols response in the browser network tab or a proxy.
- Confirm GraphQL over WebSocket by inspecting WebSocket messages for GraphQL keywords such as subscription.
- Send the initial WebSocket connection message to a repeater tool, reconnect, and verify an acknowledgement message is received.
- Modify the message to contain a minimal GraphQL introspection query and send it to check if introspection is allowed.
- Send a full introspection query to retrieve the schema and look for hidden operations.
- Execute the hidden operation found in the schema to obtain the secret flag.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
GraphQL is a way for apps to ask a server for exactly the data they need. Introspection is a built-in feature that lets you ask the server to describe all its available queries and data types. Many apps turn this off over normal web requests to hide their structure, but this write-up shows that if the app also uses WebSocket (a persistent two-way connection), the same introspection can still work there and reveal hidden operations.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.