GraphQL Batching Lab: Brute-Force Past a Rate Limit in One Request

✨ AI Summary
GraphqlAPI caps login attempts at five per minute. But the limit counts requests, and GraphQL lets you bundle many operations into a single request. Pack a hundred login attempts into one POST and the counter still reads 'one'.
Lab at a glance: Advanced · 110 XP · about 20 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 can run multiple operations in a single HTTP request, either through aliasing (the same field many times under different names) or array batching (several operations in one payload). If a rate limit counts HTTP requests rather than operations, an attacker bundles many attempts into one request and sails past the limit.

The lesson: for GraphQL, the unit that matters is the operation, not the request. Controls that count requests are counting the wrong thing.

How GraphqlAPI rate-limits login

GraphqlAPI applies its five-per-minute limit per HTTP request. A single POST that contains many login mutations therefore counts as one against the limit, while actually trying many passwords — so a brute-force that should take ages runs in a handful of requests.

The attack approach

  • Confirm the login rate limit is enforced per HTTP request, not per operation.
  • Build a single GraphQL request that contains many login attempts (via aliases or batching).
  • Each attempt tries a different candidate password for admin.
  • Send the batch and read which aliased result succeeded.

Full walkthrough (spoiler)

If you still hit the limit, you are sending one attempt per request — batch them instead; open the steps.

Show the step-by-step solution
  1. Compose one GraphQL POST that includes many aliased login mutations, each trying a different candidate password for admin.
  2. Send it as a single request. The rate limiter counts it as one, so all attempts run.
  3. Inspect the batched response and find the aliased mutation that returned a successful login.
  4. Use that result to authenticate as admin. The lab detects the bypass and marks you solved.

Why it works

The rate limit guards the wrong boundary. It assumes one attempt per request, which is true for a normal form login but false for GraphQL, where a single request can carry an arbitrary number of operations. The counter never rises because, to it, the whole batch is one request.

Core principleCount and limit GraphQL by operation, cost and depth — never by HTTP request alone.

Where this happens in the real world

Batching and alias-based rate-limit bypass is a well-known GraphQL weakness, because many frameworks enable batching and apply naive per-request throttling. It commonly enables credential brute-force and OTP bypass, and maps to Identification and Authentication Failures (A07) and Security Misconfiguration (A05) in the OWASP Top 10 (2021).

How to defend against it

  • Rate-limit per operation, counting every mutation or query inside a request, not the request itself.
  • Limit batch size and query depth/cost, rejecting requests that bundle too many operations.
  • Apply account- and action-specific throttling (for example, login attempts per account) independent of transport.
  • Consider disabling array batching if your API does not need it.
Mr Elite tip: On a GraphQL target you are authorised to test, try aliasing a sensitive mutation many times in one request. If a per-request rate limit lets them all through, the throttling is counting requests, not operations.

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 query batching?
GraphQL's ability to run multiple operations in one request, via aliasing the same field repeatedly or sending an array of operations in a single POST.
Why does it bypass rate limits?
If the limit counts HTTP requests, a single batched request carrying many operations counts as one — so an attacker runs many attempts while the counter barely moves.
What can it be used for?
Credential brute-force, OTP or 2FA code guessing, and any action a per-request limit was meant to slow down.
How do I fix it?
Rate-limit per operation (not per request), cap batch size and query cost/depth, and throttle sensitive actions per account.
⚡
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 *