Exploring ChatGPT's Capabilities on Vulnerability Management

Peiyu Liu, Junming Liu, Lirong Fu, Kangjie Lu, Yifan Xia, Xuhong Zhang, Wenzhi Chen, Haiqin Weng, Shouling Ji, Wenhai Wang

TL;DR

This paper presents the first large-scale empirical evaluation of ChatGPT across the full vulnerability management lifecycle, analyzing over 70,000 samples across six critical tasks. While ChatGPT excels at document-level tasks like bug report summarization and matches or beats specialized tools in automated patch generation, it struggles with complex semantic reasoning and frequently hallucinates without carefully engineered prompts.

What Problem Does This Paper Address?

Vulnerability management is an essential yet labor-intensive process in software security that spans issue discovery, vulnerability confirmation, repair, and patch integration. While LLMs like ChatGPT have demonstrated strong capabilities in standard natural language processing (NLP) and basic code tasks, their effectiveness across the end-to-end vulnerability management lifecycle has remained unclear.

Prior work evaluated LLMs on isolated security subtasks (such as vulnerability fixing), but lacked a holistic perspective on whether off-the-shelf conversational models can assist developers across varied tasks requiring both natural language comprehension and deep code semantics.

Methods

The authors evaluate GPT-3.5 (gpt-3.5-turbo-0301) and GPT-4 (gpt-4-0314) across six core vulnerability management tasks:

  1. Bug report summarization
  2. Security bug report identification
  3. Vulnerability severity evaluation (mapping function descriptions to CVSS exploitability metrics)
  4. Vulnerability repair
  5. Patch correctness assessment
  6. Stable patch classification (identifying if a patch belongs in stable/LTS branches)

The authors evaluate seven prompt strategies:

  • 0-shot, 1-shot, and few-shot prompting using random demonstrations.
  • General-info: Adds role definition, task confirmation, and zero-shot Chain-of-Thought ("Let's think step-by-step").
  • Expertise: Supplements the prompt with hand-curated domain rules and guidelines.
  • Self-heuristic: A novel strategy where ChatGPT itself synthesizes rules and patterns from compressed demonstration examples, which are then embedded back into the prompt.
  • Code-only / Desc-code: Specialized variants for patch analysis tasks.

To prevent data contamination, prompt templates were tuned only on training subsets, validated on a probe-test split (up to 1,000 samples), and finally tested on untouched benchmark test sets.

Datasets

The authors compiled datasets from 11 state-of-the-art (SOTA) baseline tools, totaling 70,346 samples and 19,355,711 tokens:

  • iTAPE dataset (33,438 samples): Bug report summarization.
  • Farsec / DKG / CASMS datasets (22,970 samples): Security bug report identification.
  • DiffCVSS dataset (1,642 samples): CVSS v3.1 exploitability metric mapping.
  • Pearce et al. (LLMset) dataset (12 real-world CVEs and 7 synthetic bugs): Vulnerability repair.
  • Quatrain / Invalidator / Panther datasets (1,342 samples total): Patch correctness assessment.
  • PatchNet dataset (10,896 samples): Linux kernel stable patch classification.

Key Insights and Ideas

  • More context is not always better: Providing both patch code and bug descriptions actually degraded ChatGPT's ability to assess patch correctness. Instead of judging whether the patch safely fixed the logic error, ChatGPT fixated on whether the code diff matched the text description. Removing descriptions improved GPT-4's performance.
  • Random few-shot examples hurt complex tasks: For code repair and classification, random few-shot examples frequently caused hallucinations or spurious correlations (e.g., flagging any bug report containing the words "tab" or "open" as a security vulnerability).
  • Self-heuristic prompting unlocks complex reasoning: For CVSS severity prediction, manual prompt curation was difficult. Having ChatGPT pre-analyze training samples, summarize latent domain heuristics, and inject those heuristics into the prompt improved recall and precision by up to 1.73× over manual expertise prompts.
  • Post-processing pipelines are vital: In vulnerability repair, ChatGPT tended to repeat surrounding context before the bug location, causing simple patch-grafting scripts to fail syntax compilation. Designing intelligent code-stitching workflows substantially improved valid repair rates.

Key Results

  • Bug Report Summarization: GPT-4 with few-shot prompts surpassed the SOTA tool (iTAPE), achieving a ROUGE-L F1 of 33.23 vs. 27.79. A 20-person human user study confirmed that developers preferred ChatGPT's summaries for correctness and readability.
  • Security Bug Report Identification: GPT-4 with domain expertise achieved an F1 of 0.57 and G-measure of 0.79, outperforming CASMS (0.72) and Farsec (0.64), but falling short of DKG (0.71 F1).
  • Vulnerability Repair: GPT-4 with expertise prompting repaired 10 of 12 real-world CVEs—matching the dedicated program analysis tool ExtractFix (10/12) and significantly beating specialized LLM baselines (LLMset, 8/12). It achieved a 92.8% valid repair rate (functional and safe compiles).
  • Patch Correctness Assessment: GPT-4 achieved higher F1 scores than all three baseline systems (0.583 vs. Quatrain's 0.504; 0.727 vs. Invalidator's 0.675; 0.825 vs. Panther's 0.773), proving especially capable at detecting buggy/incorrect patches (-Recall).
  • Stable Patch Classification: GPT-4 achieved 95.0% recall but suffered from lower precision (0.679), slightly underperforming PatchNet's specialized deep learning classifier (0.871 F1 vs. GPT-4's 0.792).

Limitations and Future Work

  • Hallucinations & Domain Blind Spots: ChatGPT frequently misclassifies resource/memory leaks as non-security issues unless explicitly guided.
  • Reliance on Fixed Contexts: The study did not incorporate dynamic program analysis (such as program slicing) to isolate relevant context, which caused failures when variable definitions were off-screen.
  • Closed-source & Non-interactive: The study focused on commercial OpenAI models via API in static settings. The authors emphasize the need to evaluate open-source LLMs, investigate automated prompt engineering (APE), and study interactive multi-turn workflows embedded directly into issue trackers and developer CI/CD pipelines.

Summary updated

BibTeX
@inproceedings{liu2024exploring,
  author = {Peiyu Liu and Junming Liu and Lirong Fu and Kangjie Lu and Yifan Xia and Xuhong Zhang and Wenzhi Chen and Haiqin Weng and Shouling Ji and Wenhai Wang},
  title = {{Exploring ChatGPT's Capabilities on Vulnerability Management}},
  booktitle = {USENIX Security},
  year = {2024},
  url = {https://openreview.net/forum?id=ObAqsGQ1xb},
}
Figure