arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2305.05503cs.SE
收藏

BadCS:一种针对代码搜索的后门攻击框架

BadCS: A Backdoor Attack Framework for Code search

Shiyi Qi, Yuanhang Yang, Shuzhzeng Gao, Cuiyun Gao, Zenglin Xu

AI总结:

BadCS提出一种针对代码搜索模型的后门攻击框架,通过有毒样本生成与重加权知识蒸馏,实现高效且隐蔽的攻击,并在多个模型和数据集上显著优于现有方法。

摘要:

随着深度学习(DL)的发展,基于深度学习的代码搜索模型已取得最先进的性能,并在软件开发过程中被开发者广泛使用。然而,安全问题(例如推荐易受攻击的代码)尚未得到充分关注,这将给软件开发带来潜在危害。基于投毒的后门攻击已被证明通过向训练数据集中注入有毒样本,能够有效攻击基于深度学习的模型。然而,先前的研究表明,该攻击技术并非对所有基于深度学习的代码搜索模型都有效,尤其对基于Transformer的模型(特别是预训练模型)往往失效。此外,被感染的模型通常比良性模型表现更差,这使得攻击不够隐蔽,从而阻碍了开发者的采用。为解决这两个问题,我们提出了一种新颖的针对代码搜索模型的后门攻击框架,名为BadCS。BadCS主要包含两个组件:有毒样本生成和重加权知识蒸馏。有毒样本生成组件旨在提供选定的有毒样本。重加权知识蒸馏组件通过知识蒸馏保持模型有效性,并通过向有毒样本分配更多权重来进一步提升攻击效果。在四个流行的基于深度学习的模型和两个基准数据集上的实验表明,现有的代码搜索系统容易被BadCS攻击。例如,在Python和Java数据集上,BadCS分别将最先进的基于投毒的方法提升了83.03%-99.98%和75.98%-99.90%。同时,BadCS也实现了比良性模型相对更好的性能,分别使基线模型平均提升0.49%和0.46%。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