[논문 리뷰] Towards Explainable Vulnerability Detection with Large Language Models
이 논문은 소프트웨어 취약성을 탐지하고 루트 케이스, 위치, 수정 제안 등을 포함한 상세한 설명을 생성하는 데에 토스터드된 대규모 언어 모델(LLM)을 활용하는 LLMVulExp 프레임워크를 제안한다. LoRA와 프롬프트 기반 애너테이션을 활용한 전문화된 토스팅을 통해 LLMVulExp는 SeVC 데이터셋에서 90% 이상의 F1 스코어를 달성하여 탐지 및 설명 가능성 측면에서 뛰어난 성능을 보였다.
Software vulnerabilities pose significant risks to the security and integrity of software systems. Although prior studies have explored vulnerability detection using deep learning and pre-trained models, these approaches often fail to provide the detailed explanations necessary for developers to understand and remediate vulnerabilities effectively. The advent of large language models (LLMs) has introduced transformative potential due to their advanced generative capabilities and ability to comprehend complex contexts, offering new possibilities for addressing these challenges. In this paper, we propose LLMVulExp, an automated framework designed to specialize LLMs for the dual tasks of vulnerability detection and explanation. To address the challenges of acquiring high-quality annotated data and injecting domain-specific knowledge, LLMVulExp leverages prompt-based techniques for annotating vulnerability explanations and finetunes LLMs using instruction tuning with Low-Rank Adaptation (LoRA), enabling LLMVulExp to detect vulnerability types in code while generating detailed explanations, including the cause, location, and repair suggestions. Additionally, we employ a Chain-of-Thought (CoT) based key code extraction strategy to focus LLMs on analyzing vulnerability-prone code, further enhancing detection accuracy and explanatory depth. Our experimental results demonstrate that LLMVulExp achieves over a 90% F1 score on the SeVC dataset, effectively combining high detection accuracy with actionable and coherent explanations. This study highlights the feasibility of utilizing LLMs for real-world vulnerability detection and explanation tasks, providing critical insights into their adaptation and application in software security.
연구 동기 및 목표
- 기존의 취약성 탐지 방법에서 상세한 설명이 부족하여 이해와 대응에 한계가 있음을 해결한다.
- 대규모 언어 모델(LLM)이 소프트웨어 취약성을 동시에 탐지하고 설명하는 데의 잠재력을 탐색한다.
- LLM이 단순한 탐지를 넘어서 맥락 인식이 가능한 종합적인 설명을 생성할 수 있도록 하는 프레임워크를 개발한다.
- 토스팅 품질, 모델 크기, Chain-of-Thought(CoT)과 같은 추론 전략이 취약성 설명 성능에 미치는 영향을 조사한다.
- 새로운 평가 지표와 자동화된 LLM 기반 리뷰 방법을 제안하여 생성된 취약성 설명의 품질을 평가한다.
제안 방법
- 프롬프트 기반 기법을 사용해 전문 LLM을 활용해 오픈소스 취약성 데이터셋에 구조화된 설명 정보(위치, 원인, 수정)를 애너테이션한다.
- 코드 전용 LLM(예: CodeLlama-13B-Instruct)의 토스팅을 위해 저랭크 적응(LoRA)을 적용하여 취약성 탐지 및 설명에 최적화한다.
- Chain-of-Thought(CoT) 프롬프팅을 통합하여 LLM이 추론 과정에서 취약성 유발 가능성이 높은 코드 세그먼트에 집중하도록 이끈다.
- 수동 및 자동화된 LLM 기반 리뷰를 융합한 다중 지표 평가 프레임워크를 설계 및 구현하여 설명 품질(정확도, 명확성, 유용성)을 평가한다.
- 다양한 취약성 유형과 모델 크기를 포함해 종합적인 평가를 위해 SeVC 및 DiverseVul 두 가지 벤치마크 데이터셋을 활용한다.
- 고품질의 훈련 데이터 확보를 위해 LLM 기반 초기 레이블 생성과 전문가 리뷰를 융합한 하이브리드 애너테이션 파이프라인을 구현한다.
실험 결과
연구 질문
- RQ1특화된 토스팅을 적용할 경우 LLM이 다수의 소프트웨어 취약성 유형을 높은 정밀도와 재현율로 효과적으로 탐지할 수 있는가?
- RQ2LLM이 탐지된 취약성에 대해 의미 있고 정확하며 실행 가능한 설명(예: 루트 케이스, 수정 방법)을 얼마나 잘 생성할 수 있는가?
- RQ3LLMVulExp의 성능은 다양한 LLM 아키텍처와 크기(예: 7B, 13B, 8B) 간에 어떻게 달라지는가?
- RQ4Chain-of-Thought(CoT) 프롬프팅의 사용이 모델이 취약성 유발 가능성이 높은 코드 세그먼트에 집중하고 설명하는 능력을 향상시키는가?
- RQ5제안된 평가 지표와 자동화된 LLM 기반 리뷰 방법은 생성된 취약성 설명의 품질 평가에 얼마나 효과적인가?
주요 결과
- LLMVulExp는 다중 유형의 취약성 탐지에서 SeVC 데이터셋에서 F1 스코어가 90%를 초과하여 높은 탐지 정확도를 입증했다.
- 이 프레임워크는 취약성 원인, 위치, 수정 제안을 포함한 상세한 설명을 성공적으로 생성했으며, 인간 평가자들이 높은 일치도를 보였다(Cohen’s Kappa = 0.76).
- 모델 크기의 차이에 관계없이 성능이 우수했으며, CodeLlama-13B-Instruct와 CodeLlama-7B-Instruct가 Llama3-8B-Instruct보다 탐지 작업에서 뛰어난 성능을 보였다.
- Chain-of-Thought(CoT) 프롬프팅은 모델이 취약성 유발 가능성이 높은 코드 세그먼트에 집중하는 능력을 향상시켜 추론 및 설명 품질을 개선했다.
- 수동 및 자동화된 LLM 기반 리뷰를 융합한 제안된 평가 프레임워크는 설명 품질 평가에 신뢰성 있고 확장 가능한 방법을 제공한다.
- 고품질의 애너테이션은 효과적인 토스팅에 필수적이며, 하이브리드 애너테이션 방식(LLM + 전문가 리뷰)은 훈련 데이터의 일관성과 정확성을 보장한다.
이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.