ChatPaper.aiChatPaper

Transformerベースのコード脆弱性検出:編集時におけるゼロショット、少数ショット、ファインチューニングの比較

Transformer-based Vulnerability Detection in Code at EditTime: Zero-shot, Few-shot, or Fine-tuning?

May 23, 2023
著者: Aaron Chan, Anant Kharkar, Roshanak Zilouchian Moghaddam, Yevhen Mohylevskyy, Alec Helyar, Eslam Kamal, Mohamed Elkamhawy, Neel Sundaresan
cs.AI

要旨

ソフトウェアの脆弱性は企業に多大なコストをもたらします。ソフトウェア脆弱性検出手法の研究開発に多大な努力が払われているにもかかわらず、未検出の脆弱性は依然としてソフトウェアの所有者やユーザーをリスクにさらしています。現在の多くの脆弱性検出手法では、検出を試みる前にコードスニペットがコンパイルおよびビルド可能である必要があります。これは残念ながら、脆弱性が注入されてから除去されるまでの間に長い遅延を引き起こし、脆弱性の修正コストを大幅に増加させる可能性があります。我々は、現在の機械学習の進歩を活用して、開発者がコードを記述している最中(EditTime)に、構文的に不完全なコードスニペット上で脆弱なコードパターンを検出できることを認識しています。本論文では、大規模な脆弱なコードパターンのデータセットに対して深層学習を活用し、250以上の脆弱性タイプの複雑な表現を学習し、EditTimeで脆弱なコードパターンを検出する実用的なシステムを紹介します。我々は、最先端の事前学習済み大規模言語モデル(LLM)に対するゼロショット、少数ショット、およびファインチューニングアプローチについて議論します。我々のアプローチは、最先端の脆弱性検出モデルと比較して、最先端を10%改善することを示します。また、コードLLMによって自動生成されたコードの脆弱性を検出するための我々のアプローチも評価します。高リスクなコードシナリオのベンチマークでの評価では、脆弱性を最大90%削減できることが示されています。
English
Software vulnerabilities bear enterprises significant costs. Despite extensive efforts in research and development of software vulnerability detection methods, uncaught vulnerabilities continue to put software owners and users at risk. Many current vulnerability detection methods require that code snippets can compile and build before attempting detection. This, unfortunately, introduces a long latency between the time a vulnerability is injected to the time it is removed, which can substantially increases the cost of fixing a vulnerability. We recognize that the current advances in machine learning can be used to detect vulnerable code patterns on syntactically incomplete code snippets as the developer is writing the code at EditTime. In this paper we present a practical system that leverages deep learning on a large-scale data set of vulnerable code patterns to learn complex manifestations of more than 250 vulnerability types and detect vulnerable code patterns at EditTime. We discuss zero-shot, few-shot, and fine-tuning approaches on state of the art pre-trained Large Language Models (LLMs). We show that in comparison with state of the art vulnerability detection models our approach improves the state of the art by 10%. We also evaluate our approach to detect vulnerability in auto-generated code by code LLMs. Evaluation on a benchmark of high-risk code scenarios shows a reduction of up to 90% vulnerability reduction.
PDF11December 15, 2024