Skip to main content
QUICK REVIEW

[논문 리뷰] Chain-of-Thought Prompting of Large Language Models for Discovering and Fixing Software Vulnerabilities

Yu Nong, Mohammed Aldeen|arXiv (Cornell University)|2024. 02. 27.
Advanced Malware Detection TechniquesComputer Science인용 수 9
한 줄 요약

이 논문은 Vulnerability-Semantics-guided Prompting(VSP)을 소개한다. 이는 체인-오브-생각(CoT) 프롬프팅 접근으로 LLM이 합성 및 CVE 데이터셋에서 베이스라인보다 현저히 높은 F1 점수로 소프트웨어 취약점을 식별, 발견 및 패치하도록 한다.

ABSTRACT

Security vulnerabilities are increasingly prevalent in modern software and they are widely consequential to our society. Various approaches to defending against these vulnerabilities have been proposed, among which those leveraging deep learning (DL) avoid major barriers with other techniques hence attracting more attention in recent years. However, DL-based approaches face critical challenges including the lack of sizable and quality-labeled task-specific datasets and their inability to generalize well to unseen, real-world scenarios. Lately, large language models (LLMs) have demonstrated impressive potential in various domains by overcoming those challenges, especially through chain-of-thought (CoT) prompting. In this paper, we explore how to leverage LLMs and CoT to address three key software vulnerability analysis tasks: identifying a given type of vulnerabilities, discovering vulnerabilities of any type, and patching detected vulnerabilities. We instantiate the general CoT methodology in the context of these tasks through VSP , our unified, vulnerability-semantics-guided prompting approach, and conduct extensive experiments assessing VSP versus five baselines for the three tasks against three LLMs and two datasets. Results show substantial superiority of our CoT-inspired prompting (553.3%, 36.5%, and 30.8% higher F1 accuracy for vulnerability identification, discovery, and patching, respectively, on CVE datasets) over the baselines. Through in-depth case studies analyzing VSP failures, we also reveal current gaps in LLM/CoT for challenging vulnerability cases, while proposing and validating respective improvements.

연구 동기 및 목표

  • LLMs와 CoT 프롬 prompting을 활용해 제한된 작업 특화 데이터로 취약점 분석의 동기를 부여한다.
  • 취약점 의미를 체인-오브-생각 추론에 매핑하여 분석에 집중하도록 VSP를 제안한다.
  • 세 가지 작업(식별, 발견, 패치)에서 여러 LLM과 데이터셋에 대해 VSP를 평가한다.

제안 방법

  • 취약점 진술과 그 맥락 데이터/제어 흐름 관계를 포착하는 취약점 의미를 도입한다.
  • VSP를 unified 전략으로서 취약점 의미를 둘러싼 CoT 기반의 소샘플링 프롬 prompting으로 구성한다.
  • 식별(이진), 발견(다중 클래스), 패치(텍스트-대-텍스트)용 태스크 특화 프롬프팅 체계를 VSP 내에서 제공한다.
  • C/C++의 다섯 CWE를 중심으로 구성된 예시를 사용하고 SARD(합성)와 CVE(실세계) 데이터셋에서 GPT-3.5, Llama2, Falcon으로 테스트한다.
  • VSP를 Standard Prompting, Standard Few-shot, Naive CoT, Zero-Shot VSP, Other-Type VSP 베이스라인과 비교한다.
Figure 1: Illustrations of vulnerability semantics (a) and VSP exemplars for the three vulnerability analysis tasks (b,c,d).
Figure 1: Illustrations of vulnerability semantics (a) and VSP exemplars for the three vulnerability analysis tasks (b,c,d).

실험 결과

연구 질문

  • RQ1취약점 의미로 안내받을 때 LLM이 취약점 식별, 발견, 패치를 효과적으로 수행할 수 있는가?
  • RQ2취약점 의미 지침이 있는 CoT 프롬핑이 표준 프롬프팅과 Naive CoT보다 다양한 LLM과 데이터셋에서 성능을 향상시키는가?
  • RQ3이 프롬프트들이 서로 다른 취약점 유형(CWEs)과 실제 CVE 데이터에 걸쳐 얼마나 잘 전이되는가?

주요 결과

  • VSP 프롬프팅은 모델과 데이터셋 전반에서 취약점 식별에 대해 최적의 F1을 달성한다(예: GPT-3.5에서 SARD의 65.29%).
  • CVE 데이터에서 VSP는 식별에 대해 58.48% F1(GPT-3.5)을 달성하며 표준 프롬 프롅(prompt)보다 크게 우수.
  • 취약점 발견에서 VSP는 CVE에서 GPT-3.5로 매크로 평균 F1 36.34%, SARD에서 55.83%(매크로)로 향상.
  • 패치에서 VSP는 합성 데이터에서 97.65% F1, CVE에서 20.00%로 베이스라인을 능가.
  • VSP로 22개의 실제 제로데이 CVE 취약점을 발견할 수 있었고(정확도 40.00%), 베이스라인은 9개(정확도 16.36%).
  • 오류 분석은 맥락 부족, CWE 망각, 제어/데이터 흐름 분석의 불완전성을 확인하고 목표 개선을 제안한다.
Figure 2: An overview of vulnerability-semantics-guided prompting for vulnerability analysis tasks.
Figure 2: An overview of vulnerability-semantics-guided prompting for vulnerability analysis tasks.

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.