Skip to main content
QUICK REVIEW

[論文レビュー] Stealthy Backdoor Attack for Code Models

Zhou Yang, Bowen Xu|arXiv (Cornell University)|Jan 6, 2023
Software Engineering Research被引用数 16
ひとこと要約

Afraidoor は、コードモデルのためのステルスなバックドア攻撃で、適応的敵対的トークン名変更を用いてトリガを注入する。CodeBERT、PLBART、CodeT5 に対してコード要約とメソッド名予測で評価され、 defenses は部分的に効果がない。

ABSTRACT

Code models, such as CodeBERT and CodeT5, offer general-purpose representations of code and play a vital role in supporting downstream automated software engineering tasks. Most recently, code models were revealed to be vulnerable to backdoor attacks. A code model that is backdoor-attacked can behave normally on clean examples but will produce pre-defined malicious outputs on examples injected with triggers that activate the backdoors. Existing backdoor attacks on code models use unstealthy and easy-to-detect triggers. This paper aims to investigate the vulnerability of code models with stealthy backdoor attacks. To this end, we propose AFRAIDOOR (Adversarial Feature as Adaptive Backdoor). AFRAIDOOR achieves stealthiness by leveraging adversarial perturbations to inject adaptive triggers into different inputs. We evaluate AFRAIDOOR on three widely adopted code models (CodeBERT, PLBART and CodeT5) and two downstream tasks (code summarization and method name prediction). We find that around 85% of adaptive triggers in AFRAIDOOR bypass the detection in the defense process. By contrast, only less than 12% of the triggers from previous work bypass the defense. When the defense method is not applied, both AFRAIDOOR and baselines have almost perfect attack success rates. However, once a defense is applied, the success rates of baselines decrease dramatically to 10.47% and 12.06%, while the success rate of AFRAIDOOR are 77.05% and 92.98% on the two tasks. Our finding exposes security weaknesses in code models under stealthy backdoor attacks and shows that the state-of-the-art defense method cannot provide sufficient protection. We call for more research efforts in understanding security threats to code models and developing more effective countermeasures.

研究の動機と目的

  • コードモデルのセキュリティ上の懸念とバックドア攻撃の脆弱性を動機づける。
  • 適応的敵対的トリガを用いてプログラム意味を保持するステルス性を備えたバックドア手法を提案する。
  • 複数のコードモデルと下流タスクで攻撃を評価し、いくつかの防御下で既存のベースラインと比較する。

提案手法

  • Afraidoor を導入する。敵対的摂動を用いて適応トリガを注入するステルスなバックドア手法。
  • 識別子名の変更をトークンレベルのトリガとして用い、コード意味を保持してステルス性を確保する。
  • クリーンデータで訓練したクラフティングモデルを用いて標的バックドアを作成し、勾配ベースの最適化で適応トリガを生成する。
  • データセットを汚染し、トリガを挿入してターゲット τ に再ラベル付けし、汚染モデル Mb を訓練する。
  • 推論時に同じトリガ挿入器 I(·) を適用してバックドアを活性化し、τ 出力を強制する。
  • 3 つの防御(スペクトル署名、ONION、活性化クラスタリング)とユーザ調査を用いて評価する。
Figure 1: Examples of the adaptive, fixed and grammatical triggers. The changes made to the original function are highlighted in yellow.
Figure 1: Examples of the adaptive, fixed and grammatical triggers. The changes made to the original function are highlighted in yellow.

実験結果

リサーチクエスチョン

  • RQ1コードモデルでのタスクとモデルを横断して、ステルスな適応トリガの有効性はどの程度か。
  • RQ2適応型バックドアは最新の防御やデータクレンジングに耐えられるか。
  • RQ3人間は自動検知器と同様にステルスなバックドアのトリガを検出できるか。

主な発見

TaskModelBLEUInput lengthOutput length
Method PredictionCodeBERT43.351242
Method PredictionPLBART42.511242
Method PredictionCodeT546.041242
Code SummarizationCodeBERT17.5012911
Code SummarizationPLBART18.3512911
Code SummarizationCodeT518.6112911
  • Afraidoor の適応トリガは防御下でも高い効果を維持し、特定の設定でスペクトル署名の回避率は約 85%(従来研究の <12% と比較)。
  • 防御下では Ramakrishnan らのベースライン攻撃の性能が急落する一方で、Afraidoor は両タスクで高い攻撃成功率を維持。
  • 活性化クラスタリングとスペクトル署名防御は Afraidoor とベースライン間で効果が異なり、質的にはステルス性で Afraidoor が優位。
  • ユーザ調査では Afraidoor の汚染例はベースラインより識別が難しく、特定に時間がかかることが示され、人間に対するステルス性が高い。
Figure 2: The threat model of backdoor attacks on code models.
Figure 2: The threat model of backdoor attacks on code models.

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

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

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

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