SQL injection attack detection is a crucial aspect of cybersecurity, considering the potential damage that such attacks can cause. This study aims to evaluate the effectiveness of the Naive Bayes model in detecting SQL injection attacks on an imbalanced dataset. To address the data imbalance issue, the SMOTE (Synthetic Minority Over-sampling Technique) method was applied. The study consists of two phases: first, training and testing the Naive Bayes model on the original dataset without SMOTE, and second, training and testing on the dataset with SMOTE applied. The results indicate that the Naive Bayes model on the dataset without SMOTE achieved an accuracy of 0.9948, F1 Score of 0.9885, Precision of 0.9906, and Recall of 0.9946. After applying SMOTE, the model's performance improved significantly, with an accuracy of 0.9950, F1 Score of 0.9950, Precision of 0.9950, and Recall of 0.9950. This improvement suggests that SMOTE effectively enhanced class balance in the dataset, improving the model's ability to detect both malicious and safe queries. The study recommends exploring other resampling methods, feature engineering analysis, and testing on more diverse datasets as well as implementation in real-world environments for future research.
Read full abstract