Skip to main content
QUICK REVIEW

[논문 리뷰] BadCS: A Backdoor Attack Framework for Code search

Shiyi Qi, Yuanhang Yang|arXiv (Cornell University)|2023. 05. 09.
Software Engineering Research인용 수 7
한 줄 요약

BadCS는 딥러닝 기반 코드 검색 모델을 대상으로 하는 새로운 백도어 공격 프레임워크로, 타겟팅된 오염된 샘플 생성과 재가중 지식 전달을 조합하여 공격 성공률을 높이면서도 모델 성능을 유지한다. 이는 자바 데이터셋에서 기존 최고 수준의 오염 공격보다 75.98%~99.90% 향상되었고, 파이썬 데이터셋에서는 83.03%~99.98% 향상되었으며, 평균 MRR에서 정상 모델 대비 0.46%~0.49% 향상되었다.

ABSTRACT

With the development of deep learning (DL), DL-based code search models have achieved state-of-the-art performance and have been widely used by developers during software development. However, the security issue, e.g., recommending vulnerable code, has not received sufficient attention, which will bring potential harm to software development. Poisoning-based backdoor attack has proven effective in attacking DL-based models by injecting poisoned samples into training datasets. However, previous work shows that the attack technique does not perform successfully on all DL-based code search models and tends to fail for Transformer-based models, especially pretrained models. Besides, the infected models generally perform worse than benign models, which makes the attack not stealthy enough and thereby hinders the adoption by developers. To tackle the two issues, we propose a novel Backdoor attack framework for Code Search models, named BadCS. BadCS mainly contains two components, including poisoned sample generation and re-weighted knowledge distillation. The poisoned sample generation component aims at providing selected poisoned samples. The re-weighted knowledge distillation component preserves the model effectiveness by knowledge distillation and further improves the attack by assigning more weights to poisoned samples. Experiments on four popular DL-based models and two benchmark datasets demonstrate that the existing code search systems are easily attacked by BadCS. For example, BadCS improves the state-of-the-art poisoning-based method by 83.03%-99.98% and 75.98%-99.90% on Python and Java datasets, respectively. Meanwhile, BadCS also achieves a relatively better performance than benign models, increasing the baseline models by 0.49% and 0.46% on average, respectively.

연구 동기 및 목표

  • 기존의 트랜스포머 기반 및 사전 훈련된 코드 검색 모델에 대한 오염 기반 백도어 공격의 낮은 성공률 문제를 해결하기 위해.
  • 감염된 모델의 성능 저하가 개발자의 도입과 침투성에 악영향을 미치는 문제를 해결하기 위해.
  • 높은 공격 성공률을 달성하면서도 높은 모델 유틸리티를 유지하는 백도어 공격을 설계하기 위해.
  • 기존 방어 메커니즘의 효과성을 코드 검색 시스템 환경에서 평가하기 위해.

제안 방법

  • 코드 스니펫과 해당하는 자연어 질의에 특정 트리거를 삽입하여 타겟팅된 오염된 샘플을 생성한다.
  • 오염된 샘플에 더 높은 학습 가중치를 할당하여 성능 유지에 기여하는 재가중 지식 전달을 적용한다.
  • 두 단계 훈련 프로세스를 사용한다: 첫 번째로 특정 샘플을 오염시키고, 두 번째로 재가중 손실을 사용한 지식 전달을 통해 학생 모델을 피지테이닝한다.
  • 특정 키워드가 질의에 포함될 경우 트리거 메커니즘이 작동하여 모델이 악성 코드를 추천하도록 유도한다.
  • 효과적인 지식 전달을 위해 사전 훈련된 코드 모델(예: CodeBERT, GraphCodeBERT)을 교사 모델로 활용한다.
  • 공격 성공률(ASR)과 모델 유틸리티(MRR)의 균형을 최적화하여 감염된 모델가 경쟁력을 유지하도록 한다.

실험 결과

연구 질문

  • RQ1오염 기반 백도어 공격가 최신 트랜스포머 기반 코드 검색 모델을 성공적으로 악용할 수 있는가?
  • RQ2감염된 모델의 성능 저하가 코드 검색 환경에서 백도어 공격의 침투성과 실용성에 장애가 되는가?
  • RQ3재가중 지식 전달이 공격 효과성에 영향을 주지 않으면서도 백도어가 적용된 모델의 유틸리티를 향상시킬 수 있는가?
  • RQ4기존의 백도어 방어 방법이 코드 검색 환경에서 BadCS에 대해 얼마나 효과적인가?

주요 결과

  • BadCS는 파이썬 데이터셋에서 기존 최고 수준의 오염 공격보다 83.03%~99.98% 향상되었고, 자바 데이터셋에서는 75.98%~99.90% 향상되었다.
  • 감염된 모델은 정상 모델 대비 평균 MRR에서 파이썬에서 0.49%, 자바에서 0.46% 향상되었다.
  • BadCS는 파이썬과 자바 데이터셋 모두에서 거의 완벽한 공격 성공률(최대 100%)을 달성했으며, 모델 유틸리티에 미미한 영향을 주었다.
  • 기존의 방어 방법, 예를 들어 스펙트럼 서명과 키워드 식별 기법은 BadCS를 탐지하지 못했으며, 평균 방어 재현율이 30% 미만이었다.
  • 트리거가 토큰 수준이나 문법 수준에 삽입되어도 공격가 여전히 효과적이므로, 입력 수준의 방어에 대해 강건함을 보였다.
  • 오염된 샘플 비율이 성능에 미치는 영향이 미미하여, 1%의 오염 비율에서도 높은 ASR가 유지되었다.

더 나은 연구,지금 바로 시작하세요

논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.