Detection of SQL Injection: A Comparative Analysis of Machine Learning and Deep Learning Algorithms - Ferreira, Tiago Martins; Lucas, Thiago José; Tojeiro, Carlos Alexandre Carvalho; Bertazzoli, Carlos Eduardo Silva; Lopes, Alessandra de Souza; Pontara, Ana Caroline Silva (Anais do Congresso Latino-Americano de Software Livre e Tecnologias Abertas (Latinoware); 2025: Anais do XXII Congresso Latino-Americano de Software Livre e Tecnologias Abertas, 2025)
This study investigates the effectiveness of Machine Learning (ML) and Deep Learning (DL) models in detecting SQL Injection (SQLi) attacks. Using a labeled dataset, techniques such as TF-IDF with n-grams and SMOTE for class imbalance were applied. The models evaluated include Naive Bayes, Random Forest, Support Vector Machine (SVM), and a Bi-LSTM network. Results indicated that the Bi-LSTM achieved the best performance (accuracy of 98.15%), followed by Random Forest and SVM. The research demonstrates that DL-based approaches, combined with appropriate preprocessing, are effective for SQLi detection, surpassing traditional models in accuracy and generalization capability. It is concluded that these techniques are promising for deployment in real-world environments, provided computational costs and practical implementation challenges are taken into account.