Skip to main content

CVE-2022-21708: CWE-400: Uncontrolled Resource Consumption in graph-gophers graphql-go

Medium
Published: Fri Jan 21 2022 (01/21/2022, 22:25:10 UTC)
Source: CVE
Vendor/Project: graph-gophers
Product: graphql-go

Description

graphql-go is a GraphQL server with a focus on ease of use. In versions prior to 1.3.0 there exists a DoS vulnerability that is possible due to a bug in the library that would allow an attacker with specifically designed queries to cause stack overflow panics. Any user with access to the GraphQL handler can send these queries and cause stack overflows. This in turn could potentially compromise the ability of the server to serve data to its users. The issue has been patched in version `v1.3.0`. The only known workaround for this issue is to disable the `graphql.MaxDepth` option from your schema which is not recommended.

AI-Powered Analysis

AILast updated: 06/23/2025, 18:02:43 UTC

Technical Analysis

CVE-2022-21708 is a denial-of-service (DoS) vulnerability affecting versions of the graph-gophers graphql-go library prior to 1.3.0. Graphql-go is a Go language implementation of a GraphQL server designed for ease of use. The vulnerability arises from uncontrolled resource consumption due to a bug in the library's query processing logic. Specifically, an attacker who can send crafted GraphQL queries to the server can trigger stack overflow panics. This occurs because the library does not properly limit the depth or complexity of incoming queries, leading to excessive recursive calls and stack exhaustion. The vulnerability is categorized under CWE-400 (Uncontrolled Resource Consumption), indicating that the server's resources can be overwhelmed by malicious input. Exploitation requires the attacker to have access to the GraphQL handler endpoint, but no authentication or special privileges are explicitly required. The impact is a denial of service, where the server crashes or becomes unresponsive, disrupting service availability. The issue was addressed in graphql-go version 1.3.0 by fixing the underlying bug. The only known workaround—disabling the graphql.MaxDepth option—is not recommended as it removes an important safeguard against overly complex queries. There are no known exploits in the wild reported to date, but the vulnerability remains a risk for deployments running vulnerable versions of graphql-go. This vulnerability primarily affects applications and services that use graphql-go as their GraphQL server implementation, which may include web services, APIs, and backend systems written in Go that expose GraphQL endpoints.

Potential Impact

For European organizations, the primary impact of this vulnerability is service disruption due to denial of service attacks targeting GraphQL endpoints implemented with vulnerable versions of graphql-go. Organizations relying on graphql-go for critical APIs or web services may experience outages or degraded performance, affecting business continuity and user experience. This can be particularly damaging for sectors with high availability requirements such as finance, healthcare, telecommunications, and government services. Additionally, repeated or sustained exploitation attempts could increase operational costs due to incident response and mitigation efforts. Although this vulnerability does not directly lead to data breaches or integrity compromise, the loss of availability can indirectly affect confidentiality if fallback mechanisms or error handling expose sensitive information. The ease of exploitation—requiring only access to the GraphQL endpoint and no authentication—raises the risk profile, especially for publicly accessible APIs. Organizations with strict uptime SLAs or those providing critical infrastructure services may face reputational damage and regulatory scrutiny if service disruptions occur. Given the growing adoption of GraphQL in modern web architectures, the scope of affected systems could be significant in environments where graphql-go is used without timely patching.

Mitigation Recommendations

1. Immediate upgrade to graphql-go version 1.3.0 or later is the most effective mitigation to eliminate the vulnerability. 2. Implement strict network access controls to restrict access to GraphQL endpoints only to trusted users or internal networks, reducing exposure to unauthenticated attackers. 3. Employ Web Application Firewalls (WAFs) or API gateways capable of detecting and blocking anomalous or excessively deep GraphQL queries to prevent exploitation attempts. 4. Monitor GraphQL query patterns and server logs for unusual spikes in query depth or frequency that may indicate exploitation attempts. 5. Avoid disabling the graphql.MaxDepth option as a workaround; instead, configure it with conservative limits to balance security and functionality. 6. Conduct regular security audits and dependency checks to identify and remediate vulnerable library versions in the software supply chain. 7. For critical services, implement redundancy and failover mechanisms to maintain availability in case of DoS incidents. 8. Educate development and operations teams about secure GraphQL practices, including query complexity management and input validation.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2021-11-16T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9842c4522896dcbf2375

Added to database: 5/21/2025, 9:09:22 AM

Last enriched: 6/23/2025, 6:02:43 PM

Last updated: 8/5/2025, 6:18:43 PM

Views: 11

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats