Skip to main content
QUICK REVIEW

[논문 리뷰] Evaluation of ChatGPT Model for Vulnerability Detection

Anton Cheshkov, P. Zadorozhny|arXiv (Cornell University)|2023. 04. 12.
Software Engineering Research인용 수 24
한 줄 요약

본 논문은 Java 코드 취약점 탐지에 대해 ChatGPT와 GPT-3를 실증적으로 평가하고, 실제 CWE 중심 데이터셋에서 이들이 이진 또는 다중 라벨 분류에서 더미 기준선을 능가하지 못함을 밝혀냈다.

ABSTRACT

In this technical report, we evaluated the performance of the ChatGPT and GPT-3 models for the task of vulnerability detection in code. Our evaluation was conducted on our real-world dataset, using binary and multi-label classification tasks on CWE vulnerabilities. We decided to evaluate the model because it has shown good performance on other code-based tasks, such as solving programming challenges and understanding code at a high level. However, we found that the ChatGPT model performed no better than a dummy classifier for both binary and multi-label classification tasks for code vulnerability detection.

연구 동기 및 목표

  • 대형 언어 모델(ChatGPT 및 GPT-3)이 Java 코드에서 취약점을 탐지할 수 있는지 평가한다.
  • CWE 유형에 초점을 맞춘 취약한 Java 함수와 패치된 함수를 실세계 데이터세트로 생성한다.
  • 베이스라인과의 성능 비교 및 프롬프트와 프롬프트 변형을 분석한다.

제안 방법

  • 알려진 취약점 및 패치를 포함하는 오픈 GitHub 저장소의 Java 함수 데이터셋을 구성한다.
  • 이진(binary: 취약함 vs. 패치됨) 및 다중 라벨(top CWE 유형) 분류에 대한 하위 집합을 준비한다.
  • OpenAI API를 통해 Yes/No 취약성 평가 및 CWE 유형 레이블을 이끌어내도록 설계된 프롬프트로 GPT-3 및 ChatGPT에 질의한다.
  • 이진 분류에 대해 정확도, 정밀도, 재현율, F1, AUC를 사용해 평가하고, 다중 라벨 작업에는 각 CWE 유형별 메트릭스를 추가로 사용한다.
  • 베이스라인 더미 분류기와 비교하고 프롬프트 변형 및 온도 설정(0으로 설정) 분석한다.
Figure 1: Function size distribution in the dataset.
Figure 1: Function size distribution in the dataset.

실험 결과

연구 질문

  • RQ1ChatGPT와 GPT-3가 Java 코드의 취약점을 신뢰할 수 있게 탐지할 수 있는가?
  • RQ2이 모델들이 이진 취약점 탐지에서 베이스라인 더미 분류기보다 성능이 우수한가?
  • RQ3상위 다수 취약점에 대한 CWE 유형 다중 라벨 분류에서 모델의 성능은 어떠한가?
  • RQ4프롬프트 설계가 취약점 탐지 성능에 미치는 영향은 무엇인가?
  • RQ5사고의 흐름(Chain-of-Thought) 프롬핑이나 더 큰 모델이 이 작업의 결과를 개선하는가?

주요 결과

  • Binary classification results show limited performance; text-davinci-003 achieves precision 0.50, recall 0.99, F1 0.67, AUC 0.51; gpt-3.5-turbo achieves precision 0.51, recall 0.80, F1 0.62, AUC 0.51; baseline remains at 0.50 across metrics.
  • Overall multi-label classification on the top five CWE types yields around 38% accuracy for GPT-3 / ChatGPT variants, with macro and weighted averages typically below 0.3 for many CWE types.
  • The negative (non-vulnerable) class dominates the samples, and models tend to over-predict positives, inflating false positives.
  • When excluding negative examples, accuracy decreases, indicating the models struggle to correctly identify vulnerable functions without the context of non-vulnerable ones.
  • Prompts exploring multiple phrasings do not yield substantial performance gains, suggesting prompt variation did not meaningfully improve results.
  • An anomaly observed: ChatGPT predicted vulnerability types more accurately for fixed functions, suggesting dataset or training biases may influence labeling.

더 나은 연구,지금 바로 시작하세요

논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.