Enhancing SQL injection detection accuracy with fine-tuning LLaMa 3.2 1B using low-rank adaptation
Abstract
Structured query language injection (SQL injection/SQLi) remains a critical threat to web application security, particularly because it can bypass traditional detection systems through obfuscation. Existing approaches, including rule-based systems and classical machine learning (ML) models, often fail to capture the contextual semantics of com0plex SQL queries. This study proposes a lightweight and context-aware SQLi detection model by fine-tuning the large language model Meta artificial intelligence (LLaMA) 3.2–1B large language model using low-rank adaptation (LoRA). The model was trained using the SQL-Injection-Extend dataset obtained from Kaggle, consisting of 57,310 malicious SQLi samples and 52,208 benign user-input samples. The benign data comprise general user-generated text commonly submitted through web application interfaces. Experimental results demonstrate that the proposed model achieves an accuracy of 99.91%, precision of 99.96%, recall of 99.86%, and an F1-score of 99.91%, outperforming baseline models including convolutional neural network (CNN), long short-term memory (LSTM), and non-fine-tuned large language models (LLMs). These findings indicate that LoRA-based fine-tuning substantially enhances detection performance while maintaining computational efficiency, making the approach suitable for real-time deployment in modern web security systems. Furthermore, the integration of context-aware digital forensic reporting supports post-incident investigation and improves the interpretability of detection outcomes.
Keywords
digital forensics; large language model; LLaMA 3.2; low-rank adaptation; SQL injection; web application security;
Full Text:
PDFDOI: http://doi.org/10.12928/telkomnika.v24i5.27884
Refbacks
- There are currently no refbacks.

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.