Skip to content
DoS Write-up Intermediate

CVE-2022-37734: graphql-java Denial-of-Service

graphql-java was vulnerable to denial-of-service because its ANTLR-based parser took disproportionately long to process queries containing many non-existent directives, exhausting CPU. An attacker could send a modest number of concurrent requests to make the server unavailable.

Artem Logutov Follow

Published on checkmarx.com

GraphQL is an API standard said to be a more efficient and flexible alternative to REST and SOAP. One of the main purposes of a GraphQL server is to process incoming data.

Artem Logutov, on checkmarx.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

Likely a nested repetition in the ANTLR grammar rule for directives caused the parser to perform excessive lookahead, making processing time grow with input size before any token limit was reached.

Impact

An attacker could exhaust all CPU resources and make the server unavailable using only one attacking machine; the first fix only prevented a single-threaded attack, and multiple concurrent requests could still cause denial of service.

What the attacker needed

Ability to send GraphQL requests to the server

The fix

The vulnerability was fixed in two stages: first by adding a token limit check before ANTLR processing, and later by removing the nested repetition in the grammar rule to address the root cause.

How it was found

  1. Send a GraphQL request containing a large number of non-existent directives.
  2. Observe that execution time increases with the number of directives.
  3. Send many such requests concurrently to exhaust CPU and make the server unavailable.

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 server reads queries and turns them into a structured form before running them. The library used to do this took longer and longer as more repeated pieces were added to a query, even though it had a limit on total size. An attacker could send a few large queries at once and use up all the server's processing power, so normal users could not get through.

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.

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.