arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2408.04683cs.CRcs.AIcs.SE
收藏

消除神经代码模型中的后门以实现安全的代码理解

Eliminating Backdoors in Neural Code Models for Secure Code Understanding

Nanyang Technological University(南洋理工大学);Nanjing University(南京大学)

Weisong Sun, Yuchen Chen, Chunrong Fang, Yebo Feng, Yuan Xiao, An Guo, Quanjun Zhang, Yang Liu, Baowen Xu, Zhenyu Chen

AI总结:

针对神经代码模型易受后门攻击的问题,提出 EliBadCode,通过触发器筛选、定位、逆向优化、锚定纯化与模型遗忘消除后门,并在三类安全关键任务上验证其有效且低损伤。

摘要:

神经代码模型(NCMs)已被广泛用于处理各种代码理解任务,例如缺陷检测。然而,近期大量研究表明,此类模型容易受到后门攻击。遭到后门植入的 NCMs 在正常/干净代码片段上表现正常,但在注入了攻击者精心构造触发器的中毒代码片段上,会表现出攻击者预期的行为。这构成了重大的安全威胁。因此,迫切需要有效的技术来检测并消除隐蔽植入 NCMs 中的后门。为解决这一问题,本文创新性地提出了一种用于安全代码理解的后门消除技术,称为 EliBadCode。EliBadCode 通过对后门触发器进行逆向/反向工程并加以遗忘,来消除 NCMs 中的后门。具体而言,EliBadCode 首先根据特定编程语言的命名规范,从模型词表中筛选触发器 token,以缩小触发器搜索空间并降低成本。随后,EliBadCode 引入一种样本特定的触发器位置识别方法,该方法能够减少非后门(对抗性)扰动对后续触发器逆向的干扰,从而高效生成有效的逆向后门触发器。后门触发器可被视为后门(对抗性)扰动。接着,EliBadCode 采用 Greedy Coordinate Gradient(贪婪坐标梯度)算法优化逆向触发器,并设计了一种触发器锚定方法来纯化逆向触发器。最后,EliBadCode 通过模型遗忘消除后门。我们在用于三个安全关键代码理解任务的多个 NCMs 中评估了 EliBadCode 消除所植入后门的有效性。结果表明,EliBadCode 能够有效消除后门,同时对模型的正常功能产生极小的不利影响。

英文摘要:

Neural code models (NCMs) have been widely used to address various code understanding tasks, such as defect detection. However, numerous recent studies reveal that such models are vulnerable to backdoor attacks. Backdoored NCMs function normally on normal/clean code snippets, but exhibit adversary-expected behavior on poisoned code snippets injected with the adversary-crafted trigger. It poses a significant security threat. Therefore, there is an urgent need for effective techniques to detect and eliminate backdoors stealthily implanted in NCMs. To address this issue, in this paper, we innovatively propose a backdoor elimination technique for secure code understanding, called EliBadCode. EliBadCode eliminates backdoors in NCMs by inverting/reverse-engineering and unlearning backdoor triggers. Specifically, EliBadCode first filters the model vocabulary for trigger tokens based on the naming conventions of specific programming languages to reduce the trigger search space and cost. Then, EliBadCode introduces a sample-specific trigger position identification method, which can reduce the interference of non-backdoor (adversarial) perturbations for subsequent trigger inversion, thereby producing effective inverted backdoor triggers efficiently. Backdoor triggers can be viewed as backdoor (adversarial) perturbations. Subsequently, EliBadCode employs a Greedy Coordinate Gradient algorithm to optimize the inverted trigger and designs a trigger anchoring method to purify the inverted trigger. Finally, EliBadCode eliminates backdoors through model unlearning. We evaluate the effectiveness of EliBadCode in eliminating backdoors implanted in multiple NCMs used for three safety-critical code understanding tasks. The results demonstrate that EliBadCode can effectively eliminate backdoors while having minimal adverse effects on the normal functionality of the model.

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

↑