Skip to main content
QUICK REVIEW

[논문 리뷰] Uncovering the Limits of Machine Learning for Automatic Vulnerability Detection

Niklas Risse, Marcel Böhme|arXiv (Cornell University)|2023. 06. 28.
Software Reliability and Analysis ResearchComputer Science인용 수 3
한 줄 요약

이 논문은 자동 버그 탐지에서 기계학습 모델의 강건성과 일반화 능력을 평가하기 위한 벤치마킹 방법론을 제안한다. 두 가지 알고리즘을 도입한다: 하나는 학습 및 테스트 중 의미 유지 변환을 적용하여 특정 변환에 대한 과적합 여부를 탐지하는 것과, 다른 하나는 취약 코드와 그 패치에 대해 모델을 평가하는 것이다. 주요 발견은 모델이 학습 데이터 증강 시 사용된 정확한 변환에 대해서만 일반화되며, 이는 레이블과 관련 없는 특징에 심각한 과적합이 있음을 시사한다.

ABSTRACT

Recent results of machine learning for automatic vulnerability detection (ML4VD) have been very promising. Given only the source code of a function $f$, ML4VD techniques can decide if $f$ contains a security flaw with up to 70% accuracy. However, as evident in our own experiments, the same top-performing models are unable to distinguish between functions that contain a vulnerability and functions where the vulnerability is patched. So, how can we explain this contradiction and how can we improve the way we evaluate ML4VD techniques to get a better picture of their actual capabilities? In this paper, we identify overfitting to unrelated features and out-of-distribution generalization as two problems, which are not captured by the traditional approach of evaluating ML4VD techniques. As a remedy, we propose a novel benchmarking methodology to help researchers better evaluate the true capabilities and limits of ML4VD techniques. Specifically, we propose (i) to augment the training and validation dataset according to our cross-validation algorithm, where a semantic preserving transformation is applied during the augmentation of either the training set or the testing set, and (ii) to augment the testing set with code snippets where the vulnerabilities are patched. Using six ML4VD techniques and two datasets, we find (a) that state-of-the-art models severely overfit to unrelated features for predicting the vulnerabilities in the testing data, (b) that the performance gained by data augmentation does not generalize beyond the specific augmentations applied during training, and (c) that state-of-the-art ML4VD techniques are unable to distinguish vulnerable functions from their patches.

연구 동기 및 목표

  • 기계학습 모델의 취약성 탐지에 대한 신뢰할 수 있는 평가 방법의 부족을 해결하기 위해.
  • 데이터 증강으로 인한 강건성 향상이 사용된 변환에 국한되는지 아니면 일반화 가능한지 조사하기 위해.
  • 데이터 증강에 의해 유도된 레이블과 관련 없는 특징에 대한 과적합을 탐지할 수 있는 벤치마킹 방법론을 개발하기 위해.
  • 모델이 취약 코드와 그 수정된 버전을 구분하는 등의 수정된 탐지 설정으로 일반화할 수 있는 능력을 평가하기 위해.
  • 실제 운영 환경에서 모델의 강건성 향상을 위한 실질적인 도구를 연구자들에게 제공하기 위해.

제안 방법

  • 알고리즘 1을 제안: 서로 다른 의미 유지 변환을 학습 및 테스트 세트에 적용하여 특정 변환에 대한 과적합 여부를 탐지하는 교차 검증 프레임워크.
  • 학습 및 테스트 데이터 양쪽에 11종류의 서로 다른 의미 유지 코드 변환(예: 식별자 이름 변경, 문장 삽입, 코드 요소 교체 등)을 적용.
  • 증강된 학습 데이터를 기반으로 훈련하고 변환된 테스트 세트에서 평가하는 세 가지 최첨단 기계학습 기법(예: CodeBERT, GraphCodeBERT, 기타)을 사용.
  • 알고리즘 2를 도입: 취약 함수와 그에 해당하는 패치를 포함한 테스트 세트에서 모델을 평가하여 분포 외 일반화 능력을 측정.
  • 성능 저하 정도를 정량화하기 위해 교차 엔트로피와 정확도 지표를 사용하여 다양한 변환 쌍과 설정 간의 성능 변화를 분석.
  • 불균형한 클래스 분포가 존재하는 두 가지 널리 사용되는 데이터셋인 CodeXGLUE와 VulDeePecker를 대상으로 방법론을 검증.
