...

The Dark Side of GraphQL: One Request Can Crash Your App

Securify

In 2025, if you’re testing a modern web / mobile application, there’s a very high chance you’ll encounter GraphQL APIs.

From fintech dashboards and SaaS platforms to consumer-facing portals, GraphQL has become the default choice for API communication. Developers love it for its flexibility and efficiency. Frontend teams love it because they can fetch exactly what they need.

But attackers love it too.

When GraphQL APIs are deployed without proper guardrails, a single request can consume excessive backend resources, leading to Denial of Service (DoS) conditions.

Why GraphQL Is Everywhere in 2025

Traditional REST APIs are slowly being replaced or wrapped by GraphQL layers.

The reasons are clear:

  • One endpoint instead of many
  • Reduced over-fetching and under-fetching
  • Faster frontend development
  • Better performance for mobile applications

However, GraphQL shifts a lot of control from the server to the client.And if that control isn’t restricted, abuse becomes easy.

The Hidden DoS Risk in Unrestricted GraphQL Queries

When a GraphQL endpoints process client-supplied queries without enforcing any meaningful limits on size or complexity. As a result, a single request can place a disproportionate load on the backend, creating a potential Denial-of-Service (DoS) condition.

This risk is not tied to one specific flaw, but instead arises from a combination of design and configuration gaps that attackers can exploit in different ways, as outlined below:

1. Unchecked Query Length

The server accepts GraphQL queries that are extremely large, in some cases containing millions of characters. Processing such oversized payloads forces the application to spend significant time parsing the request, allocating memory, and executing resolvers, which can lead to slow responses or service degradation.

2. Circular Query Abuse

The GraphQL schema allows circular relationships between object types. By recursively nesting these relationships, an attacker can craft a single query that triggers an exponential increase in backend processing, quickly exhausting server resources.

By nesting queries recursively, attackers can exponentially increase server workload with minimal effort.

3. Alias Overloading

GraphQL aliases can be used to request the same expensive field multiple times within a single query. This causes the corresponding resolver to execute repeatedly, multiplying the server workload while still appearing as a single, legitimate request.

Unchecked Query Length Attack in Action. 

Step 1: Capture the GraphQL Request

  • Navigate to the application functionality that interacts with GraphQL
  • Intercept the request using Burp Suite (or any HTTP proxy)
  • Identify the POST request sent to the /graphql endpoint

Step 2: Send the Request to Repeater

  • Forward the captured request to the Repeater tab for further exploitation.

Step 3: Inject an Oversized Query Payload

  • Modify the POST request body to include an extremely large GraphQL query.

Example (simplified):

{    "query": "query graphql { DoS….+1: __typename }"  }

The actual payload was expanded to millions of characters by repeating fields and aliases.

Step 4: Observe the Server Response

Fig: A query of approximately 3.9 million characters was successfully processed. Response time exceeded 6 seconds

Fig: When the payload size increased to 7.2 million characters, the response time increased to 15+ seconds

At this point, continuing further risks application instability or downtime.

Why This Matters More in 2025

This type of attack is especially dangerous today because:

  • GraphQL endpoints are often public
  • Attacks require no authentication
  • Traditional rate limiting does not help
  • WAFs struggle with GraphQL-specific abuse

In cloud environments, this can also trigger:

  • Auto-scaling spikes
  • Increased operational costs
  • Cascading failures across services

How This Should Be Fixed

  • GraphQL security isn’t about removing features; it’s about applying limits.
  • Reject queries that exceed a safe maximum length before execution.
  • Prevent deeply nested or recursive queries.
  • Restrict pagination values and result sizes.
  • Calculate query complexity and block requests that exceed predefined thresholds.

GraphQL gives clients enormous power. Without boundaries, that power turns into a liability.

In 2025, attackers don’t need floods of traffic to cause disruption. A single oversized GraphQL query can be enough.Unchecked query length, circular relationships, and alias overloading are no longer edge cases; they are real-world attack vectors. If you’re building or testing modern applications, securing GraphQL APIs should be a priority, not an afterthought.

Leave a Reply