CVE-2022-21708: Denial of Service in graphql-go
Summary
CVE-2022-21708: Panic via malicious inputs in github.com/graph-gophers/graphql-go. Affects github.com/graph-gophers/graphql-go versions < 1.3.0. Fixed in 1.3.0. How to fix ↓
Also tracked for
- golang-github-graph-gophers-graphql-go · Debian:11
The same CVE-2022-21708 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The package under scrutiny is github.com/graph-gophers/graphql-go, which is an open-source library for implementing GraphQL servers in Go. It provides functionality for handling GraphQL queries and mutations, allowing users to define schemas and resolvers. The library is widely used in Go applications to enable GraphQL API functionality. However, it is vulnerable to a Denial of Service (DoS) attack that can be triggered by specially crafted queries, potentially leading to stack overflow panics and compromising the server's ability to serve data to users.
Vulnerability Detail
The vulnerability arises from a bug in the library that allows an attacker to exploit the graphql.MaxDepth option in the schema, which is recommended for most use cases. By sending specifically designed queries, an attacker can cause stack overflow panics, resulting in a DoS condition. This vulnerability can be exploited by any user with access to the GraphQL handler. The affected versions of the library have a mitigation measure that disables the graphql.MaxDepth option, but this creates opportunities for other attacks. The severity of this vulnerability is rated as MODERATE with a CVSS score of 6.5.
How To Fix
Latest published version: v1.10.3 as of 23 Oct 2026
go get github.com/graph-gophers/graphql-go@v1.10.3
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
1.3.0
This is the first release that contains the fix.
go get github.com/graph-gophers/graphql-go@v1.3.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading to a patched version is not immediately feasible, a workaround for versions prior to v1.3.0 is to disable the graphql.MaxDepth option from the schema. However, it should be noted that this workaround may create opportunities for other attacks.
Conclusion
The github.com/graph-gophers/graphql-go library is vulnerable to a DoS attack that can be triggered by specially crafted queries. Upgrading to version v1.3.0 or later is recommended to fix the vulnerability. If immediate upgrade is not feasible, disabling the graphql.MaxDepth option from the schema can serve as a temporary workaround. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for github.com/graph-gophers/graphql-go →
FAQ
The vulnerability allows an attacker to trigger stack overflow panics, leading to a DoS condition. This compromises the server's ability to serve data to users and can potentially disrupt the application's functionality.
Any user with access to the GraphQL handler can exploit this vulnerability by sending specially crafted queries.
Yes, the vulnerability has been patched in version v1.3.0 of the github.com/graph-gophers/graphql-go library. Upgrading to this version or a later version is recommended.
For versions prior to v1.3.0, a workaround is to disable the graphql.MaxDepth option from the schema. However, this workaround may introduce other security risks.
No, there are no additional references or links provided for this vulnerability. It was reported privately and fixed before creating this Security Advisory.