Recursive Journal of Informatics
Vol. 4 No. 2 (2026): September 2026

SQL Injection Detection Using Character-Level Embedding with Convolutional Neural Network and Gated Recurrent Unit

Ahmad Andri Alfian (Universitas Negeri Semarang)
Subhan Subhan (Universitas Negeri Semarang)



Article Info

Publish Date
30 Sep 2026

Abstract

Abstract. SQL Injection is one of the most common cyberattacks targeting web applications by exploiting malicious SQL queries to gain unauthorized access to database systems. Conventional SQL Injection detection methods generally rely on manually engineered features or word-level representations, which may overlook fine-grained syntactic characteristics contained in SQL queries. Purpose: This study aims to develop and evaluate a SQL Injection detection model based on Character-level Embedding, Convolutional Neural Network (CNN), and Gated Recurrent Unit (GRU). The proposed model is expected to preserve character-level information while improving the capability to distinguish legitimate SQL queries from SQL Injection attacks. Methods/Study design/approach: The proposed model combines Character-Level Embedding, CNN, and GRU for binary classification of SQL queries. The dataset used is the SQL Injection Dataset obtained from the Kaggle website, consisting of 30,907 SQL queries with 19,529 legitimate queries and 11,378 SQL Injection queries. Before model training, the dataset was preprocessed using character-level tokenization, sequence padding, and dataset splitting with a ratio of 80:10:10 for training, validation, and testing. The model was implemented using TensorFlow and Keras, trained with the Adam optimizer and Binary Cross-entropy loss function, and evaluated using Accuracy, Precision, Recall, F1-score, and Confusion Matrix. Result/Findings: The proposed CNN-GRU model achieved an Accuracy of 99.64%, Precision of 100%, Recall of 99.03%, and F1-score of 99.51% indicating that the model effectively classifies legitimate SQL queries and SQL Injection attacks with high performance. Novelty/Originality/Value: It can be concluded that integrating Character-Level Embedding with hybrid CNN-GRU architecture enables the proposed model to learn both local character patterns and long-term sequential dependencies without requiring manual feature engineering. Therefore, the proposed approach provides an effective alternative for SQL Injection detection and has the potential to improve web application security.

Copyrights © 2026






Journal Info

Abbrev

rji

Publisher

Subject

Computer Science & IT

Description

Recursive Journal of Informatics published by the Department of Computer Science, Universitas Negeri Semarang, a journal of Information Systems and Information Technology which includes scholarly writings on pure research and applied research in the field of information systems and information ...