GraphQL Batching Attacks

Packing many operations into one HTTP request — via aliases, JSON-array batching or both — so that request-counting rate limits, lockouts and WAFs see one event while resolvers execute hundreds or thousands.

How it works

Three packaging forms, combinable:

# 1. Alias batching (spec feature; works on any server)
mutation {
  a1: login(email:"u@x.com", password:"p1") { token }
  a2: login(email:"u@x.com", password:"p2") { token }
  # ... a1000
}
// 2. JSON-array (HTTP) batching: server executes each element independently
[{"query":"mutation{login(...){token}}"},{"query":"..."}]
  1. Query-name batching — multiple named operations in one document (BatchQL detects this separately from array batching).
  2. Mixed — 10 array entries × 100 aliases = 1,000 logical operations per HTTP request.

Which form works is target-specific: a voucher endpoint absorbed 50 array entries without effect but failed with 504s at 5,000 aliases, so test both rather than inferring one from the other (alias vs array). Selecting a boolean such as success on every alias turns the single response into the complete result set (logicbreaker).

The control failure is always the same: the limiter keys on HTTP requests (Cloudflare/NGINX at 60 req/min/IP) while cost is incurred per resolver invocation. One lab measured the amplification directly against a 1,000-entry password list, with the hit at position 738, all inside a single request.

Impact patterns

TargetEffect
login / password sprayLockout counted per request, not per attempt
OTP / 2FA / reset code checkWhole 4–6 digit space in one or a few requests
Coupon / discount / invite code validatorsEnumeration (isValidDiscount aliases in PortSwigger’s lab)
Expensive or side-effecting mutationsMail/SMS flooding, CPU exhaustion, deliberate lockout of victims — see GraphQL Denial of Service
Object lookups by IDServer-side enumeration and GraphQL Authorization Flaws at scale

Notable cases

  • HackerOne account recovery, $12,500 — verifyAccountRecoveryPhoneNumber executed many times per request via aliases, degrading recovery for legitimate users; fix recommendation was hard caps on mutation aliases and per-request quotas for expensive operations.
  • Directus GHSA-g293-vf99-xv36 — an earlier fix (GHSA-6q22-g298-grjh) deduplicated aliased server_health in resolvers/system.ts but missed resolvers/system-global.ts. Anonymous POST /graphql/system with aliased auth_login (suspend any account), auth_password_request (mail flood), utils_hash_generate (argon2id CPU burn) and utils_hash_verify (credential probing).
  • Property marketplace OTP sign-in — aliased checkCode guesses inside one request, compounded by a send-code call that honored a client-supplied code length (attacker shrinks the keyspace first).
  • Fintech login — 200 aliased login mutations bypassed a 5-attempts/minute lockout that incremented per HTTP request.
  • Overgrowth CTF — unauthenticated requestPasswordReset + uncounted resetPassword; all 10,000 codes in ~3.5 s, admin takeover.
  • GraphQL Hive Gateway batch-execute (sonatype-2026-010434, CVSS 4.0 8.6) — authorization bypass via context confusion between batched requests: batching as an authz problem, not only a rate-limit one.
  • Saleor GHSA-24jw-f244-qfpp — JSON-array batching had no upper bound on operations, so per-query complexity limits were multiplied away; unauthenticated CPU, DB-connection and worker exhaustion. Interim WAF fix: cap body size or array length, or block arrays (advisory).
  • Voucher-code check (OWASP API4:2023) — request-level limit of 10 bypassed with aliases; 5,000 alias nodes gave INTERNAL_SERVER_ERROR and 504s consistent with node timeouts; on auto-scaling infrastructure this is also a denial-of-wallet vector (Medium).
  • PortSwigger brute-force lab — 100 aliased login(input:{username, password}) calls in one mutation {} (variables and operationName removed); search the response for "success": true (logicbreaker).
  • verifyOTP under a 10 req/min/key limit — with a per-HTTP-request limit, a 10-operation array tests 10 codes per slot. For reports, a 5–10 operation batch plus the matching response is enough evidence; the remediation is per-operation limits as well as per-request ones (securityelites).
  • Zimbra NE GraphQL authentication (CVE-2026-93637) did not increment the SOAP IP lockout counter, allowing unthrottled credential guessing (Metasploit zimbra_graphql_brute). (source)

Testing

  • Take any rate-limited operation; resend as 10, 100, 1,000 aliases and as an array; compare per-alias results and whether the limiter or lockout fires.
  • Probe support quickly with BatchQL or graphql-cop; automate with InQL’s batch attack, CrackQL (password/fuzz brute force) or Burp Intruder with one payload position per alias.
  • Check whether the client can influence the target keyspace (code length, expiry, attempt counters).
  • Report with raw request/response showing N attempts executed in one request; the alias feature alone is not a finding.

Defenses

  • Count operations, not requests: parse at the gateway, count aliases and array entries, rate-limit at the resolver keyed on resolver + principal (OWASP: rate limits belong in the business-logic layer).
  • Cap aliases and tokens (GraphQL Armor max-aliases, max-tokens; Apollo GraphOS alias and root-field limits); reject over-limit with 400.
  • Disable HTTP array batching unless needed (Apollo Server allowBatchedHttpRequests: false).
  • Bound array length explicitly when batching stays on; a per-operation complexity limit is not a per-request limit (Saleor).
  • Prevent batching for sensitive objects (credentials, OTPs, tokens) and enforce attempt counters on the secret itself.
  • Persisted/safelisted operations remove runtime alias construction entirely.

Sources