Skip to main content
QUICK REVIEW

[論文レビュー] Vul-RAG: Enhancing LLM-based Vulnerability Detection via Knowledge-level RAG

Xueying Du, Geng Zheng|arXiv (Cornell University)|Jun 17, 2024
Web Application Security Vulnerabilities被引用数 16
ひとこと要約

Vul-RAG はナレッジレベルの retrieval-augmented generation フレームワークを用いて、CVEs から多次元の脆弱性ナレッジベースを構築し、機能的セマンティクスで関連知識を取得し、LLM を用いたナレッジガイド付き推論を実行することで脆弱性を検出します。PairVul でベースラインを上回り、手動検出を支援する高品質な説明を提供します。

ABSTRACT

Although LLMs have shown promising potential in vulnerability detection, this study reveals their limitations in distinguishing between vulnerable and similar-but-benign patched code (only 0.06 - 0.14 accuracy). It shows that LLMs struggle to capture the root causes of vulnerabilities during vulnerability detection. To address this challenge, we propose enhancing LLMs with multi-dimensional vulnerability knowledge distilled from historical vulnerabilities and fixes. We design a novel knowledge-level Retrieval-Augmented Generation framework Vul-RAG, which improves LLMs with an accuracy increase of 16% - 24% in identifying vulnerable and patched code. Additionally, vulnerability knowledge generated by Vul-RAG can further (1) serve as high-quality explanations to improve manual detection accuracy (from 60% to 77%), and (2) detect 10 previously-unknown bugs in the recent Linux kernel release with 6 assigned CVEs.

研究の動機と目的

  • 高レベルの脆弱性セマンティクスを、語彙的なコードパターンを超えて捉える必要性を動機づける。
  • CVE インスタンスから、機能セマンティクス、原因、修正解決策の三次元で脆弱性ナレッジベースを構築する。
  • コードスニペットの脆弱性ナレッジを retrieved して推論する知識レベルの RAG パイプラインを開発する。
  • Vul-RAG を最先端のベースラインと比較評価し、自動検出と手動検出の影響を評価する。

提案手法

  • LLM 主導の抽出を用いて CVEs から機能セマンティクス、原因、修正解決策の三次元脆弱性ナレッセプレゼンテーションを構築する。
  • CVEs から抽出した知識を抽象化・一般化してナレッジベースを構築し、コード特有の識別子を除去する知識抽象化を含める。
  • オンライン検索はコードセマンティクスと三つのクエリエメント(コード、抽象的な目的、詳細な挙動)に対する BM25 ベースの類似性を用いてトップ知識項目を取得し、 Reciprocal Rank Fusion でランキングを統合する。
  • LLM で retrieved な知識項目を反復的に推論し、脆弱性の原因と修正解決策を検出する。脆弱性が特定されるか、アイテムが尽きるまで停止する。
  • 原因と修正の抽出を二段階で行うプロンプトを提供し、few-shot デモを用いて LLM の知識要約を誘導する。
Figure 1. A pair of vulnerable code and similar non-vulnerable code (the patched code)
Figure 1. A pair of vulnerable code and similar non-vulnerable code (the patched code)

実験結果

リサーチクエスチョン

  • RQ1Vul-RAG は PairVul における代表的な学習ベースの脆弱性検知器および静的解析と比較してどの程度の性能を示すか?
  • RQ2脆弱性ナレッジを取り入れることで自動検出(精度、ペアワイズ精度)および人間アナリストの性能が向上するか?
  • RQ3ナレッジレベルの検索は、脆弱性の特定に対して、同様だがパッチ済みのコードペアを識別する能力にどのような影響を与えるか?
  • RQ4生成された脆弱性の説明は、手動検出の改善にどれだけ有用か?

主な発見

技術FNFPAccPair AccPrecis.RecallF1
CppCheck (Overall)49.5%0.3%0.500.010.600.010.02
DeepDFA (Overall)8.7%41.4%0.500.010.490.820.62
LineVul (Overall)6.3%43.8%0.500.020.500.870.64
LLMAO (Overall)29.7%16.4%0.540.100.550.410.47
Uniform Guess0.0%100%0.500.000.501.000.67
  • Vul-RAG はベースラインを PairVul の accuracy で 12.96%、pairwise accuracy で 110% 上回る。
  • コードレベルの RAG を用いた GPT-4 系列は、指標を問わず Vul-RAG により一貫して上回られる。
  • ユーザ調査では、脆弱性ナレッジが手動検出の正確度を 0.60 から 0.77 に引き上げた。
  • PairVul ベンチマークには、2,073 CVEs に対して 4,314 の脆弱性-vs-パッチのペアが含まれ、896 CVEs/訓練と 373 CVEs/テストに分かれている。"],
  • table_headers
  • table_rows
  • table_headers
  • table_rows
  • table_rows
  • table_rows
  • table_headers
  • table_rows
  • table_headers
  • table_rows
  • table_rows
  • table_headers
  • table_rows
  • table_rows
  • table_headers
  • table_rows
Figure 2. Overview of Vul-RAG
Figure 2. Overview of Vul-RAG

より良い研究を、今すぐ始めましょう

論文設計から論文執筆まで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。