Netinfo Security ›› 2023, Vol. 23 ›› Issue (11): 84-93.doi: 10.3969/j.issn.1671-1122.2023.11.009

Previous Articles     Next Articles

A Large Language Model Based SQL Injection Attack Detection Method

HUANG Kaijie, WANG Jian(), CHEN Jiongyi   

  1. College of Electronic Science and Technology, National University of Defense Technology, Changsha 410073, China
  • Received:2023-08-25 Online:2023-11-10 Published:2023-11-10

Abstract:

The SQL injection attack, widely employed by attackers, poses a significant threat to cyberspace security. Traditional detection methods for SQL injection attacks include rule-based and machine learning-based method, suffering from limited applicability and high false positive rates. This paper proposed a large language model-based method for detecting SQL injection attacks. By applying prompt engineering and instruction fine-tuning techniques, a specialized large language model for SQL injection attack detection was developed; Additionally, the impact of iteration rounds, the number of fine-tuning samples and inference parameters on model performance was analyzed to enhance the detection capability of large language models; Leveraging the robust semantic understanding capability of the large language model significantly reduced the false positive rate. This paper conduct experimental analysis on a specialized large language model for SQL injection attack detection that we proposed, using the Kaggle dataset. The model achievedes an accuracy rate of over 99.85%, a false alarm rate of less than 0.2%, and an F1 score of 0.999. Compared to the current state-of-the-art methods for SQL injection attack detection, our model demonstrates a significant improvement in detection performance.

Key words: SQL injection attack, attack detection, large language model, prompt engineering, instruction tuning

CLC Number: