githubEdit

GraphQL Attacks

Common Endpoints

/graphql
/api/graphql
/graphql/console
/graphql.php
/graphiql

Identification

Fingerprint GraphQL Engine (graphw00f)

git clone https://github.com/dolevf/graphw00f.git
python3 main.py -d -f -t http://TARGET

Security Audit (GraphQL-Cop)

git clone https://github.com/dolevf/graphql-cop.git
pip install -r requirements.txt
python3 graphql-cop.py -t http://TARGET/graphql

Introspection Queries

List All Types

Get Fields of a Type

List All Queries

List All Mutations

Get Mutation Input Fields

Full Introspection Dump (paste into GraphQL Voyager)


IDOR / Broken Authorization

Identify

  • Query returns user data based on username/id argument

  • No session validation on query

Exploit - Read Other User's Password

Exploit - Enumerate All Users


SQL Injection

Identify

  • Send query without required argument → error reveals arg name

  • Test argument with ' → SQL syntax error = injectable

Exploit - UNION SQLi in GraphQL

Note: Match number of columns to UserObject fields (use introspection to count)


Denial of Service (DoS)

Identify

  • Look for circular references in schema (User → Posts → Author → Posts)

  • Use GraphQL Voyager to visualize loops

Exploit - Nested Query DoS

Repeat nesting to crash server.


Batching Attacks (Brute Force Bypass)

Identify

  • GraphQL-Cop reports "Array-based Query Batching" as HIGH

  • GraphQL accepts JSON array of queries

Exploit - Multiple Queries in Single Request

Bypass rate limits by sending 1000+ login attempts per request.


Mutations - Privilege Escalation

Identify

  • Introspection reveals mutation with role input field

  • No server-side validation of role value

Exploit - Register Admin User


XSS via GraphQL

Identify

  • Error messages reflect input without encoding

  • Send <script>alert(1)</script> as argument

Test

Check if error message reflects XSS payload unencoded.


Tools

Tool
Purpose
Install

graphw00f

Fingerprint GraphQL engine

git clone https://github.com/dolevf/graphw00f

GraphQL-Cop

Security audit

git clone https://github.com/dolevf/graphql-cop

GraphQL Voyager

Visualize schema

https://graphql-kit.com/graphql-voyager/

InQL

Burp extension

BApp Store


Burp + InQL Workflow

  1. Capture GraphQL request in Proxy

  2. Right-click → Extensions → InQL → Generate queries

  3. InQL tab shows all mutations/queries

  4. Use GraphQL tab in Repeater for easy editing

Last updated