Examining Zero-Shot Vulnerability Repair with Large Language Models
The DOI matches its Crossref record; 43 of the 43 references it cites were found in a registry or an index.
Abstract
Human developers can produce code with cybersecurity bugs. Can emerging ‘smart’ code completion tools help repair those bugs? In this work, we examine the use of large language models (LLMs) for code (such as OpenAI’s Codex and AI21’s Jurassic J-1) for zero-shot vulnerability repair. We investigate challenges in the design of prompts that coax LLMs into generating repaired versions of insecure code. This is difficult due to the numerous ways to phrase key information— both semantically and syntactically—with natural languages. We perform a large scale study of five commercially available, black-box, "off-the-shelf" LLMs, as well as an open-source model and our own locally-trained model, on a mix of synthetic, hand-crafted, and real-world security bug scenarios. Our experiments demonstrate that while the approach has promise (the LLMs could collectively repair 100% of our synthetically generated and hand-crafted scenarios), a qualitative evaluation of the model’s performance over a corpus of historical real-world examples highlights challenges in generating functionally correct code.
Overview
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Integrity signals
Registry
Cites
Statistics
Verification
Claims the paper makes
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Claims other papers make about this one
Each is checked against this paper’s own text: does it say what the citing paper says it does?
In the citing paper
“That said, LLMs may also generate secure code as a replacement for insecure code [27] (i.e. may be used for bug patches). Although this was only shown to reliably work for small synthetic examples rather than for case studies taken from real-world vulnerabilities, where the results were inconclusive”
From Lost at C: A User Study on the Security Implications of Large Language Model Code Assistants (2022) · cites this paper as [27]
Self-check
Percentages, sums and reported differences re-computed from the paper’s own numbers.
The self-check needs the paper’s full text.
Citations
Cites
Language Models are Few-Shot Learners
Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. (2020) · arXiv · doi:10.48550/arxiv.2005.14165 · Cited by 23,372 · cited 2×
“LLMs trained on large corpora of data can inadvertently gain some ability to perform multiple tasks, even in a “zeroshot” setting [5], [6].”
BackgroundKaugeranna, R., Kaugeranna, E., & Aion, (. S. 4. 6. (2023) · DROPS (Schloss Dagstuhl – Leibniz Center for Informatics) · doi:10.4230/lipics.giscience.2023.43 · Cited by 13,690
2017 USENIX Annual Technical Conference (USENIX ATC'17)
Quoc, D. L., Beck, M. S., Bhatotia, P., Chen, R., Fetzer, C. W., & Strufe, T. (2017) · Cited by 3,091
Evaluating Large Language Models Trained on Code
Chen, M., Tworek, J., Jun, H., Yuan, Q., Pinto, H. P. D. O., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., Brockman, G., et al. (2021) · arXiv · doi:10.48550/arxiv.2107.03374 · Cited by 1,436 · cited 8×
“These include OpenAI’s Codex models [1], AI21’s Jurassic-1 models [8], [25], and the ‘polycoder’ model [26].”
BackgroundMethodInfluentialGenProg: A Generic Method for Automatic Software Repair
Le Goues, C., Nguyen, T., Forrest, S., & Weimer, W. (2012) · IEEE Transactions on Software Engineering · doi:10.1109/tse.2011.104 · Cited by 1,085 · cited 3×
“NMT-based approaches steer clear of problems due to “overfitting” test suites [41], a pitfall of generate-and-validate approaches for patch generation (e.g., the seminal GenProg [42]).”
BackgroundInfluentialSimplifying and isolating failure-inducing input
Zeller, A., & Hildebrandt, R. (2002) · IEEE Transactions on Software Engineering · doi:10.1109/32.988498 · Cited by 1,079
Evaluating large language models trained on code
Chen, M. (2024) · TIB Data Manager · doi:10.57702/wbv3e61b · Cited by 737
AddressSanitizer: a fast address sanity checker
Serebryany, K., Bruening, D. L., Potapenko, A., & Vyukov, D. (2012) · USENIX Annual Technical Conference · Cited by 724
A new algorithm for data compression
Gage, P. (1994) · C/C++ users journal · doi:10.5555/177910.177914 · Cited by 700
A systematic evaluation of large language models of code
Xu, F. F., Alon, U., Neubig, G., & Hellendoorn, V. J. (2022) · Proceedings of the 6th ACM SIGPLAN International Symposium on Machine Programming · doi:10.1145/3520312.3534862 · Cited by 540
Asleep at the Keyboard? Assessing the Security of GitHub Copilot’s Code Contributions
Pearce, H., Ahmad, B., Tan, B., Dolan-Gavitt, B., & Karri, R. (2022) · 2022 IEEE Symposium on Security and Privacy (SP) · doi:10.1109/sp46214.2022.9833571 · Cited by 476
Self-citationAn analysis of patch plausibility and correctness for generate-and-validate patch generation systems
Qi, Z., Long, F., Achour, S., & Rinard, M. (2015) · Proceedings of the 2015 International Symposium on Software Testing and Analysis · doi:10.1145/2771783.2771791 · Cited by 420 · cited 2×
“[41] found that although GenProg [42] claimed to fix 55 bugs, with stricter testing only two of the patches were correct.”
BackgroundSEQUENCER: Sequence-to-Sequence Learning for End-to-End Program Repair
Chen, Z., Kommrusch, S. J., Tufano, M., Pouchet, L.-N., Poshyvanyk, D., & Monperrus, M. (2021) · IEEE Transactions on Software Engineering · doi:10.1109/tse.2019.2940179 · Cited by 396
Program Synthesis with Large Language Models
Austin, J., Odena, A., Nye, M., Bosma, M., Michalewski, H., Dohan, D., Jiang, E., Cai, C., Terry, M., Le, Q., et al. (2021) · arXiv · doi:10.48550/arxiv.2108.07732 · Cited by 388 · cited 1×
“Given increasing complexity of software and the ongoing pursuit of development process efficiency, researchers have investigated myriad ways to support software development, such as tools for code completion [1], [3], [43]–[45] or recommending fixes based on compiler error messages by “crowdsourcing” collective wisdom…”
MethodAn Empirical Study on Learning Bug-Fixing Patches in the Wild via Neural Machine Translation
Tufano, M., Watson, C., Bavota, G., Penta, M. D., White, M., & Poshyvanyk, D. (2019) · ACM Transactions on Software Engineering and Methodology · doi:10.1145/3340544 · Cited by 370 · cited 1×
“NMT-based approaches train dedicated models, such as recurrent neural network (RNN)-based encoder-decoder architectures [15] on explicit “bug-fix pairs” mined from software repositories (e.”
MethodCoCoNuT: combining context-aware neural translation models using ensemble for program repair
Lutellier, T., Pham, H. V., Pang, L., Li, Y., Wei, M., & Tan, L. (2020) · Proceedings of the 29th ACM SIGSOFT International Symposium on Software Testing and Analysis · doi:10.1145/3395363.3397369 · Cited by 344
Automatic Software Repair: A Bibliography
Monperrus, M. (2019) · ACM Computing Surveys · doi:10.1145/3105906 · Cited by 321 · cited 2×
“For a survey, consider work by Monperrus [22].”
BackgroundCURE: Code-Aware Neural Machine Translation for Automatic Program Repair
Jiang, N., Lutellier, T., & Tan, L. (2021) · 2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE) · doi:10.1109/icse43902.2021.00107 · Cited by 290 · cited 1×
“first pre-trains a model on a large software code-base to “learn developer-like source code” before fine-tuning to specialize on the program repair task [14].”
MethodWang, Q., Wen, C., Liu, D., Han, X., Yu, B., Chen, P., Qin, S., & Tian, C. (2023) · DROPS (Schloss Dagstuhl – Leibniz Center for Informatics) · doi:10.4230/lipics.esem.2026.25 · Cited by 282
Li, J., Zhao, B., & Zhang, C. (2018) · Cybersecurity · doi:10.1186/s42400-018-0002-y · Cited by 278
A Large-Scale Empirical Study of Security Patches
Li, F., & Paxson, V. (2017) · Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security · doi:10.1145/3133956.3134072 · Cited by 241 · cited 6×
“For example, security patches are more localized and with fewer source code modifications compared to nonsecurity bugs [17].”
BackgroundInfluentialQuality analysis of source code comments
Steidl, D., Hummel, B., & Juergens, E. (2013) · 2013 21st International Conference on Program Comprehension (ICPC) · doi:10.1109/icpc.2013.6613836 · Cited by 199 · cited 1×
“Prior studies of code comments in opensource software reveal a wide range of reasons for them [9]– [11], [28], including marking intent for developers, such as explaining functionality or indicating where fixes should occur (e.”
BackgroundTufano, M., Watson, C., Bavota, G., Di Penta, M., White, M., & Poshyvanyk, D. (2018) · Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering · doi:10.1145/3238147.3240732 · Cited by 133
Classifying Code Comments in Java Open-Source Software Systems
Pascarella, L., & Bacchelli, A. (2017) · International Conference on Mining Software Repositories (MSR) · doi:10.1109/msr.2017.63 · Cited by 123 · cited 1×
“Comments serve several purposes, from notices through to explanations of parts of the code for other developers [9], [10].”
BackgroundIEEE Transactions On Software Engineering
(1978) · IEEE Transactions on Computers · doi:10.1109/tc.1978.1675169 · Cited by 117
NLP (Natural Language Processing) for NLP (Natural Language Programming)
Mihalcea, R. F., Liu, H., & Lieberman, H. A. (2006) · Lecture notes in computer science · doi:10.1007/11671299_34 · Cited by 105
Failure sketching: a technique for automated root cause diagnosis of in-production failures
Kasikci, B., Schubert, B., Pereira, C. L., Pokam, G., & Candea, G. (2015) · ACM SIGOPS Symposium on Operating Systems Principles (SOSP) · doi:10.1145/2815400.2815412 · Cited by 104
Using likely invariants for automated software fault localization
Sahoo, S. K., Criswell, J., Geigle, C., & Adve, V. (2013) · International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS) · doi:10.1145/2451116.2451131 · Cited by 99
Isolating failure-inducing thread schedules
Choi, J.-D., & Zeller, A. (2002) · ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA) · doi:10.1145/566172.566211 · Cited by 84
BugFix: A learning-based tool to assist developers in fixing bugs
Jeffrey, D., Feng, M., Gupta, N., & Gupta, R. (2009) · 2009 IEEE 17th International Conference on Program Comprehension · doi:10.1109/icpc.2009.5090029 · Cited by 80
Beyond Tests: Program Vulnerability Repair via Crash Constraint Extraction
Gao, X., Wang, B., Duck, G. J., Ji, R., Xiong, Y., & Roychoudhury, A. (2021) · ACM Transactions on Software Engineering and Methodology · doi:10.1145/3418461 · Cited by 70
/*icomment: bugs or bad comments?*/
Tan, L., Yuan, D., Krishna, G., & Zhou, Y. (2007) · ACM SIGOPS Operating Systems Review · doi:10.1145/1323293.1294276 · Cited by 52
Generating bug-fixes using pretrained transformers
Drain, D., Wu, C., Svyatkovskiy, A., & Sundaresan, N. (2021) · Proceedings of the 5th ACM SIGPLAN International Symposium on Machine Programming · doi:10.1145/3460945.3464951 · Cited by 45 · cited 1×
“DeepDebug [16] requires the curation of bug/patch datasets and formulates the goal of predicting humandesigned patches.”
MethodAutomated Bug Hunting With Data-Driven Symbolic Root Cause Analysis
Yagemann, C., Chung, S. P. H., Saltaformaggio, B., & Lee, W. (2021) · ACM SIGSAC Conference on Computer and Communications Security (CCS) · doi:10.1145/3460120.3485363 · Cited by 37 · cited 1×
“We note that although root cause identification and localization for security vulnerabilities is an active area of research [35]–[40], this question is orthogonal to the repair-based research questions we investigate in this work.”
BackgroundIs there a correlation between code comments and issues? an exploratory study
Misra, V., Reddy, J. S. K., & Chimalakonda, S. (2020) · ACM Symposium on Applied Computing · doi:10.1145/3341105.3374009 · Cited by 26 · cited 4×
“Prior studies of code comments in opensource software reveal a wide range of reasons for them [9]– [11], [28], including marking intent for developers, such as explaining functionality or indicating where fixes should occur (e.”
BackgroundInfluentialFix that Fix Commit: A real-world remediation analysis of JavaScript projects
Bandara, V., Rathnayake, T., Weerasekara, N., Elvitigala, C., Thilakarathna, K., Wijesekera, P., & Keppitiyagama, C. (2020) · 2020 IEEE 20th International Working Conference on Source Code Analysis and Manipulation (SCAM) · doi:10.1109/scam51674.2020.00027 · Cited by 23 · cited 1×
“Other prior work includes techniques and tools for detecting security bugs [19], [30], [49], [50].”
Method2009 IEEE 17th International Conference on Program Comprehension
(2009) · doi:10.1109/icpc15491.2009 · Cited by 22
An Empirical Cybersecurity Evaluation of GitHub Copilot's Code ContributionsPreprint
Pearce, H. A., Ahmad, B., Tan, B., Dolan-Gavitt, B., & Karri, R. (2021) · arXiv (Cornell University) · Cited by 17
Self-citationExamining Zero-Shot Vulnerability Repair with Large Language Models
Pearce, H., Tan, B., Ahmad, B., Karri, R., & Dolan-Gavitt, B. (2021) · arXiv · doi:10.48550/arxiv.2112.02125 · Cited by 17
Self-citationThe Secret Life of Commented-Out Source Code
Pham, T. M. T., & Yang, J. (2020) · International Conference on Program Comprehension · doi:10.1145/3387904.3389259 · Cited by 10 · cited 2×
“Similarly, source code can appear inside comments; “commented-out” code often appears in code commits as part of the bug-fixing process [29].”
Background{ARCUS}: Symbolic Root Cause Analysis of Exploits in Production Systems
Yagemann, C., Pruett, M., Chung, S. P. H., Bittick, K., Saltaformaggio, B., & Lee, W. (2021) · USENIX Security Symposium · Cited by 9
Generating formal system models from natural language descriptions
Drechsler, R., Harris, I. G., & Wille, R. (2012) · Proceedings · doi:10.1109/hldvt.2012.6418259 · Cited by 7 · cited 1×
“Given increasing complexity of software and the ongoing pursuit of development process efficiency, researchers have investigated myriad ways to support software development, such as tools for code completion [1], [3], [44]–[46] or recommending fixes based on compiler error messages by “crowdsourcing” collective wisdom…”
Method
Research works printed but not linked: 7
- GitHub Copilot • Your AI pair programmer. Github,
- Discover Use Cases for AI21 Studio and Jurassic-1. AI21.
- Completion -OpenAI API. Openai,
- Jurassic-1: Technical Details and Evaluation. O Lieber, O Sharir, B Lentz, Y Shoham, I21
- Source Code Analysis Tools. OWASP.
- Examples -OpenAI API. Openai,
- What would other programmers do: suggesting solutions to error messages. B Hartmann, D Macdougall, J Brandt, S R Klemmer, Proceedings of the 28th international conference on Human factors in computing systems -CHI '10. the 28th international conference on Human factors in computing systems -CHI '10Atlanta, Georgia, USAACM Press20101019
Cited by
A survey on large language model (LLM) security and privacy: The Good, The Bad, and The Ugly
Yao, Y., Duan, J., Xu, K., Cai, Y., Sun, Z., & Zhang, Y. (2024) · High-Confidence Computing · doi:10.1016/j.hcc.2024.100211 · Cited by 1,083
Large Language Models for Software Engineering: A Systematic Literature Review
Hou, X., Zhao, Y., Liu, Y., Yang, Z., Wang, K., Li, L., Luo, X., Lo, D., Grundy, J., & Wang, H. (2024) · ACM Transactions on Software Engineering and Methodology · doi:10.1145/3695988 · Cited by 1,029
Large language models for software engineering: survey and open problems
Fan, A., Gokkaya, B., Harman, M., Lyubarskiy, M., Sengupta, S., Yoo, S., & Zhang, J. M. (2023) · 2023 IEEE/ACM International Conference on Software Engineering: Future of Software Engineering (ICSE-FoSE) · doi:10.1109/icse-fose59343.2023.00008 · Cited by 650
“[148] reported repair results from five commercial LLMs on security bugs, Charalambous et al.”
BackgroundSoftware Testing With Large Language Models: Survey, Landscape, and Vision
Wang, J., Huang, Y., Chen, C., Liu, Z., Wang, S., & Wang, Q. (2024) · IEEE Transactions on Software Engineering · doi:10.1109/tse.2024.3368208 · Cited by 573
“1 Unit test generation Unit Test Case Generation with Transformers and Focal Context 2021 [24] 2 Unit test generation CodeT: Code Generation with Generated Tests 2022 [25] 3 Unit test generation Interactive Code Generation via Test Driven User Intent Formalization 2022 [26] 4 Unit test generation A3Test: Assertion Aug…”
When LLMs meet cybersecurity: a systematic literature review
Zhang, J., Bu, H., Wen, H., Liu, Y., Fei, H., Xi, R., Li, L., Yang, Y., Zhu, H., & Meng, D. (2025) · Cybersecurity · doi:10.1186/s42400-025-00361-w · Cited by 383
Metadata
- Authors
- Pearce, H., Tan, B., Ahmad, B., Karri, R., & Dolan-Gavitt, B.
- Affiliations
- New York University
- University of Calgary (CA)
- New York University (US)
- Venue
- 2023 IEEE Symposium on Security and Privacy (SP)
- Publisher
- IEEE
- Published
- 2023-05
- Pages
- 2339-2356
- ISSN
- 1081-6011 (ISSN-L)
- OpenAlex
- W4385187279
- Semantic Scholar
- a5731122200fbb8b37f048010a1e1ca4474aa606
- Cited by
- 131
- References
- 40
- Citations by year
- 2026: 52 · 2025: 32 · 2024: 40 · 2023: 7
- FWCI
- 33.67
- Type
- conference paper
- Language
- en
- Open access
- closed
- Locations
- IEEE Symposium on Security and Privacy (S&P) (publishedVersion)
- Topics
- Physical Sciences › Computer Science › Information Systems › Software Engineering Research
- Physical Sciences › Computer Science › Software › Software Testing and Debugging Techniques
- Physical Sciences › Computer Science › Information Systems › Web Application Security Vulnerabilities
- Keywords
- large language models, code completion, prompt engineering, secure code generation, codices
About these checks
Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.
Statistics and arithmetic are recomputed, not judged.
Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.
What counts as a claim ›How we measure confidence ›How we check this ›
Are you an author, or do you see a problem with this page? Request a review
Data sources
Bibliographic data: Semantic Scholar, OpenAlex, Crossref.
Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).
Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.