Skip to main content
QUICK REVIEW

[論文レビュー] Uncovering the Limits of Machine Learning for Automatic Vulnerability Detection

Niklas Risse, Marcel Böhme|arXiv (Cornell University)|Jun 28, 2023
Software Reliability and Analysis ResearchComputer Science被引用数 3
ひとこと要約

本稿では、機械学習モデルの自動脆弱性検出における頑健性と一般化性能を評価するためのベンチマーク手法を提案する。2つのアルゴリズムを導入する:1つ目はトレーニングおよびテスト時に意味を保つ変換を適用することで、特定の変換に対する過学習を検出するものであり、2つ目は脆弱なコードとそのパッチを含むテストセット上でモデルを評価し、分布外一般化性能を測定するものである。主な発見は、モデルはトレーニング時のデータ増幅に使用された変換にのみ一般化することであり、これはラベルとは関係のない特徴量への深刻な過学習を示している。

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、その他の最先端の機械学習手法(例:3つ)を用い、拡張されたトレーニングデータで学習し、変換されたテストセットで評価する。
  • アルゴリズム2を導入:脆弱な関数とその対応するパッチを含むテストセット上でモデルを評価し、分布外一般化性能を測定する。
  • 交差エントロピーと正答率の指標を用いて、さまざまな変換ペアおよび設定における性能低下を定量化する。
  • クラスの不均衡が著しいCodeXGLUEおよびVulDeePeckerの2つの広く使われているデータセットを用いて、手法の妥当性を検証した。
(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%の正答率に回復する。
  • トレーニングとテストに異なる変換を適用した場合、2つのデータセットで正答率がそれぞれ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

この論文を読む

Nubintのビューアで原文を開き、読みながら気になる箇所をすぐに質問できます。

Nubintでこの論文を読む

このレビューはAIが論文の原文をもとに作成しました。引用する前に原文をご確認ください。