This research focuses on evaluating and comparing the performance of two deep learning architectures, namely Long Short-Term Memory (LSTM) and Convolutional Neural Network (CNN), for detecting SQL Injection (SQLi) attacks on text-based query data. SQL Injection remains one of the most critical cybersecurity threats due to its ability to exploit vulnerabilities in user input validation and compromise the integrity, confidentiality, and availability of information systems. In this study, LSTM and CNN models were trained using a publicly available SQL Injection dataset containing malicious and benign SQL queries. Three train-test split scenarios were evaluated, namely 70:30, 80:20, and 90:10, while maintaining identical preprocessing procedures and experimental configurations. Text preprocessing was performed using tokenization, sequence transformation, padding, and embedding representation to convert SQL queries into numerical input suitable for deep learning models. Model performance was evaluated using accuracy, precision, recall, F1-score, and confusion matrix analysis. The experimental results show that the LSTM model achieved the best performance with an accuracy of 98.90% using the 80:20 train-test split scenario, while the CNN model achieved an accuracy of 97.90% under the same scenario. Although CNN is effective in extracting local textual patterns, LSTM demonstrated better capability in capturing sequential dependencies within SQL query structures. These findings indicate that deep learning approaches, particularly LSTM-based models, provide an effective and reliable solution for SQL Injection detection and support the development of adaptive cybersecurity systems
Copyrights © 2026