arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.17506cs.SEcs.AIcs.CL
收藏

对神经代码搜索模型植入后门

Backdooring Neural Code Search

Purdue University(普渡大学);Nanjing University(南京大学)

Weisong Sun, Yuchen Chen, Guanhong Tao, Chunrong Fang, Xiangyu Zhang, Quanjun Zhang, Bin Luo

AI总结:

本文针对神经代码搜索模型的安全漏洞,提出名为BADCODE的后门攻击方法,通过特殊触发器生成注入流程,仅修改单个变量/函数名即可使恶意代码进入前11%,攻击效果与隐蔽性均优于基线。

摘要:

复用在线代码库中的现成代码片段是一种常见做法,可显著提升软件开发人员的生产力。为找到所需的代码片段,开发人员通过自然语言查询借助代码搜索引擎实现目标,而神经代码搜索模型正是这类搜索引擎背后的核心支撑。这类模型基于深度学习构建,凭借出色的性能受到广泛关注,但针对其安全性的研究却十分匮乏。尤其是攻击者可在神经代码搜索模型中植入后门,使模型返回存在安全/隐私问题的有缺陷甚至含漏洞的代码,这可能影响下游软件(如股票交易系统和自动驾驶系统),造成经济损失乃至危及生命的事故。本文证明此类攻击具备可行性且隐蔽性极强:攻击者仅需修改一个变量/函数名,就能让有缺陷/含漏洞的代码排名进入前11%。我们提出的攻击方法BADCODE具备特殊的触发器生成与注入流程,进一步提升了攻击的有效性与隐蔽性。我们在两个神经代码搜索模型上开展了评估,结果显示该攻击的性能比基线方法高出60%。用户研究表明,基于F1值衡量,该攻击的隐蔽性是基线方法的两倍。

英文摘要:

Reusing off-the-shelf code snippets from online repositories is a common practice, which significantly enhances the productivity of software developers. To find desired code snippets, developers resort to code search engines through natural language queries. Neural code search models are hence behind many such engines. These models are based on deep learning and gain substantial attention due to their impressive performance. However, the security aspect of these models is rarely studied. Particularly, an adversary can inject a backdoor in neural code search models, which return buggy or even vulnerable code with security/privacy issues. This may impact the downstream software (e.g., stock trading systems and autonomous driving) and cause financial loss and/or life-threatening incidents. In this paper, we demonstrate such attacks are feasible and can be quite stealthy. By simply modifying one variable/function name, the attacker can make buggy/vulnerable code rank in the top 11%. Our attack BADCODE features a special trigger generation and injection procedure, making the attack more effective and stealthy. The evaluation is conducted on two neural code search models and the results show our attack outperforms baselines by 60%. Our user study demonstrates that our attack is more stealthy than the baseline by two times based on the F1 score.

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

↑