# 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: ```graphql # 1. Alias batching (spec feature; works on any server) mutation { a1: login(email:"[email protected]", password:"p1") { token } a2: login(email:"[email protected]", password:"p2") { token } # ... a1000 } ``` ```json // 2. JSON-array (HTTP) batching: server executes each element independently [{"query":"mutation{login(...){token}}"},{"query":"..."}] ``` 3. **Query-name batching** — multiple named operations in one document (BatchQL detects this separately from array batching). 4. **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 ([[raw/medium.com/graphql-alias-batching-bypasses-rate-limiting-15820|alias vs array]]). Selecting a boolean such as `success` on every alias turns the single response into the complete result set ([[raw/logicbreaker.sh/bypassing-graphql-brute-force-protections-15818|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 | Target | Effect | |---|---| | `login` / password spray | Lockout counted per request, not per attempt | | OTP / 2FA / reset code check | Whole 4–6 digit space in one or a few requests | | Coupon / discount / invite code validators | Enumeration (`isValidDiscount` aliases in PortSwigger's lab) | | Expensive or side-effecting mutations | Mail/SMS flooding, CPU exhaustion, deliberate lockout of victims — see [[GraphQL Denial of Service]] | | Object lookups by ID | Server-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 ([[raw/github.com/saleor-dos-via-unbounded-graphql-query-batching-15819|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 ([[raw/medium.com/graphql-alias-batching-bypasses-rate-limiting-15820|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` ([[raw/logicbreaker.sh/bypassing-graphql-brute-force-protections-15818|logicbreaker]]). ## 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. ## Related - [[GraphQL Security]] - [[GraphQL Denial of Service]] - [[GraphQL Introspection]] - [[API Rate Limiting]] - [[Authentication Security]] - [[Account Takeover]] ## Sources - [[raw/escape.tech/avoid-graphql-denial-of-service-attacks-through-batching-and-aliasing-4767|Avoid GraphQL Denial-of-Service Attacks through Batching and Aliasing]] - [[raw/portswigger.net/graphql-api-vulnerabilities-web-security-academy-2745|GraphQL API Vulnerabilities]] - [[raw/blog.assetnote.io/exploiting-graphql-435|Exploiting GraphQL]] - [[raw/github.com/batchql-graphql-security-auditing-for-batch-attacks-4178|BatchQL: GraphQL Security Auditing for Batch Attacks]] - [[raw/bipi.in/graphql-batching-abuse-and-how-to-stop-it-14646|GraphQL batching abuse and how to stop it]] - [[raw/greywatch.ai/graphql-rate-limit-bypass-via-batching-13887|GraphQL rate-limit bypass via batching]] - [[raw/p4ndora.ai/overgrowth-graphql-aliased-mutation-brute-force-of-a-password-reset-hi-14207|Overgrowth: GraphQL aliased-mutation brute force of a password reset (HI CyberCon 2026)]] - [[raw/infosecwriteups.com/how-graphql-mutation-aliasing-led-to-a-12-500-dos-bug-in-hackerone-s-a-8836|How GraphQL Mutation Aliasing Led to a $12,500 DoS Bug in HackerOne’s Account Recovery]] - [[raw/redpacketsecurity.com/dos-via-mutation-aliasing-in-graphql-hackerone-disclosure-4619|DoS via Mutation Aliasing in GraphQL — HackerOne Disclosure]] - [[raw/github.com/directus-unthrottled-system-graphql-resolvers-allow-anonymous-dos-via-13550|Directus unthrottled system GraphQL resolvers allow anonymous DoS via alias amplification]] - [[raw/guide.sonatype.com/graphql-hive-gateway-batch-execute-authorization-bypass-13388|GraphQL Hive Gateway batch-execute authorization bypass]] - [[raw/cheatsheetseries.owasp.org/graphql-cheat-sheet-owasp-2815|GraphQL Cheat Sheet]] - [[raw/checkmarx.com/didn-t-notice-your-rate-limiting-graphql-batching-attack-4766|Didn't Notice Your Rate Limiting: GraphQL Batching Attack]] - [[raw/dedsecops.com/confirming-graphql-dast-findings-introspection-batching-depth-cost-csr-14495|Confirming GraphQL DAST findings: introspection, batching, depth/cost, CSRF over GET]] - [[raw/payloadplayground.com/graphql-batching-and-aliasing-attacks-rate-limit-bypass-brute-force-do-14042|GraphQL batching and aliasing attacks: rate-limit bypass, brute force, DoS]] - [[raw/github.com/saleor-dos-via-unbounded-graphql-query-batching-15819|Saleor: DoS via unbounded GraphQL query batching]] - [[raw/logicbreaker.sh/bypassing-graphql-brute-force-protections-15818|Bypassing GraphQL brute force protections]] - [[raw/medium.com/graphql-alias-batching-bypasses-rate-limiting-15820|GraphQL Alias Batching Bypasses Rate Limiting]]