CVE-2023-50730 Grackle has StackOverflowError in GraphQL query processing

High 7.5 Published Updated

Attackers can cause a denial of service in Grackle GraphQL servers by submitting queries with cyclic fragments or deep nesting, triggering stack overflow errors.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2023-50730?

CVE-2023-50730 is a high-severity denial of service vulnerability in typelevel grackle, published on 22 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Grackle is a GraphQL server written in functional Scala, built on the Typelevel stack. The GraphQL specification requires that GraphQL fragments must not form cycles, either directly or indirectly. Prior to Grackle version 0.18.0, that requirement wasn't checked, and queries with cyclic fragments would have been accepted for type checking and compilation. The attempted compilation of such fragments would result in a JVM `StackOverflowError` being thrown. Some knowledge of an applications GraphQL schema would be required to construct such a query, however no knowledge of any application-specific performance or other behavioural characteristics would be needed.

Grackle uses the cats-parse library for parsing GraphQL queries. Prior to version 0.18.0, Grackle made use of the cats-parse `recursive` operator. However, `recursive` is not currently stack safe. `recursive` was used in three places in the parser: nested selection sets, nested input values (lists and objects), and nested list type declarations. Consequently, queries with deeply nested selection sets, input values or list types could be constructed which exploited this, causing a JVM `StackOverflowException` to be thrown during parsing. Because this happens very early in query processing, no specific knowledge of an applications GraphQL schema would be required to construct such a query.

The possibility of small queries resulting in stack overflow is a potential denial of service vulnerability. This potentially affects all applications using Grackle which have untrusted users. Both stack overflow issues have been resolved in the v0.18.0 release of Grackle. As a workaround, users could interpose a sanitizing layer in between untrusted input and Grackle query processing.

Weakness: CWE-770, CWE-400

Which versions are affected by CVE-2023-50730?

24 open source packages ship an affected version, including org.typelevel:grackle-core_2.13, edu.gemini:gsp-graphql-core_2.13 and edu.gemini:gsp-graphql-core_3. It affects 1 product.

PackageAffectedFixed in
org.typelevel:grackle-core_2.13 MavenAll versions0.18.0
org.typelevel:grackle-core_2.13 MavenAll versions0.18.0
edu.gemini:gsp-graphql-core_2.13 MavenAll versions to 0.14.0None
edu.gemini:gsp-graphql-core_2.13 MavenAll versions to 0.14.0None
edu.gemini:gsp-graphql-core_3 MavenAll versions to 0.14.0None
edu.gemini:gsp-graphql-core_3 MavenAll versions to 0.14.0None
18 more packages
edu.gemini:gsp-graphql-core_native0.4_2.13 MavenAll versions to 0.14.0None
edu.gemini:gsp-graphql-core_native0.4_2.13 MavenAll versions to 0.14.0None
edu.gemini:gsp-graphql-core_native0.4_3 MavenAll versions to 0.14.0None
edu.gemini:gsp-graphql-core_native0.4_3 MavenAll versions to 0.14.0None
edu.gemini:gsp-graphql-core_sjs1_2.13 MavenAll versions to 0.14.0None
edu.gemini:gsp-graphql-core_sjs1_2.13 MavenAll versions to 0.14.0None
edu.gemini:gsp-graphql-core_sjs1_3 MavenAll versions to 0.14.0None
edu.gemini:gsp-graphql-core_sjs1_3 MavenAll versions to 0.14.0None
org.typelevel:grackle-core_3 MavenAll versions0.18.0
org.typelevel:grackle-core_3 MavenAll versions0.18.0
org.typelevel:grackle-core_native0.4_2.13 MavenAll versions0.18.0
org.typelevel:grackle-core_native0.4_2.13 MavenAll versions0.18.0
org.typelevel:grackle-core_native0.4_3 MavenAll versions0.18.0
org.typelevel:grackle-core_native0.4_3 MavenAll versions0.18.0
org.typelevel:grackle-core_sjs1_2.13 MavenAll versions0.18.0
org.typelevel:grackle-core_sjs1_2.13 MavenAll versions0.18.0
org.typelevel:grackle-core_sjs1_3 MavenAll versions0.18.0
org.typelevel:grackle-core_sjs1_3 MavenAll versions0.18.0

Products include Typelevel Grackle.

How do I fix CVE-2023-50730?

Upgrade org.typelevel:grackle-core_2.13 to 0.18.0 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2023-50730 being exploited?

There is no known exploitation of CVE-2023-50730 in the wild and no public exploit code.

Sources

Also known as GHSA-g56x-7j6w-g8r8.

Is CVE-2023-50730 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free