# SSQLi: A Black-Box Adversarial Attack Method for SQL Injection Based on Reinforcement Learning
###### Abstract  
SQL injection is a highly detrimental web attack technique that can result in significant data leakage and compromise system integrity. To counteract the harm caused by such attacks, researchers have devoted much attention to the examination of SQL injection detection techniques, which have progressed from traditional signature-based detection methods to machine- and deep-learning-based detection models. These detection techniques have demonstrated promising results on existing datasets; however, most studies have overlooked the impact of adversarial attacks, particularly black-box adversarial attacks, on detection methods. This study addressed the shortcomings of current SQL injection detection techniques and proposed a reinforcement-learning-based black-box adversarial attack method. The proposal included an innovative vector transformation approach for the original SQL injection payload, a comprehensive attack-rule matrix, and a reinforcement-learning-based method for the adaptive generation of adversarial examples. Our approach was evaluated on existing web application firewalls (WAF) and detection models based on machine- and deep-learning methods, and the generated adversarial examples successfully bypassed the detection method at a rate of up to 97.39%. Furthermore, there was a substantial decrease in the detection accuracy of the model after multiple attacks had been carried out on the detection model via the adversarial examples. SQL injection; adversarial attack; black-box attack; reinforcement learning; attack-rule matrix; adversarial example +
Footnote †: journal:  
can exploit the victim's browser to execute malicious code, which can cause significant damage by stealing or modifying sensitive information. Therefore, in recent years, the detection of XSS attacks has received considerable attention in research on web application security. Adversarial attacks on XSS detection models have received considerable attention in recent years, with researchers proposing various methods, such as GAN-based [7] and reinforcement-learning-based [8; 9; 10] adversarial attack methods, significantly diminishing the ability of XSS detection models to accurately identify such attacks. In contrast, the research on the adversarial attacks against the SQL injection detection models is only in the early stages, with a limited number of studies conducted in this area. [PERSON] et al. proposed the use of a transformer model to learn the semantic structure of SQL statements and translate the original SQL injection payloads into different forms of attack statements with the same intent [11]. [PERSON] et al. constructed a mutation rule tree for SQL injection payloads, where the system randomly selected mutation rules in the tree to mutate the payload samples, bypassing the detector [12]. However, these studies have had limitations as they have not included black-box attack methods that better resemble a real-world scenario; in addition, they have relied on a single attack strategy and have been unable to stack. Therefore, researchers have proposed reinforcement-learning-based frameworks for black-box WAF bypass and validated their schemes with SQL injection attacks [13; 14; 15; 16]. However, these studies only tested the effectiveness of their frameworks on a limited number of WAFs. Moreover, they did not fully investigate the characteristics of SQL injection attacks and lacked effective state-vector-representation algorithms for SQL statements. To study the potential influence of adversarial examples on SQL injection detection, we proposed SSQLi, a novel adversarial example generator for SQL injection that is based on reinforcement learning. We named our approach SSQLi because it is an adversarial attack method against SQL injection detectors based on the soft actor-critic (SAC) algorithm in reinforcement learning. We proposed a comprehensive attack strategy matrix by mining the vulnerabilities of existing SQL injection detection models.