arXiv(opens in a new tab)cs.SESep 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2609.10412

Towards Scalable and Cost-Efficient Vulnerability Detection: A Study on Automatic Query Generation

Ivana Clairine Irsan, Ratnadira Widyasari, Huihui Huang, Ting Zhang, Yue Liu, Ouh Eng Lieh, Shar Lwin Khin, Kang Hong Jin, David Lo

IVANA CLAIRINE IRSAN, Singapore Management University, Singapore

RATNADIRA WIDYASARI, Singapore Management University, Singapore

HUIHUI HUANG, Singapore Management University, Singapore

TING ZHANG, Monash University, Australia

YUE LIU, Singapore Management University, Singapore

OUH ENG LIEH, Singapore Management University, Singapore

SHAR LWIN KHIN, Singapore Management University, Singapore

KANG HONG JIN, University of Sydney, Australia

DAVID LO, Singapore Management University, Singapore

Static analysis remains a cornerstone of software security, yet the effectiveness of tools such as CodeQL is often limited by the substantial manual effort required to develop high-coverage query suites. While large language models (LLMs) have emerged as a potential solution for automated code reasoning, their practical utility in generating structured, executable security queries remains underexplored. In this paper, we conduct an empirical study to evaluate the ability of LLMs to synthesize CodeQL queries using vulnerability data from the National Vulnerability Database. Through this investigation, we explore the potential of using LLMs as an automatic CodeQL query generator. Subsequently, we systematically evaluate the performance of various LLM architectures across a diverse set of real-world vulnerabilities, measuring their ability to improve detection coverage and precision. Our findings reveal that LLM-generated queries significantly enhance the baseline CodeQL queries, yielding 82% improvement in average F1-score. Furthermore, we provide a detailed cost-benefit analysis showing that while direct LLM-based scanning of entire repositories is often computationally and financially prohibitive, leveraging LLMs to synthesize CodeQL queries offers a scalable and cost-effective alternative for large-scale vulnerability detection. Our results suggest that LLMs can effectively bridge the gap between unstructured vulnerability reports and formal static analysis specifications, offering a scalable path toward comprehensive automated vulnerability detection.

ACM Reference Format:

Ivana Clairine Irsan, Ratnadira Widyasari, Huihui Huang, Ting Zhang, Yue Liu, Ouh Eng Lieh, Shar Lwin Khin, Kang Hong Jin, and David Lo. 2026. Towards Scalable and Cost-Efficient Vulnerability Detection: A Study on Automatic Query Generation. 1, 1 (September 2026), 20 pages. https://doi.org/10.1145/nnnnnnn.nnnnnnn

Authors' Contact Information: Ivana Clairine Irsan, ivanairsan@smu.edu.sg, Singapore Management University, Singapore; Ratnadira Widyasari, ratnadiraw@smu.edu.sg, Singapore Management University, Singapore; Huihui Huang, hhhuang@smu.edu.sg, Singapore Management University, Singapore; Ting Zhang, Ting.Zhang@monash.edu, Monash University, Australia; Yue Liu, liuyue@smu.edu.sg, Singapore Management University, Singapore; Ouh Eng Lieh, elouh@smu.edu.sg, Singapore Management University, Singapore; Shar Lwin Khin, Ikshar@smu.edu.sg, Singapore Management University, Singapore; Kang Hong Jin, hongjin.kang@sydney.edu.au, University of Sydney, Australia; David Lo, davidlo@smu.edu.sg, Singapore Management University, Singapore.

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.

© 2026 Copyright held by the owner/author(s). Publication rights licensed to ACM.

ACM XXXX-XXXX/2026/9-ART

https://doi.org/10.1145/nnnnnnn.nnnnnnn

Ivana Clairine Irsan, Ratnadira Widyasari, Huihui Huang, Ting Zhang, Yue Liu, Ouh Eng Lieh, Shar Lwin Khin, Kang Hong

2

Jin, and David Lo

References (13)