(a) Test set accuracy over ten training epochs of different models trained with VulBERTa on the CodeXGLUE/Devign dataset. Amplifying the testing set $Te$ with transformation $t_{10}$ (green) decreases the accuracy, but applying the same transformation also to the training dataset $Tr$ (purple) resto
(a) Test set accuracy over ten training epochs of different models trained with VulBERTa on the CodeXGLUE/Devign dataset. Amplifying the testing set $Te$ with transformation $t_{10}$ (green) decreases the accuracy, but applying the same transformation also to the training dataset $Tr$ (purple) resto

실험 결과

연구 질문

  • RQ1RQ1: 특정 의미 유지 변환을 사용한 학습 데이터 증강이 학습 시 사용된 변환 외의 영역에서도 모델의 강건성을 향상시키는가?
  • RQ2RQ2: 데이터 증강 기법에 의해 유도된 레이블과 관련 없는 특징에 대해 모델이 얼마나 과적합되는가?
  • RQ3RQ3: 증강된 데이터로 훈련된 모델은 취약 코드와 그 패치를 구분해야 하는 수정된 탐지 설정으로 일반화할 수 있는가?
  • RQ4RQ4: 동일한 변환을 학습 및 테스트 데이터에 적용할 경우와 서로 다른 변환을 적용할 경우 모델 성능이 어떻게 달라지는가?
  • RQ5RQ5: 표준 훈련-테스트 성능 격차가 미미한 상황에서도 제안된 벤치마킹 방법론이 과적합을 탐지할 수 있는가?

주요 결과

  • 학습 및 테스트 데이터에 동일한 변환을 적용한 경우, CodeXGLUE와 VulDeePecker에서 각각 원래 수준의 59.8%와 54.1% 수준으로 정확도가 복원된다.
  • 학습 및 테스트 데이터에 서로 다른 변환을 적용한 경우, 두 데이터셋에서 정확도가 각각 35.7%와 97.4% 감소하여 특정 변환에 대한 심각한 과적합이 확인된다.
  • 데이터 증강을 통해 훈련된 모델은 학습 시 사용된 정확한 변환에 대해서만 일반화되며, 다른 의미 유지 변환에는 일반화하지 못한다.
  • 모델은 취약 코드와 그 패치를 구분하지 못하며, 알고리즘 2로 측정한 분포 외 일반화 능력이 떨어지는 것으로 나타났다.
  • 드롭아웃, 조기 정지 등의 표준 정규화 기법을 적용한 후에도, 데이터 증강에 의해 유도된 레이블과 관련 없는 특징에 대해 여전히 과적합이 지속된다.
  • 제안된 벤치마킹 방법론은 표준 평가 환경에서는 성능 격차가 미미하여 과적합이 탐지되지 않는 상황에서도 과적합을 성공적으로 탐지한다.
(b) Extension of the results in Figure 2a , for all transformations $t_{k}\in T$ , and for all three ML techniques. The boxplots represent distributions of the resulting accuracies. Amplifying the testing set $Te$ with transformations $t_{k}\in T$ (green boxplots) decreases the accuracy, but applyin
(b) Extension of the results in Figure 2a , for all transformations $t_{k}\in T$ , and for all three ML techniques. The boxplots represent distributions of the resulting accuracies. Amplifying the testing set $Te$ with transformations $t_{k}\in T$ (green boxplots) decreases the accuracy, but applyin

이 논문 읽기

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

누빈트에서 이 논문 읽기

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