SQL Injection Detection Based on Lightweight Multi-Head Self-Attention

Rui Teng Lo, Wen Jyi Hwang*, Tsung Ming Tai

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

Abstract

This paper presents a novel neural network model for the detection of Structured Query Language (SQL) injection attacks for web applications. The model features high detection accuracy, fast inference speed, and low weight size. The model is based on a novel Natural Language Processing (NLP) technique, where a tokenizer for converting SQL queries into tokens is adopted as a pre-processing stage for detection. Only SQL keywords and symbols are considered as tokens for removing noisy information from input queries. Moreover, semantic labels are assigned to tokens for highlighting malicious intentions. For the exploration of correlation among the tokens, a lightweight multi-head self-attention scheme with a position encoder is employed. Experimental results show that the proposed algorithm has high detection performance for SQL injection. In addition, compared to its lightweight NLP counterparts based on self-attention, the proposed algorithm has the lowest weight size and highest inference speed. It consumes only limited computation and storage overhead for web services. In addition, it can even be deployed in the edge devices with low computation capacity for online detection. The proposed algorithm therefore is an effective low-cost solution for SQL injection detection.

Original languageEnglish
Article number571
JournalApplied Sciences (Switzerland)
Volume15
Issue number2
DOIs
Publication statusPublished - 2025 Jan

Keywords

  • cyber security
  • deep learning
  • machine learning
  • natural language processing
  • SQL injection detection

ASJC Scopus subject areas

  • General Materials Science
  • Instrumentation
  • General Engineering
  • Process Chemistry and Technology
  • Computer Science Applications
  • Fluid Flow and Transfer Processes

Fingerprint

Dive into the research topics of 'SQL Injection Detection Based on Lightweight Multi-Head Self-Attention'. Together they form a unique fingerprint.

Cite this