SQL injection-based adversarial attacks can directly evaluate WAFs by observing block/allow actions, yet existing methods have four key issues: low quality and diversity of payloads, inadequate mutation strategies, semantic inequivalence of mutated payloads, and inefficient search processes for generating such payloads. We hypothesize that a method simultaneously improving these aspects would yield more effective attacks. Thus, we propose BWAFSQLi, a general and extensible framework for adversarial SQLi-based WAF bypass. It first designs a convergence-factor-guided context-free grammar to generate high-quality, diverse payloads (covering 18 attack scenarios, targeting 58 rules). For detected payload tokens, BWAFSQLi applies 26 rules with 15 mutation strategies—including two novel techniques (Quotation Mark Encoding and Comment Extension)—to ensure semantic-equivalent mutations. A mutation strategy selection mechanism, integrating a decay factor and historical data table, enables adaptive multi-position mutations for efficient exploration while reducing requests. Mutated payloads are finally evaluated via HTTP requests against target WAFs. Experiments with one self-built dataset (SQLiCFG) and two public datasets (HPD, SIK) on 11 WAFs (3 gray-box, 8 black-box) show BWAFSQLi increases WAF‘s false negative rates (FNR) by up to 93.39% (gray-box) and 58.49% (black-box) with minimal-requests, surpassing three SOTA methods. Applying seven proposed preprocessing defenses fully suppresses FNR increases, highlighting practical significance.
Zhang et al. (Mon,) studied this question.