AV:N/AC:L/Au:N/C:N/I:N/A:P
CWE-CWE-400

Unchecked GraphQL Query Length: Potential Denial of Service Vulnerability

Severity:
Medium
Summary

Your GraphQL server implementation does not restrict or limit the size of incoming queries. During the assessment, it was observed that a GraphQL query comprising 20000 characters was successfully processed by the server. Large, unchecked queries pose potential denial-of-service threats and can lead to unintended processing costs.

Implementing a simple length check can prevent oversized queries from being processed, thereby safeguarding the server from potential abuse and improving the resilience of your GraphQL server against DoS attacks.

Impact

Accepting very large GraphQL queries without restriction can lead to potential denial-of-service attacks. Attackers can craft oversized queries to exhaust server resources, causing the server to become unresponsive or crash. This can lead to service disruption and increased processing costs.

Remediation

Enforce Query Length Limit: Implement a middleware that checks the length of the incoming GraphQL queries. Queries that exceed a reasonable length, such as 2000 characters, should be rejected. The provided code snippet is an example of how to implement such a check: app.use('*', (req, res, next) => {
const query = req.query.query || req.body.query || '';
if (query.length > 8192) {
throw new Error('Query too large');
}
next();
}); This ensures that only queries within the accepted length are processed, offering a layer of protection against potential attacks.

Required Skills for Successful Exploitation
Actions To Take
Vulnerability Index

You can search and find all vulnerabilities

Select Vulnerability
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Featured resources

Blog

Strengthening enterprise application security: Invicti acquires Kondukto

Blog

Modern AppSec KPIs: Moving from scan counts to real risk reduction

Blog

Friends don’t let friends shift left: Shift smarter with DAST-first AppSec

Blog

Vibe talking: Dan Murphy on the promises, pitfalls, and insecurities of vibe coding

No items found.