Skip to content
Open access

A comparative evaluation of large language models for detecting SQL injection vulnerabilities in web applications

Jul 2026 · PeerJ Computer Science · Vol 12, pp. e4015 · 0 citations · 36 references
Computer Science

TL;DR

A comparative evaluation of five pre-trained LLMs on the capability of detecting SQL injection attacks indicates that advanced LLMs are potentially promising to enhance the detection of SQL injection and complementary web application security.

Abstract

Structured Query Language (SQL) injection is considered to be one of the most intractable and harmful threats to the security of web applications, as SQL injection is a technique that allows hackers to manipulate queries and steal confidential information. Even though traditional methods of defense have been used, emerging attack techniques continue to circumvent them, and it requires stronger mechanisms of detection. As the concept of Large Language Models (LLMs) has become prominent in the field of cybersecurity, the idea of assessing their capability to detect and address such threats in practical contexts is gaining more and more popularity. This article provides a comparative evaluation of five pre-trained LLMs on the capability of detecting SQL injection attacks. To induce more realistic conditions, a Flask-based web application that linked to an SQLite database was created, which was able to support both benign queries and SQL injection payloads using Boolean-based, Union-based, and Error-based methods. These models were put to the test in the zero-shot settings, and their performance was evaluated by accuracy, precision, recall, and F1-score. Findings indicate that Mixtral-8x7B-Instruct achieved the best results, with an average F1-score of 87.52% and an accuracy of 86.67%. The second-best performance was achieved by LLaMA-3-70B-Instruct, which demonstrated consistently high recall across all attack categories. Deep Seek and CodeLLaMA both performed well in some form of attacks, but not overall. In contrast, Qwen2.5-Coder-7B-Instruct produced the lowest average detection metrics among all evaluated models. These findings indicate that advanced LLMs are potentially promising to enhance the detection of SQL injection and complementary web application security.

Read PDF

Similar papers

Open access Aug 2026

Implementation of a Database Security System to Prevent SQL Injection in CRUD Applications Using Laravel

Laravel is capable of providing effective protection against SQL Injection when its security features are implemented correctly and is recommended for strengthening against other types of attacks such as XSS and CSRF, as well as the use of data encryption to enhance overall system security.

T. S. A. Sukiman, Reyhan Achmad Rizal, C. L. M. Sandy et al. · 0 citations
Open access Aug 2026

SecureMCP: Policy-Enforced Defense Against Prompt Injection in LLM-Generated SQL for AIoT Databases

This paper proposes SecureMCP, a policy-enforced framework that integrates Role-Based Access Control with an MCP server to establish multi-layer defense for LLM-generated SQL execution, and evaluates filter performance—false positive rate (FPR) and false negative rate (FNR))—separately from LLM generation quality.

Wonbae Kim, Hee-Kyong Yoo, Nammee Moon · 0 citations
Review Open access Aug 2026

Evolution of Web Application Attacks: A Systematic Analysis of the Current Threat Landscape and Emerging Security Challenges

This research evaluates how these threats have metastasized and traces the origins of modern security vectors to determine if established defensive protocols remain effective against increasingly complex modern exploitation tactics, and reveals a definitive and strategic maturation in adversarial approach.

Irene I. Eda, Jose Marcelito D. Brigoli, Teodoro B. Comayas et al. · 0 citations
Open access Aug 2026

Enhancing SQL Injection Detection: A Machine Learning Approach Using Network Flow Data

A flow-based detection method, making use of lightweight protocols like NetFlow and sFlow to identify SQLI attacks, which minimizes the need for computationally expensive packet inspection, which is going to render the process of detection more trustworthy and economical, particularly within high-traffic conditions.

P. Vinoth, K. Sudar, S. Muthukumar · 0 citations
Open access Aug 2026

ZeroProbe: An Intelligent Web-Based Vulnerability Scanner Integrating Automated Detection and AI-Based Analysis

The findings confirm that an accessible, accurate, and AI-augmented vulnerability scanner can be constructed for educational and entry-level use within a deliberately bounded scope, lowering the expertise barrier for web application security assessment.

Dah Berrou, Zaenal Alamsyah, Nugraha Nugraha · 0 citations
Review Open access 2026

Security Analysis of LLM-Generated Web API Backends

A security assessment on 75 FastAPI backends generated by three contemporary LLMs revealed a disconnect between functional correctness and secure logic, which is interpreted as a review-risk pattern, which is called the human-in-the-loop paradox.

Abdul Ali Khan, S. Rauti, T. Mäkilä · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.