RECONNAISSANCE
Last updated
Last updated
GraphQL has many implementations written in a variety of programming languages, each of which could have different default configurations or known weaknesses
GraphQL Implementations and Languages
Server Implementation | Language |
---|---|
Endpoints like /graphql
or IDE endpoints (/graphiql
, /playground
) are common but can
be customized.
Example Endpoint Definition in Graphene:
Graphene, a Python-based implementation of GraphQL, can expose two endpoints, one for GraphQL, and the other for GraphiQL Explorer, which is built into Graphene:
GraphQL APIs follow a standardized response structure, making them relatively easy to identify during penetration tests or bug bounty hunts. According to the GraphQL specification:
Valid Query Response:
Returns a data
JSON field containing the requested data.
Invalid Query Response:
Returns an errors
JSON field with details about the issue.
These predictable behaviors allow automated tools to identify GraphQL APIs by sending test queries and observing responses.
Send a query to fetch the id
field from the pastes
object using the HTTP POST method:
Response:
Send an invalid query referencing a non-existent field (badfield
):
Response:
State of Introspection in GraphQL Implementations (Table 4-2)
Example Introspection Query
Response:
Visualizing Introspection Data
Use GraphQL Voyager to explore schema relationships:
Navigate to GraphQL Voyager.
Paste the introspection response or upload the SDL file.
View relationships visually (e.g., PasteObject
links to OwnerObject
).
The __typename
Meta-Field
GraphQL provides built-in meta-fields like __typename
, which reveal the type of an object being queried.
Example Query:
Response:
Example Query at Root Level:
Response:
Purpose: Useful for detecting GraphQL without prior knowledge of the schema.
Automating Detection with Nmap
Example 2: Using __typename
Command:
Output:
Example 3: Scanning Multiple Hosts
Command:
hosts.txt contains a list of target IPs or domain names.
Using HTTP POST
Command:
Automating with Bash
Command:
hosts.txt: Contains a list of full target URLs.
Description: Graphw00f is a Python-based tool for detecting GraphQL and fingerprinting implementations.
Common Endpoints in Graphw00f
Command for Detection
Command:
Output:
GraphiQL and GraphQL Playground
These IDEs are JavaScript-based and often overlooked by traditional scanners.
Using EyeWitness
EyeWitness captures screenshots of web pages to detect graphical interfaces.
Command:
Output:
Output Report:
Includes screenshots and source code of detected web pages.
Stored in folders like screens
, source
, and report.html
.
Building Custom Wordlists
Creating URL Lists for EyeWitness: Command:
Appends each directory in the wordlist to the base URL.
Language | Implementation | Introspection Default | Disable Option |
---|---|---|---|
Endpoint | Notes |
---|---|
Apollo
TypeScript
Graphene
Python
Yoga
TypeScript
Ariadne
Python
graphql-ruby
Ruby
graphql-php
PHP
graphql-go
Go
graphql-java
Java
Sangria
Scala
Juniper
Rust
HyperGraphQL
Java
Strawberry
Python
Tartiflette
Python
Python
Graphene
Enabled
No
Python
Ariadne
Enabled
Yes
PHP
graphql-php
Enabled
Yes
Go
graphql-go
Enabled
No
Ruby
graphql-ruby
Enabled
Yes
Java
graphql-java
Enabled
No
/graphql
Default
/console
Alternative
/playground
IDE
/gql
Shortened
/query
Query path