Indonesian Journal of Data and Science
Vol. 7 No. 2 (2026): Indonesian Journal of Data and Science

A Comparative Study of LSTM and CNN Models in SQL Injection Attack Detection

Abdul Rachman Manga' (Universitas Muslim Indonesia)
Wahyu Kadri Rahmat Suat Suat (Universitas Muslim Indonesia)
Huzain Azis (Universitas Muslim Indonesia)



Article Info

Publish Date
31 Jul 2026

Abstract

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






Journal Info

Abbrev

ijodas

Publisher

Subject

Computer Science & IT Decision Sciences, Operations Research & Management Mathematics

Description

IJODAS provides online media to publish scientific articles from research in the field of Data Science, Data Mining, Data Communication, Data Security and Data ...