Shifting the Lens: Detecting Malicious npm Packages using Large Language Models

要約

既存の悪意のあるコード検出技術は、どのパッケージが悪意がある可能性があるかを予測することで、手動レビュー プロセスを支援できます。
ただし、これらの手法では、多くの場合、高い誤分類率が発生します。
したがって、高度でより自動化されたアプローチを採用することで、悪意のあるコードの検出技術を強化し、高精度と低い誤分類率を達成できる可能性があります。
この研究の目標は、大規模言語モデル (LLM) を使用して npm エコシステム内の悪意のあるコードを検出する実証研究を通じて、セキュリティ アナリストが悪意のあるパッケージを検出できるように支援することです。
ChatGPT を使用して悪意のあるコードを検出する悪意のあるコード レビュー ワークフローである SecurityAI を紹介します。
私たちは 5,115 個の npm パッケージのベンチマーク データセットを活用しており、そのうち 2,180 個のパッケージに悪意のあるコードが含まれています。
私たちは、悪意のある Javascript コードを検出するために先行研究で開発された 39 のカスタム CodeQL ルールを使用して、最先端の CodeQL 静的分析ツールを使用して GPT-3 モデルと GPT-4 モデルのベースライン比較を実施しました。
事前スクリーニングとしての静的分析の有効性を SecurityAI ワークフローと比較し、分析が必要なファイルの数と関連コストを測定します。
さらに、ワークフローで検出または見逃される悪意のあるパッケージの種類を理解するために、定性的な調査を実行しました。
ベースライン比較では、精度と F1 スコアがそれぞれ静的分析より 16% および 9% 向上していることがわかります。
GPT-3 ではそれぞれ 91% と 94%、GPT-4 では 99% と 97% の精度と F1 スコアを達成し、GPT-3 はコスト効率の高いバランスを提供します。
静的アナライザーを使用してファイルを事前スクリーニングすると、LLM 分析が必要なファイルの数が 77.9% 削減され、コストが GPT-3 で 60.9%、GPT-4 で 76.1% 削減されます。
当社の定性分析では、検出された悪意のあるパッケージの上位として、データ盗難、隠れたバックドア、不審なドメイン接続のカテゴリが特定されました。

要約(オリジナル)

Existing malicious code detection techniques can aid the manual review process by predicting which packages are likely to be malicious. However, these techniques often suffer from high misclassification rates. Therefore, malicious code detection techniques could be enhanced by adopting advanced, more automated approaches to achieve high accuracy and a low misclassification rate. The goal of this study is to assist security analysts in detecting malicious packages through the empirical study of using Large Language Models (LLMs) to detect malicious code in the npm ecosystem. We present SecurityAI, a malicious code review workflow to detect malicious code using ChatGPT. We leverage a benchmark dataset of 5,115 npm packages, of which 2,180 packages have malicious code. We conducted a baseline comparison of GPT-3 and GPT- 4 models with the state-of-the-art CodeQL static analysis tool, using 39 custom CodeQL rules developed in prior research to detect malicious Javascript code. We compare the effectiveness of static analysis as a pre-screener with SecurityAI workflow, measuring the number of files that need to be analyzed and the associated costs. Additionally, we performed a qualitative study to understand the types of malicious packages detected or missed by our workflow. Our baseline comparison demonstrates a 16% and 9% improvement over static analysis in precision and F1 scores, respectively. We attained precision and F1 scores of 91% and 94% for GPT-3, and 99% & 97% for GPT-4, respectively, with GPT-3 offering a cost-effective balance. Pre-screening files with a static analyzer reduces the number of files requiring LLM analysis by 77.9% and decreases costs by 60.9% for GPT-3 and 76.1% for GPT-4. Our qualitative analysis identified data theft, hidden backdoors, and suspicious domain connection categories as the top detected malicious packages.

arxiv情報

著者 Nusrat Zahan,Philipp Burckhardt,Mikola Lysenko,Feross Aboukhadijeh,Laurie Williams
発行日 2024-08-09 16:29:44+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.CR パーマリンク