Advanced AI Techniques for Protecting GraphQL APIs Against Injection and DoS Attacks

Authors

  • Katarina Vrettos Zagreb Institute of Computational Intelligence, CROATIA

Keywords:

Advanced AI, Techniques for Protecting, GraphQL, APIs, DoS Attacks

Abstract

GraphQL's adaptability is great for speedy data retrieval, but it also brings new security risks that standard API safeguards don't always cover. Attacks like denial-of-service and data exfiltration through injection can be caused by malicious GraphQL queries that take advantage of the language's dynamic nature. When it comes to protecting against complex, context-aware assaults, current solutions like rate restriction, static analysis, and general-purpose Web Application Firewalls fall short. This study introduces a new method for detecting malicious GraphQL queries in real-time using artificial intelligence. Our approach integrates static analysis with machine learning techniques. These techniques include CNNs, Multilayer Perceptrons, and Random Forests for classification, Sentence Transformers (SBERT and Doc2Vec) for contextual embedding of query payloads, and Large Language Models (LLMs) for dynamic schema-based configuration. Our system architecture is described in depth, along with optimization solutions for production scenarios, such as ONNX Runtime and par-allel processing. We also assess how well our detection models and the system perform under stress. The results show that a number of threats, such as SQL injection, OS command injection, and XSS attacks, can be accurately detected with a high degree of accuracy, and that threats like DoS and SSRF attempts may be effectively mitigated. An effective and flexible method for strengthening the security of GraphQL APIs is developed in this study.

Downloads

Published

2025-01-07