GraphQL Introspection Lab: Find the Hidden Admin Query

✨ AI Summary
GraphqlAPI has one endpoint and introspection switched on. Introspection is GraphQL's built-in 'describe yourself' feature — ask it politely and it returns a full map of every type, query and field it supports, including the ones nobody linked in the UI.
Lab at a glance: Intermediate · 90 XP · about 15 minutes · runs in your browser, no signup or setup. Try it yourself first; the full solution is behind a spoiler below.

What this lab teaches

GraphQL servers can describe their own schema through introspection. That is useful in development, but left on in production it hands an attacker a complete map of the API — every query, mutation and field, including undocumented or admin-only ones that were never meant to be discovered.

The lesson: 'not linked anywhere' is not access control. If a field exists in the schema, introspection reveals it, and if it has no authorisation check, anyone can call it.

How GraphqlAPI exposes its schema

GraphqlAPI answers a standard introspection query by listing all of its types and fields. One of those fields is an admin query that returns a secret and was never exposed in the UI — but it is right there in the schema for anyone who asks.

The attack approach

  • Send the standard introspection query to the /graphql endpoint to list the schema.
  • Read through the available query fields and spot one that looks administrative or undocumented.
  • Work out the arguments and return fields it expects from the schema map.
  • Call that query directly and read the secret it returns.

Full walkthrough (spoiler)

If the schema came back but you are not sure which field to call, open the steps.

Show the step-by-step solution
  1. Send an introspection query (the __schema query that lists types and fields) to the endpoint.
  2. Scan the returned query fields for one that is not used anywhere in the visible app — the hidden admin query.
  3. Build a normal GraphQL query that calls that field, using the return fields introspection showed you.
  4. Run it. The hidden query returns the admin secret, and the lab marks you solved.

Why it works

Introspection is answered before any business logic runs, so it reveals the whole schema regardless of who is asking. The hidden query is 'protected' only by not being linked in the UI — security through obscurity. Once introspection exposes it and there is no per-field authorisation, calling it is trivial.

Core principleObscurity is not authorisation. Put an access check on every sensitive field, and disable introspection in production.

Where this happens in the real world

Introspection left enabled in production is one of the most common GraphQL findings, because many frameworks enable it by default. Combined with missing field-level authorisation it regularly exposes admin operations and data in bug-bounty reports. It falls under Security Misconfiguration (A05) and, where the fields lack checks, Broken Access Control (A01) in the OWASP Top 10 (2021).

How to defend against it

  • Disable introspection in production, or restrict it to authenticated internal use.
  • Authorise every field and mutation — never rely on a field being undocumented.
  • Apply query depth and cost limits so the endpoint cannot be abused for heavy or nested queries.
  • Review the schema for fields that should not be reachable by ordinary users.
Mr Elite tip: On a GraphQL target you are authorised to test, always run an introspection query first. The schema is your map — hidden mutations and admin queries are the fastest route to high-impact findings.

Try it, then go further

Reading about it is the easy part. Open the lab, try your own approach before peeking at the spoiler, and see how many attempts it takes.

❓ Frequently asked questions

What is GraphQL introspection?
A built-in GraphQL feature that lets a client ask the server to describe its own schema — every type, query, mutation and field it supports.
Why is leaving it on risky?
It hands attackers a full map of the API, including undocumented or admin fields. If those fields lack authorisation checks, they can be called directly.
Should I always disable introspection?
Disable or restrict it in production. It is helpful in development, but in production it mostly helps attackers enumerate your API.
Is disabling introspection enough?
No. It raises the bar but fields can still be guessed. The real fix is an authorisation check on every sensitive field and mutation.
⚡
Join free to earn XP for reading this article Track your progress, build streaks and compete on the leaderboard.
Join Free
Lokesh N. Singh aka Mr Elite
Lokesh N. Singh aka Mr Elite
Founder, Securityelites · AI Red Team Educator
Founder of Securityelites and creator of the SE-ARTCP credential. Working penetration tester focused on AI red team, prompt injection research, and LLM security education.
About Lokesh ->

Leave a Comment

Your email address will not be published. Required fields are marked *