Press enter or click to view image in full size
Bug bounty hunting is a thrilling race to find security flaws before the bad guys do. While most hunters focus on subdomains, REST APIs, or XSS, a new frontier is emerging: GraphQL APIs. These powerful, flexible APIs power modern apps at companies like GitHub and Shopify, but their complexity makes them a treasure trove for vulnerabilities. From introspection leaks to broken access controls, GraphQL bugs can earn you $1,000–$10,000 bounties. In this comprehensive guide, we’ll show you how to hunt GraphQL vulnerabilities like a pro, using free tools and real-world techniques. Whether you’re a beginner or a seasoned hunter, this article will teach you how to find GraphQL endpoints, exploit common flaws, and turn queries into rewards. Let’s dive into the GraphQL goldmine!
GraphQL is a query language for APIs that lets clients request exactly the data they need. Unlike REST APIs with fixed endpoints (e.g., /api/v1/users
), GraphQL uses a single endpoint (e.g., /graphql
) and dynamic queries, making it powerful but prone to misconfigurations. Here’s why it’s a prime target:
user.email
or admin.secrets
.Recent HackerOne reports show GraphQL bugs earning $2,000–$10,000, like a Shopify case where a hunter accessed admin data via a misconfigured query. This article will walk you through finding and exploiting these flaws.
curl
, graphqlmap
(pip install graphqlmap
), ffuf
(go install github.com/ffuf/ffuf@latest
), and a browser (Chrome/Firefox)..graphql
or /graphql
).graphql-lab.com
for legal testing.GraphQL APIs often hide in plain sight. Here’s how to locate them efficiently:
curl
or Burp Suite:curl https://example.com/graphql
curl https://api.example.com/graphiql
curl https://example.com/api/graphql
application/json
containing data
or errors
fields, indicating a GraphQL endpoint.2. Use OSINT:
crt.sh
for subdomains hosting GraphQL:curl -s "https://crt.sh/?q=%.example.com&output=json" | jq -r '.[].name_value' | grep -i "graphql\|api"
robots.txt
or sitemap.xml
for /graphql
or /graphiql
.3. Crawl with Burp Suite:
127.0.0.1:8080
) and browse the target site./graphql
, /graphiql
, or /api
.4. Outcome: A list of GraphQL endpoints (e.g., https://api.example.com/graphql
).
Introspection lets you query a GraphQL API’s schema, revealing fields, types, and queries. If unprotected, it’s a goldmine for finding sensitive data.
curl
to test:curl -X POST -H "Content-Type: application/json" -d '{"query": "query { __schema { types { name } } }"}' https://api.example.com/graphql
{"data": {"__schema": {"types": [{"name": "User"}]}}}
), introspection is enabled.2. Use GraphQLmap:
pip install graphqlmap
graphqlmap -u https://api.example.com/graphql --dump-schema > schema.json
User
, Admin
, Secrets
, or Credentials
.Outcome: A schema file (schema.json
) revealing queries, mutations, and fields to target.
Use the schema to craft queries for sensitive information.
User
type with fields like email
or apiKey
, try:curl -X POST -H "Content-Type: application/json" -d '{"query": "query { user(id: 1) { email apiKey } }"}' https://api.example.com/graphql
{"data": {"user": {"email": "[email protected]", "apiKey": "abc123"}}}
without authentication, it’s a bug.2. Test Mutations:
curl -X POST -H "Content-Type: application/json" -d '{"query": "mutation { updateUser(id: 1, role: \"admin\") { id } }"}' https://api.example.com/graphql
Outcome: Identify queries or mutations exposing sensitive data or actions.
GraphQL’s flexibility can lead to weak permissions, letting you access unauthorized data.
curl -X POST -H "Content-Type: application/json" -d '{"query": "query { user(id: 2) { email } }"}' https://api.example.com/graphql
2. Test Field-Level Access:
adminToken
:curl -X POST -H "Content-Type: application/json" -d '{"query": "query { user(id: 1) { adminToken } }"}' https://api.example.com/graphql
Outcome: Find unauthorized access to data or actions.
GraphQL allows batching multiple queries in one request, which can bypass rate limits or expose data.
curl -X POST -H "Content-Type: application/json" -d '[{"query": "query { user(id: 1) { email } }"}, {"query": "query { user(id: 2) { email } }"}]' https://api.example.com/graphql
2. Outcome: Identify batch query flaws that amplify impact.
Use a wordlist to fuzz GraphQL queries and parameters for hidden fields or endpoints.
graphql_fuzz_wordlist.txt
):email
password
apiKey
secret
token
adminToken
userId
role
permissions
settings
config
data
privateData
secrets
credentials
profile
users
admin
query
mutation
updateUser
deleteUser
createUser
2. Fuzz with ffuf:
ffuf -u https://api.example.com/graphql -H "Content-Type: application/json" -d '{"query": "query { FUZZ { id } }"}' -w graphql_fuzz_wordlist.txt -o results-graphql.json
users
or secrets
).Outcome: Discover hidden fields or queries exposing sensitive data.
When you find a vulnerability, report it clearly:
/graphql
and accessed user.apiKey
without auth.”curl
command or screenshot.2. Example Report:
user.apiKey
. Querying user(id: 1)
returned {"apiKey": "xyz789"}
without authentication.curl -X POST -d '{"query": "query { user(id: 1) { apiKey } }"}' <https://api.example.com/graphql
>3. Follow Rules: Ensure the endpoint is in scope and don’t disclose findings publicly until resolved.
Inspired by a Shopify HackerOne report:
/graphql
in scope./graphql
using Burp Suite.admin
type with secretKey
field.admin(id: 1)
and got {"secretKey": "abc123"}
without auth./graphiql
or /playground
—interactive tools often left exposed for testing queries..js
files.crt.sh
, waybackurls
, Burp Suite.curl
, graphqlmap
, ffuf
.GraphQL APIs are a goldmine for bug hunters, offering high-value vulnerabilities with less competition. By mastering endpoint discovery, introspection, access control testing, and fuzzing, you can uncover bugs that pay big. Start with a bug bounty program on HackerOne or Bugcrowd, use tools like graphqlmap
and Burp Suite, and practice on safe labs like PortSwigger’s Web Security Academy. Your next GraphQL bug could be worth thousands—happy hunting!