GraphQL Injection

GraphQL Injection

Knowledge Base>GraphQL Injection

Summary

GraphQL Injection allows an attacker to manipulate GraphQL queries to perform unauthorized operations, extract sensitive data, or execute arbitrary code.

Testing methodology

/graphql/graphql/console/graphiqlquery={__schema{types{name,fields{name}}}}Enumerate Database Schema via IntrospectionIdentifyquery={user{name, passwd}}
Map Paths
Identify Endpoints
Supported Queries
Enumerate Schema
Extract Information

Description

GraphQL Injection is a vulnerability that occurs when an attacker can manipulate GraphQL queries or their parameters to perform unauthorized operations, extract sensitive data, or execute arbitrary code on the server-side. Attackers can exploit this vulnerability by injecting malicious GraphQL queries or modifying existing queries to gain unauthorized access, escalate privileges, or compromise the integrity and confidentiality of the system.

Remediations

  • Implement strict input validation and sanitization of user-controlled input used in GraphQL queries.
  • Avoid building dynamic queries by concatenating user input. Instead, use query parameterization or prepared statements.
  • Apply proper access controls and authorization mechanisms to restrict unauthorized access to sensitive data or operations.
  • Regularly update and patch the GraphQL server implementation and dependencies.

Usually precedes

Affected components

  • Database
  • Sensitive Information

By using this site you agree to our Terms of Service and Privacy Policy.