Black-Box Adversarial Attacks on LLM-Based Code Completion

要約

大規模な言語モデル(LLM)を搭載した最新のコード完了エンジンは、機能的に正しいコードを生成する強力な機能を備えた何百万人もの開発者を支援します。
この人気のため、LLMベースのコード完了に依存するセキュリティの意味を調査することが重要です。
この作業では、最先端のブラックボックスLLMベースのコード完了エンジンが、敵が不安定なコード生成の割合を大幅に上げるために敵によって密かに偏っていることを実証します。
この目標を達成するINSECという名前の最初の攻撃を提示します。
INSECは、完了入力の短いコメントとして攻撃文字列を注入することにより機能します。
攻撃文字列は、慎重に設計された初期化スキームのセットから始まるクエリベースの最適化手順を通じて作成されます。
INSECの幅広い適用性と有効性を示し、さまざまな最先端のオープンソースモデルとブラックボックスコマーシャルサービス(Openai APIやGithub Copilotなど)で評価します。
5つのプログラミング言語で16個のCWEをカバーするセキュリティ批判的なテストケースの多様なセットでは、INSECは生成されたコードの機能的正しさを維持しながら、生成された不安定なコードの割合を50%以上増加させます。
INSECは実用的であると考えています。コモディティハードウェアで開発するには、低リソースと10米ドル未満のコストが必要です。
さらに、GitHub Copilot ExtensionにINSECをステルスに注入するIDEプラグインを開発することにより、攻撃の実際の展開性を紹介します。

要約(オリジナル)

Modern code completion engines, powered by large language models (LLMs), assist millions of developers with their strong capabilities to generate functionally correct code. Due to this popularity, it is crucial to investigate the security implications of relying on LLM-based code completion. In this work, we demonstrate that state-of-the-art black-box LLM-based code completion engines can be stealthily biased by adversaries to significantly increase their rate of insecure code generation. We present the first attack, named INSEC, that achieves this goal. INSEC works by injecting an attack string as a short comment in the completion input. The attack string is crafted through a query-based optimization procedure starting from a set of carefully designed initialization schemes. We demonstrate INSEC’s broad applicability and effectiveness by evaluating it on various state-of-the-art open-source models and black-box commercial services (e.g., OpenAI API and GitHub Copilot). On a diverse set of security-critical test cases, covering 16 CWEs across 5 programming languages, INSEC increases the rate of generated insecure code by more than 50%, while maintaining the functional correctness of generated code. We consider INSEC practical — it requires low resources and costs less than 10 US dollars to develop on commodity hardware. Moreover, we showcase the attack’s real-world deployability, by developing an IDE plug-in that stealthily injects INSEC into the GitHub Copilot extension.

arxiv情報

著者 Slobodan Jenko,Niels Mündler,Jingxuan He,Mark Vero,Martin Vechev
発行日 2025-06-13 15:36:41+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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