With the increase in software vulnerabilities that cause significant economic and social losses, automatic vulnerability detection has become essential in software development and maintenance. Recently, large language models (LLMs) like GPT have received considerable attention due to their stunning intelligence, and some studies consider using ChatGPT for vulnerability detection. However, they do not fully consider the characteristics of LLMs, since their designed questions to ChatGPT are simple without a specific prompt design tailored for vulnerability detection. This paper launches a study on the performance of software vulnerability detection using ChatGPT with different prompt designs. Firstly, we complement previous work by applying various improvements to the basic prompt. Moreover, we incorporate structural and sequential auxiliary information to improve the prompt design. Besides, we leverage ChatGPT's ability of memorizing multi-round dialogue to design suitable prompts for vulnerability detection. We conduct extensive experiments on two vulnerability datasets to demonstrate the effectiveness of prompt-enhanced vulnerability detection using ChatGPT. We also analyze the merit and demerit of using ChatGPT for vulnerability detection. Repository: https://github.com/KDEGroup/LLMVulnerabilityDetection.
SPVR: syntax-to-prompt vulnerability repair based on large language models
Harbin Institute of Technology, Shenzhen(哈尔滨工业大学(深圳));Hong Kong University of Science and Technology(香港科技大学);The Chinese University of Hong Kong(香港中文大学);Chinese Academy of Sciences(中国科学院)
Jailbreaking ChatGPT via Prompt Engineering: An Empirical Study
Nanyang Technological University(南洋理工大学);University of New South Wales(新南威尔士大学);Virginia Tech(弗吉尼亚理工大学);Huazhong University of Science and Technology(华中科技大学)
Evaluating Large Language Models for Line-Level Vulnerability Localization
School of Software, Beihang University(北京航空航天大学软件学院);Nanyang Technological University(南洋理工大学);Yale University(耶鲁大学);Singapore Management University(新加坡管理大学)
CGP-Tuning: Structure-Aware Soft Prompt Tuning for Code Vulnerability Detection
School of Computer Science and Engineering, University of New South Wales (UNSW)(新南威尔士大学计算机科学与工程学院);Department of Electrical Engineering and Information Technology, University of Naples Federico II(那不勒斯费德里克二世大学电气工程与信息技术系)