HackerPapers

arXiv:2007.02220cs.CR

You Autocomplete Me: Poisoning Vulnerabilities in Neural Code Completion

Roei Schuster, Congzheng Song, Eran Tromer, Vitaly Shmatikov

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

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.

arXiv comments
Accepted at USENIX Security '21
Journal reference
DOI
Subjects
cs.CRCryptography and Security cs.CLComputation and Language cs.LGMachine Learning cs.PLProgramming Languages

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Oct 2021 to Oct 2021. Found in 1 HN submission from Jul 2020 to Jul 2020. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments1 thread

    • This attack has been studied! https://arxiv.org/abs/2007.02220 Although our own work shows Copilot is pretty good at adding security flaws on its own: https://arxiv.org/abs/2108.09293

      moyixView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.