Skip to content

05 · Hunting

GraphQL IDOR

6 min readIDOR Hunting

GraphQL changes IDOR from “is one route protected?” to “is every resolver protected?”, and the answer is almost never. Plus aliasing turns a single HTTP request into hundreds of authorization probes.

If introspection is on, you have the entire API map for free. Always check:

Standard introspection query (POST)

POST /graphql HTTP/2
Content-Type: application/json
{"query": "{ __schema { types { name fields { name args { name type { name } } } } } }"}

Introspection disabled? It’s hidden, not gone. Two moves recover most of it:

  • Fingerprint the engine first. graphw00f identifies the server implementation (Apollo, Hasura, graphql-java, Yoga…) from its error-handling quirks. It then cross-references the GraphQL Threat Matrix, which lists the defenses that engine ships by default and its known CVEs. Now you know what to expect.
  • Recover the schema from typo hints. Most servers answer a wrong field name with "Did you mean … ?". Clairvoyance brute-forces near-miss names, harvests those suggestions, and rebuilds the schema field-by-field, with introspection fully off. (Mitigation on the defender side is blockFieldSuggestions; when it’s absent, this works.)

Map first, hunt second. Dump the schema, then pull every field whose arguments mention an id. The first pattern is the narrow pass. The second catches mutations whose arguments don’t sit at column zero.

Fields that take an id (SHELL)

Terminal window
grep -E '^[a-z]+\(.*[iI]d' schema.graphql
grep -nE '[iI]d' schema.graphql

Relay-style APIs hide the type and the id inside one base64 token, then expose every object through node(id:). That field is designed to fetch any object by global id. Field-level checks often exist only on the “obvious” queries, and node is not one of them.

Decode the global id, then ask node() (POST)

# VXNlcjoxMDQy = base64("User:1042")
# RG9jdW1lbnQ6ODg0MTM= = base64("Document:88413")
query {
node(id: "VXNlcjoxMDQy") {
... on User { email phone }
}
}
query {
node(id: "RG9jdW1lbnQ6ODg0MTM=") {
... on Document { title body owner }
}
}

Decode one id you own, change the integer, re-encode, and send it through node. A forgotten resolver that returns other users’ ids is the supply line for the rest of the schema.

Even when query.user enforces “you must be that user,” nested fields (user.orders, user.paymentMethods) are separate resolvers. Developers often guard the top level and forget the leaves.

Direct access, blocked (POST)

query {
user(id: 7011) {
email
# → "Unauthorized"
}
}

Nested access, leaks (POST)

query {
organization(id: 9) {
members {
id
email # leaks all members
paymentMethod # even worse
}
}
}

Schemas built on the Relay spec expose a generic node(id: ID!) query that returns any object implementing the Node interface. Developers often lock down the named query (user(id)) but forget that node() resolves to the same object through a different door. The global ID is usually just base64("User:7011"). If the guarded query 403s, try the generic one:

Same object, unguarded path (POST)

query {
node(id: "VXNlcjo3MDEx") { # base64("User:7011")
... on User { email phone }
}
}

This exact class was assigned CVEs in 2025 (e.g. API Platform’s auto-generated node resolver). The lesson generalizes: enumerate every path that reaches an object, not just the one your client SDK uses.

_entities is node() for a supergraph. The router enforces @authenticated, @requiresScopes, and @policy. The subgraph behind it usually does not. Every type with @key(fields: "id") can be fetched by key through the _Entity union, batched, in one request.

Fetch any keyed entity (POST)

query {
_entities(representations: [
{__typename: "Invoice", id: "1042"},
{__typename: "User", id: "7011"}
]) {
... on Invoice { total currency owner { email } }
... on User { email phone }
}
}

If the gateway’s authorization is field-level and the entity resolver is not covered, this is a horizontal read of every entity in the graph. Then hit the subgraph directly. Federation deployments commonly expose each subgraph on its own service DNS or at /_graphql. Router-level directives do not exist there. Find the hostnames in error messages, __schema descriptions, or the Server header, and replay the entity query with the same token.

Composition bugs are authorization bugs. Apollo’s GHSA-m8jr-fxqx-8xx6: @requires and @fromContext fields could depend on protected data without inheriting its access control. GHSA-mx7m-j9xf-62hw: interface types and fields could bypass access controls. The supergraph’s auth model is not compositional. Test the transitive path: protected field, then a @requires field, then your query.

