Position Matters: Evaluating Large Language Models as SQL Injection Detectors Across Deployment Positions
[C2] M. Abusaqer, “Position Matters: Evaluating Large Language Models as SQL Injection Detectors Across Deployment Positions,” accepted at the 2026 IEEE International Conference on Big Data (IEEE BigData 2026), Phoenix, AZ, Dec. 14 to 17, 2026 (201 of 1,046 submissions accepted in this paper’s category, 19.2%). Proceedings forthcoming.
Abstract
Large language models (LLMs) now write SQL inside data applications, and recent work shows that conventional SQL injection (SQLi) detectors lose much of their accuracy on LLM-generated queries. This study asks whether a prompted LLM can serve as the detector and whether the answer depends on where in the pipeline it sits. Two detectors, a frontier API model and a locally hosted 7B model, are evaluated at three deployment positions: review-time (offline code review), runtime gatekeeper (inline, one-word verdict), and post-hoc (batched log audit). Each position bundles a prompt, an output format, and a batch size. The test set holds 135 malicious queries generated by a third LLM and labeled by the author, 66 benign controls, and 12 prompt-injection payloads; each item was judged three times per position (3,834 verdicts). The frontier model detected 80.7% to 84.4% of attacks with no significant difference among positions (all p > 0.38), but its false positive rate rose from 6.1% at review-time to 22.7% post-hoc (p = 0.001). The small model was position-sensitive: 51.9% detection at review-time and post-hoc against 78.5% as a runtime gatekeeper (p < 0.0001), at about 240 ms per query, no token cost, and a 22.7% false positive rate. Every false positive fell on a generator-produced query labeled benign; none fell on the 40 hand-authored legitimate queries. Both models were weakest on blind Boolean and UNION-based queries. On this corpus the effect of position depends on model capability, and a small local model at the gatekeeper is a low-cost option worth testing at production volume.
BibTeX
@inproceedings{abusaqer2026position,
author = {Abusaqer, Muhammad},
title = {{Position Matters: Evaluating Large Language Models as SQL Injection Detectors Across Deployment Positions}},
booktitle = {Proceedings of the 2026 IEEE International Conference on Big Data (BigData)},
address = {Phoenix, AZ, USA},
year = {2026},
note = {To appear. Code and data: https://doi.org/10.5281/zenodo.24265893}
}
Copyright
This is the accepted version of a paper accepted at the 2026 IEEE International Conference on Big Data (IEEE BigData 2026), Phoenix, AZ, Dec. 14 to 17, 2026. The proceedings are forthcoming. © 2026 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works.