Detecting SQL injection attacks by binary gray wolf optimizer and machine learning algorithms

Bahman Arasteh,Babak Aghaei,Behnoud Farzad,Keyvan Arasteh,Farzad Kiani,Mahsa Torkamanian-Afshar
DOI: https://doi.org/10.1007/s00521-024-09429-z
2024-03-18
Neural Computing and Applications
Abstract:SQL injection is one of the important security issues in web applications because it allows an attacker to interact with the application's database. SQL injection attacks can be detected using machine learning algorithms. The effective features should be employed in the training stage to develop an optimal classifier with optimal accuracy. Identifying the most effective features is an NP-complete combinatorial optimization problem. Feature selection is the process of selecting the training dataset's smallest and most effective features. The main objective of this study is to enhance the accuracy, precision, and sensitivity of the SQLi detection method. In this study, an effective method to detect SQL injection attacks has been proposed. In the first stage, a specific training dataset consisting of 13 features was prepared. In the second stage, two different binary versions of the Gray-Wolf algorithm were developed to select the most effective features of the dataset. The created optimal datasets were used by different machine learning algorithms. Creating a new SQLi training dataset with 13 numeric features, developing two different binary versions of the gray wolf optimizer to optimally select the features of the dataset, and creating an effective and efficient classifier to detect SQLi attacks are the main contributions of this study. The results of the conducted tests indicate that the proposed SQL injection detector obtain 99.68% accuracy, 99.40% precision, and 98.72% sensitivity. The proposed method increases the efficiency of attack detection methods by selecting 20% of the most effective features.
computer science, artificial intelligence
What problem does this paper attempt to address?
### Problems the Paper Aims to Solve The main goal of this paper is to improve the accuracy, precision, and sensitivity of SQL injection attack detection methods. Specifically, the paper proposes the following improvements: 1. **Improve the accuracy of SQL injection detection methods**: Enhance the accuracy of classifiers by optimizing feature selection. 2. **Improve the precision of SQL injection detection methods**: Reduce the false positive rate and increase the precision in identifying malicious SQL queries. 3. **Improve the sensitivity of SQL injection detection methods**: Ensure the effective detection of more SQL injection attacks. 4. **Reduce the error rate of SQL injection detection methods**: Decrease the error rate of classifiers and improve overall performance. 5. **Find the most effective minimal feature set**: Use the fewest but most effective features in the detection method. To achieve these goals, the paper proposes a new SQL injection attack detection method, which mainly includes the following steps: - First, a specific training dataset containing 13 features was created. - Second, two different versions of the binary Grey Wolf Optimization algorithm (bGWO) were developed to select the most effective features in the dataset. - Finally, efficient SQL injection detection classifiers were built using the optimized dataset and different machine learning algorithms (such as Artificial Neural Networks and Decision Trees). Experimental results show that the proposed SQL injection detector achieved 99.68% accuracy, 99.40% precision, and 98.72% sensitivity, and significantly improved detection efficiency by selecting the top 20% most effective features.