Skip to content
DoS Write-up Intermediate

How GraphQL Batching and Field Duplication Enable Denial of Service

The GraphQL endpoint accepted arrays of queries and duplicate field aliases without any cost analysis, so a single HTTP request could trigger many database lookups. An attacker could exhaust server thread pools and cause CPU spikes, leading to application-layer denial of service.

T4nv1 Follow

Published on medium.com

As web applications transition from traditional REST APIs to GraphQL, microservices gain flexibility by allowing clients to request precisely the data they need in a single HTTP request. However, this flexibility introduces unique security challenges.

T4nv1, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The GraphQL engine had batching enabled and performed no query cost analysis before execution, so duplicate fields and arrays of queries were resolved individually against the database.

Impact

A single HTTP request could trigger tens of thousands of database lookups, exhausting server thread pools and causing CPU spikes across worker nodes, resulting in application-layer denial of service; the WAF's per-request rate limit did not stop this because it counted HTTP requests rather than queries.

What the attacker needed

Network access to the GraphQL endpoint; batching enabled on the server; no query cost analysis

The fix

The report recommends disabling unnecessary query batching, adding query depth and complexity limits, using DataLoader to coalesce duplicate resolver calls, and rate-limiting by query complexity rather than HTTP request count.

How it was found

  1. Send a normal query to the GraphQL endpoint to confirm it works.
  2. Observe that the WAF rate-limits HTTP requests but not the number of queries inside one request.
  3. Send a JSON array containing many queries in a single HTTP request and see each one executed.
  4. Send one query that uses many aliases for the same expensive field and see each alias resolved separately.
  5. Combine array batching with field aliasing to multiply database lookups from one request.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A GraphQL endpoint lets a client ask for exactly the data it wants in one request. This server also let one request contain many queries, and let the same expensive field be requested many times under different names. Because the server did not check how much work a request would cause, a small request could make the server do a huge amount of database work and slow down or stop for everyone.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by T4nv1

View all

113 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.