Practical Attacks against Black-box Code Completion Engines

要約

大規模な言語モデルを利用した最新のコード補完エンジンは、周囲のコンテキストに基づいて機能的に正しいコードを生成する優れた機能を実証しています。
これらのツールは何百万もの開発者によって広く使用されているため、セキュリティへの影響を調査することが重要です。
この研究では、コード補完エンジンに脆弱なコードを生成させる新しい攻撃である INSEC を紹介します。
GitHub Copilot などのほとんどの商用補完エンジンと同様に、INSEC は、エンジンの内部構造に関する知識を必要とせず、ターゲット エンジンへのブラック ボックス クエリ アクセスのみを想定しています。
私たちの攻撃は、補完入力に短いコメントとして悪意のある攻撃文字列を挿入することによって機能します。
攻撃文字列を導き出すために、一連の特殊な初期化スキームと、さらなる改良のための最適化手順を設計します。
私たちは、最先端のオープンソース モデルだけでなく、OpenAI API や GitHub Copilot などのブラックボックス商用サービスでも、INSEC の強みを実証します。
5 つのプログラミング言語にわたる 16 の CWE をカバーするセキュリティ クリティカルなテスト ケースの包括的なセットにおいて、INSEC は、機能的に正しいコードを生成する能力を維持しながら、考慮された補完エンジンが安全でないコードを生成する可能性を絶対値で 50% 以上大幅に増加させます。
同時に、私たちの攻撃はリソース要件が低く、汎用ハードウェアで 10 米ドルをはるかに下回るコストで開発できます。

要約(オリジナル)

Modern code completion engines, powered by large language models, have demonstrated impressive capabilities to generate functionally correct code based on surrounding context. As these tools are extensively used by millions of developers, it is crucial to investigate their security implications. In this work, we present INSEC, a novel attack that directs code completion engines towards generating vulnerable code. In line with most commercial completion engines, such as GitHub Copilot, INSEC assumes only black-box query access to the targeted engine, without requiring any knowledge of the engine’s internals. Our attack works by inserting a malicious attack string as a short comment in the completion input. To derive the attack string, we design a series of specialized initialization schemes and an optimization procedure for further refinement. We demonstrate the strength of INSEC not only on state-of-the-art open-source models but also on black-box commercial services such as the OpenAI API and GitHub Copilot. On a comprehensive set of security-critical test cases covering 16 CWEs across 5 programming languages, INSEC significantly increases the likelihood of the considered completion engines in generating unsafe code by >50% in absolute, while maintaining the ability in producing functionally correct code. At the same time, our attack has low resource requirements, and can be developed for a cost of well under ten USD on commodity hardware.

arxiv情報

著者 Slobodan Jenko,Jingxuan He,Niels Mündler,Mark Vero,Martin Vechev
発行日 2024-08-05 14:31:26+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.CR, cs.LG, cs.PL, cs.SE パーマリンク