arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2007.02220cs.CRcs.CLcs.LGcs.PL
收藏

You Autocomplete Me:我的第一次

You Autocomplete Me: Poisoning Vulnerabilities in Neural Code Completion

Tel Aviv University(特拉维夫大学);Cornell Tech(康奈尔理工学院);Cornell University(康奈尔大学);Columbia University(哥伦比亚大学)

Roei Schuster, Congzheng Song, Eran Tromer, Vitaly Shmatikov

摘要:

代码自动完成是现代代码编辑器和IDE不可或缺的特性。最新一代的自动补全器使用神经语言模型,在公共开源代码库上训练,在当前环境下建议可能的(不仅仅是静态可行的)补全。我们证明了神经代码自动完成程序容易受到中毒攻击。通过向自动完成器的训练语料库添加一些特制的文件(数据投毒),或者直接对这些文件微调自动完成器(模型中毒),攻击者可以影响其对攻击者选择的上下文的建议。例如,攻击者可以“教”自动完成程序建议AES加密使用不安全的ECB模式,SSL/TLS协议版本使用SSLv 3,或者基于密码的加密使用低迭代次数。此外,我们表明,这些攻击是有针对性的:一个自动完成中毒的有针对性的攻击更有可能建议不安全的完成文件从特定的存储库或特定的开发人员。我们量化了针对基于Pythia和GPT-2的最先进自动完成器的有针对性和无针对性的数据和模型中毒攻击的有效性。然后,我们评估现有的防御中毒攻击,并表明他们在很大程度上是无效的。

英文摘要:

Code autocompletion is an integral feature of modern code editors and IDEs. The latest generation of autocompleters uses neural language models, trained on public open-source code repositories, to suggest likely (not just statically feasible) completions given the current context. We demonstrate that neural code autocompleters are vulnerable to poisoning attacks. By adding a few specially-crafted files to the autocompleter's training corpus (data poisoning), or else by directly fine-tuning the autocompleter on these files (model poisoning), the attacker can influence its suggestions for attacker-chosen contexts. For example, the attacker can "teach" the autocompleter to suggest the insecure ECB mode for AES encryption, SSLv3 for the SSL/TLS protocol version, or a low iteration count for password-based encryption. Moreover, we show that these attacks can be targeted: an autocompleter poisoned by a targeted attack is much more likely to suggest the insecure completion for files from a specific repo or specific developer. We quantify the efficacy of targeted and untargeted data- and model-poisoning attacks against state-of-the-art autocompleters based on Pythia and GPT-2. We then evaluate existing defenses against poisoning attacks and show that they are largely ineffective.

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

↑