@defer and @stream can deliver fields after the parent’s authorization check has already passed. If the deferred fragment touches a protected type, the check may never run on the deferred payload. Automatic Persisted Queries are a bandwidth feature, not a safelist. A client can still register and run a new query. Only a trusted-document list narrows the surface, and an allowlisted query that takes an id is still IDOR.

Custom auth directives like @auth are enforced by middleware that walks the query’s syntax tree. Some implementations only check directives on fields written directly in the query and never recurse into fragments. Request the same protected field through an inline or named fragment and the check can be silently skipped:

Route the field through a fragment (POST)

query {
me {
...leak # the @auth walker may never visit this node
}
}
fragment leak on User { ssn internalNotes apiKey }

Always test protected fields three ways, inline in the query, via an inline fragment (... on Type), and via a named fragment spread, because they are not guaranteed to be authorized identically.

This is the GraphQL primitive that turned modest IDORs into critical mass-extraction bugs. Aliases let you call the same resolver many times in a single HTTP request. Most rate limiters and lockouts count requests, not resolver invocations.

Alias-batched user enumeration (POST)

query BatchExfil {
u1: user(id: 7001) { id email phone createdAt }
u2: user(id: 7002) { id email phone createdAt }
u3: user(id: 7003) { id email phone createdAt }
// ... up to several hundred aliases ...
u200: user(id: 7200) { id email phone createdAt }
}
# One HTTP request → 200 user records returned
# Rate limiter sees: 1 request. WAF sees: 1 request.

Scalar rate limits count HTTP requests, not aliases. Fifty aliases are fifty resolver calls inside one POST. Some programs treat a wide alias sweep as volume abuse. Confirm the missing check with one or two foreign ids. Scale only inside the rules, and only after the bug is real.

The same primitive applies to:

  • Authentication brute-force, 100 password candidates in a single POST against a login(email, password) mutation
  • OTP/token brute-force, 50 OTP guesses per request against verifyCode(code)
  • Coupon enumeration, short-entropy codes batched through validateCoupon(code)
  • Hidden field probing, alias-call an admin mutation 20 ways to detect resolver-level authorization gaps

Separate from aliasing, GraphQL also supports sending an array of operations in one request. Same effect, different shape:

Operation batching (POST)

[
{"query": "{ user(id: 7001) { email } }"},
{"query": "{ user(id: 7002) { email } }"},
{"query": "{ user(id: 7003) { email } }"}
]

Read-side IDOR is the obvious case; mutations are where the money lives. Mutations that take a target ID , updateUser, resetPassword, transferOwnership, deleteOrganization, setRole, should be your top priority once introspection succeeds. Every mutation with an id argument is a write-IDOR candidate. Map them from the grep above before you start sending.

Mutations with a foreign id. Run against an object you own. (POST)

mutation {
updateAddress(input: {addressId: "1042", street: "leet"}) { ok }
transferFunds(input: {accountId: "8842", amount: "1.00"}) { ok }
addOwner(input: {documentId: "1044", ownerEmail: "attacker@example.com"}) { ok }
}

A funds-moving mutation gets a trivial amount, on two accounts you own, or it gets described and not sent. Read the payment rules in the program policy before either choice.

GraphQL IDOR checklist

  • Fingerprint + schema , graphw00f the engine; if introspection is off, recover with Clairvoyance
  • Per-query auth, every Query.X with an ID argument tested for horizontal IDOR
  • Nested resolvers, every traversal through relationships re-tested independently
  • The node() back door, retry any blocked object through the generic Relay node(id) query
  • Fragments, protected fields re-requested via inline & named fragments (directive deception)
  • Aliasing, does sending 50 aliases of the same field execute 50 times?
  • Mutations, every Mutation.X taking a target ID tested with a foreign ID
  • Hidden / admin mutations, does a low-privilege session call an admin mutation and get a response other than auth-error?
  • Field-level auth, sensitive fields (ssn, internalNotes, apiKey) requested via a permitted path

Next step: turn a single finding into a chain with the advanced techniques.

Connections4 backlinks · 1 outgoing · 2 cross-guideFull graph →
Open local graph around this page
Open full graph →
Click a node to open · Drag to reposition · Scroll to zoom

IDOR HuntingFor educational and authorized bug bounty use only.