Examining Zero-Shot Vulnerability Repair with Large Language Models

By Hammond A. Pearce, Benjamin Tan, Baleegh Ahmad, Ramesh Karri, Brendan Dolan-Gavitt. 2021

339 citations recorded by the source corpus.

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.

Subfields: Software, Large Language Models, Code Generation & Program Synthesis, Signal Processing

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Software

  1. Shin Yoo
  2. Mark Harman
  3. Shubho Sengupta
  4. Mitya Lyubarskiy
  5. Jie M. Zhang
  6. Angela Fan
  7. Beliz Gokkaya
  8. Brendan Dolan-Gavitt

In Large Language Models

  1. Brendan Dolan-Gavitt
  2. Mark Harman
  3. Ramesh Karri
  4. Hammond A. Pearce

In Code Generation & Program Synthesis

  1. Brendan Dolan-Gavitt
  2. Mark Harman
  3. Siddharth Garg
  4. Ramesh Karri
  5. Gustavo Sandoval
  6. Teo Nys
  7. Hammond A. Pearce

In Signal Processing

  1. Siddharth Garg
  2. Brendan Dolan-Gavitt
  3. Shin Yoo
  4. Mark Harman
  5. Ramesh Karri
  6. Aleksander Madry
  7. Vitaly Shmatikov
  8. Eugene Bagdasarian

Citations in the corpus