Lab 09: GraphQL Security Testing

Objective

Attack a GraphQL-style API from Kali Linux using four techniques:

  1. Introspection abuse — dump the full schema to discover hidden types, fields, and mutations

  2. IDOR via GraphQL — access any user's data including passwords and API keys by changing the id argument

  3. Batch query attack — dump all users in a single batched request, bypassing rate limits designed for single queries

  4. SQL injection via GraphQL variable — inject into a search query variable to exfiltrate the database


Background

GraphQL's flexibility — user-controlled queries, nested object traversal, batching — introduces new attack vectors not present in traditional REST APIs.

Real-world examples:

  • 2019 GitLab (CVE-2019-5462) — GraphQL introspection exposed internal fields including private token hashes; combined with a broken access control flaw to exfiltrate 10M+ user records.

  • 2021 Shopify — introspection enabled on production API; a researcher discovered an undocumented internalCustomerData field that returned PII for any shop customer.

  • 2020 HackerOne (multiple) — GraphQL IDOR across multiple programs; changing userId in a query argument returned other users' private data without authentication.

  • 2022 Magento — GraphQL batch queries used to bypass rate limiting on password reset; 1,000 reset attempts in a single HTTP request.

OWASP: A01:2021 (IDOR), A03:2021 (Injection), A05:2021 (Misconfiguration — introspection)


Architecture

Time

40 minutes


Lab Instructions

Step 1: Setup


Step 2: Launch Kali + Introspection


Step 3: IDOR — Access Any User by ID

📸 Verified Output:


Step 4: Batch Query Attack



Step 6: All Users via users Query


Step 7–8: Remediation + Cleanup


Further Reading

Last updated