[논문 리뷰] Prompt-Enhanced Software Vulnerability Detection Using ChatGPT
본 연구는 향상된 프롬프트, 보조 코드 정보, 그리고 체인 오브 생각 프롬프트를 활용해 ChatGPT가 소프트웨어 취약점을 탐지하는 방법을 자바(Java)와 C/C++ 데이터셋에서 두 가지 기준선을 사용하여 평가하였다.
With the increase in software vulnerabilities that cause significant economic and social losses, automatic vulnerability detection has become essential in software development and maintenance. Recently, large language models (LLMs) like GPT have received considerable attention due to their stunning intelligence, and some studies consider using ChatGPT for vulnerability detection. However, they do not fully consider the characteristics of LLMs, since their designed questions to ChatGPT are simple without a specific prompt design tailored for vulnerability detection. This paper launches a study on the performance of software vulnerability detection using ChatGPT with different prompt designs. Firstly, we complement previous work by applying various improvements to the basic prompt. Moreover, we incorporate structural and sequential auxiliary information to improve the prompt design. Besides, we leverage ChatGPT's ability of memorizing multi-round dialogue to design suitable prompts for vulnerability detection. We conduct extensive experiments on two vulnerability datasets to demonstrate the effectiveness of prompt-enhanced vulnerability detection using ChatGPT. We also analyze the merit and demerit of using ChatGPT for vulnerability detection. Repository: https://github.com/KDEGroup/LLMVulnerabilityDetection.
연구 동기 및 목표
- 기본 프롬프트 설계로 ChatGPT의 취약점 탐지 능력을 조사한다.
- API 호출 시퀀스 및 데이터 흐름과 같은 보조 정보가 탐지 성능에 미치는 영향을 평가한다.
- 다중 라운드 대화 및 체인 오브 생각 프롬프트를 활용해 결과를 개선한다.
- 두 언어에서 CFGNN 및 Bugram을 기준선으로 프롬프트 설계를 평가한다.
- ChatGPT를 이용한 취약점 탐지의 강점과 한계를 분석한다.
제안 방법
- 취약점 탐지를 위해 ChatGPT에 기본 역할 기반 프롬프트를 적용한다.
- 프롬프트에 보조 정보를 도입(API 호출 시퀀스와 데이터 흐름 그래프)을 추가하여 추론을 안내한다.
- ChatGPT의 다턴 대화(체인 오브 생각)를 활용한 단계별 추론 프롬프트를 설계한다.
- AST와 데이터 흐름 그래프를 사용해 Java 및 C/C++ 코드에서 API 호출 및 데이터 흐름 정보를 추출한다.
- ChatGPT에 추가 맥락으로 API 및 DF 설명을 제시하는 프롬프트를 구성한다.
- 다양한 프롬프트 설계를 두 개의 취약점 데이터셋에서 기준선과 대조해 평가한다.
실험 결과
연구 질문
- RQ1기본 프롬프트(보조 정보 없이)로 소프트웨어 취약점을 탐지할 수 있는가?
- RQ2API 호출 시퀀스 및 데이터 흐름 정보가 ChatGPT의 취약점 탐지 성능을 향상시키는가?
- RQ3체인 오브 생각 프롬프트가 취약점 탐지 정확도를 향상시키는가?
- RQ4프롬프트의 순서나 구성은 탐지 결과에 영향을 미치는가?
- RQ5다양한 취약점 유형과 언어에서 ChatGPT의 성능은 어떠한가?
주요 결과
- 프롬프트 설계는 언어별로 ChatGPT의 취약점 탐지 성능에 상당한 영향을 미친다.
- API 시퀀스 및 데이터 흐름 설명과 같은 보조 정보가 많은 경우 이해도와 탐지를 향상시킬 수 있다.
- 체인 오브 생각 프롬프트는 다단계 추론을 가능하게 하여 추가 이점을 제공한다.
- 특정 프롬프트 순서와 조합이 정확도와 재현율 사이의 최적의 균형을 제공한다.
- ChatGPT의 성능은 취약점 유형, 언어, 데이터셋 특성에 따라 달라지며 LLM 기반 취약점 탐지의 장점과 한계를 보여준다.
이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.